Instrumentation with Micrometer
- Micrometer Extension
- Jetty Micrometer Extension
- Jersey Micrometer Extension
- Instrumenting ExecutorServices
- Configuration
EDC provides extensions for instrumentation with the Micrometer metrics library to automatically collect metrics from the host system, JVM, and frameworks and libraries used in EDC (including OkHttp, Jetty, Jersey and ExecutorService).
See the event consumer sample for an example of an instrumented EDC consumer.
Micrometer Extension
This extension provides support for instrumentation for some core EDC components:
- JVM metrics
- OkHttp client metrics
- ExecutorService metrics
Jetty Micrometer Extension
This extension provides support for instrumentation for the Jetty web server, which is enabled when using the JettyExtension.
Jersey Micrometer Extension
This extension provides support for instrumentation for the Jersey framework, which is enabled when using the JerseyExtension.
Instrumenting ExecutorServices
Instrumenting ExecutorServices requires using the ExecutorInstrumentation service to create a wrapper around the service to be instrumented:
ExecutorInstrumentation executorInstrumentation = context.getService(ExecutorInstrumentation.class);
// instrument a ScheduledExecutorService
ScheduledExecutorService executor = executorInstrumentation.instrument(Executors.newScheduledThreadPool(10), "name");
Without any further configuration, a noop implementation of ExecutorInstrumentation is used. We recommend using the implementation provided in the Micrometer Extension that uses Micrometer’s ExecutorServiceMetrics to record ExecutorService metrics.
Configuration
The following properties can use used to configure which metrics will be collected.
edc.metrics.enabled: enables/disables metrics collection globallyedc.metrics.system.enabled: enables/disables collection of system metrics (class loader, memory, garbage collection, processor and thread metrics)edc.metrics.okhttp.enabled: enables/disables collection of metrics for the OkHttp clientedc.metrics.executor.enabled: enables/disables collection of metrics for the instrumented ExecutorServicesedc.metrics.jetty.enabled: enables/disables collection of Jetty metricsedc.metrics.jersey.enabled: enables/disables collection of Jersey metrics
Default values are always “true”, switch to “false” to disable the corresponding feature. edc.metrics.enabled applies
to all of them: a source is measured only if both its own setting and edc.metrics.enabled are “true”.
edc.metrics.jersey.contexts: comma-separated aliases of the API contexts whose requests the Jersey metrics measure, e.g.default,management,protocol,signaling, or*for all of them. Default:default. An alias without port mapping is ignored with a warning.
The extensions are part of controlplane-feature-observability-bom.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.