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 sample 04.3 for an example of an instrumented EDC consumer.
This extension provides support for instrumentation for some core EDC components:
- JVM metrics
- OkHttp client metrics
- ExecutorService metrics
This extension provides support for instrumentation for the Jetty web server, which is enabled when using the JettyExtension
.
This extension provides support for instrumentation for the Jersey framework, which is enabled when using the JerseyExtension
.
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.
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.