Package io.helidon.metrics.serviceapi
Class MinimalMetricsSupport
- java.lang.Object
-
- io.helidon.servicecommon.rest.HelidonRestServiceSupport
-
- io.helidon.metrics.serviceapi.MinimalMetricsSupport
-
- All Implemented Interfaces:
MetricsSupport
,RestServiceSupport
,Service
public class MinimalMetricsSupport extends HelidonRestServiceSupport implements MetricsSupport
Minimal implementation ofMetricsSupport
.Apps and other Helidon components which use
MetricSupport
(such as the MP metrics component) can very easily take advantage of the minimal implementation of the metrics registries and the metrics themselves if metrics is disabled via configuration or settings simply by using theMetricsSupport
factory methods which, based on the metrics settings, might choose this implementation.This implementation sets up the usual metrics-related endpoints but always sends a 404 response with an explanatory message.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configureVendorMetrics(String routingName, Routing.Rules routingRules)
Sets up vendor metrics routing using the specified routing name and routing builder.static void
createEndpointForDisabledMetrics(String endpointContext, Routing.Rules serviceEndpointRoutingRules)
Adds routing rules so metrics-related requests go to the "not available" endpoint.protected void
postConfigureEndpoint(Routing.Rules defaultRules, Routing.Rules serviceEndpointRoutingRules)
Concrete implementations override this method to perform any service-specific routing set-up.void
prepareMetricsEndpoints(String endpointContext, Routing.Rules serviceEndpointRoutingRules)
Prepares the family of/metrics
endpoints.void
update(Routing.Rules rules)
UpdatesRouting.Rules
withhandlers
representing this service.-
Methods inherited from class io.helidon.servicecommon.rest.HelidonRestServiceSupport
configureEndpoint, configureEndpoint, context, logger, onShutdown
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.helidon.metrics.serviceapi.MetricsSupport
configureEndpoint
-
-
-
-
Method Detail
-
createEndpointForDisabledMetrics
public static void createEndpointForDisabledMetrics(String endpointContext, Routing.Rules serviceEndpointRoutingRules)
Adds routing rules so metrics-related requests go to the "not available" endpoint.- Parameters:
endpointContext
- web context for metricsserviceEndpointRoutingRules
- routing rules for the metrics service
-
postConfigureEndpoint
protected void postConfigureEndpoint(Routing.Rules defaultRules, Routing.Rules serviceEndpointRoutingRules)
Description copied from class:HelidonRestServiceSupport
Concrete implementations override this method to perform any service-specific routing set-up.- Specified by:
postConfigureEndpoint
in classHelidonRestServiceSupport
- Parameters:
defaultRules
- defaultRouting.Rules
to be updatedserviceEndpointRoutingRules
- actual rules (if different from the default ones) to be updated for the service endpoint
-
prepareMetricsEndpoints
public void prepareMetricsEndpoints(String endpointContext, Routing.Rules serviceEndpointRoutingRules)
Description copied from interface:MetricsSupport
Prepares the family of/metrics
endpoints.By default, requests to the metrics endpoints trigger a 404 response with an explanatory message that metrics are disabled. Implementations of this interface can provide more informative endpoints.
- Specified by:
prepareMetricsEndpoints
in interfaceMetricsSupport
- Parameters:
endpointContext
- context (typically /metrics)serviceEndpointRoutingRules
- routing rules to update with the disabled metrics endpoints
-
update
public void update(Routing.Rules rules)
Description copied from interface:Service
UpdatesRouting.Rules
withhandlers
representing this service.- Specified by:
update
in interfaceMetricsSupport
- Specified by:
update
in interfaceService
- Parameters:
rules
- a routing rules to update
-
configureVendorMetrics
public void configureVendorMetrics(String routingName, Routing.Rules routingRules)
Description copied from interface:MetricsSupport
Sets up vendor metrics routing using the specified routing name and routing builder.- Specified by:
configureVendorMetrics
in interfaceMetricsSupport
- Parameters:
routingName
- routing name to use in setting up the vendor metricsroutingRules
- routing rules to modify
-
-