Class MinimalMetricsSupport

  • All Implemented Interfaces:
    MetricsSupport, RestServiceSupport, Service

    public class MinimalMetricsSupport
    extends HelidonRestServiceSupport
    implements MetricsSupport
    Minimal implementation of MetricsSupport.

    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 the MetricsSupport 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 Detail

      • createEndpointForDisabledMetrics

        public static void createEndpointForDisabledMetrics​(String endpointContext,
                                                            Routing.Rules serviceEndpointRoutingRules)
        Adds routing rules so metrics-related requests go to the "not available" endpoint.
        endpointContext - web context for metrics
        serviceEndpointRoutingRules - 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 class HelidonRestServiceSupport
        defaultRules - default Routing.Rules to be updated
        serviceEndpointRoutingRules - 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 interface MetricsSupport
        endpointContext - context (typically /metrics)
        serviceEndpointRoutingRules - routing rules to update with the disabled metrics endpoints
      • 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 interface MetricsSupport
        routingName - routing name to use in setting up the vendor metrics
        routingRules - routing rules to modify