Elffuss BraidHub

kikocis/EDC public

cc2a9ff178c4 · 2.8 KiBRenderedRawPermalink
1# EDC extensions for instrumentation with Micrometer
2
3EDC provides extensions for instrumentation with the [Micrometer](https://micrometer.io/) metrics library to automatically collect metrics from the host system, JVM, and frameworks and libraries used in EDC (including OkHttp, Jetty, Jersey and ExecutorService).
4
5See [sample 04.3](https://github.com/eclipse-edc/Samples/blob/main/transfer/transfer-04-open-telemetry/README.md) for an example of an instrumented EDC consumer.
6
7## Micrometer Extension
8
9This extension provides support for instrumentation for some core EDC components:
10- JVM metrics
11- [OkHttp](https://square.github.io/okhttp/) client metrics
12- [ExecutorService](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/ExecutorService.html) metrics
13
14## Jetty Micrometer Extension
15
16This extension provides support for instrumentation for the [Jetty](https://www.eclipse.org/jetty/) web server, which is enabled when using the `JettyExtension`.
17
18## Jersey Micrometer Extension
19
20This extension provides support for instrumentation for the [Jersey](https://eclipse-ee4j.github.io/jersey/) framework, which is enabled when using the `JerseyExtension`.
21
22## Instrumenting ExecutorServices
23
24Instrumenting ExecutorServices requires using the `ExecutorInstrumentation` service to create a wrapper around the service to be instrumented:
25
26```java
27ExecutorInstrumentation executorInstrumentation = context.getService(ExecutorInstrumentation.class);
28
29// instrument a ScheduledExecutorService
30ScheduledExecutorService executor = executorInstrumentation.instrument(Executors.newScheduledThreadPool(10), "name");
31```
32
33Without 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](https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java) to record ExecutorService metrics.
34
35## Configuration
36
37The following properties can use used to configure which metrics will be collected.
38
39- `edc.metrics.enabled`: enables/disables metrics collection globally
40- `edc.metrics.system.enabled`: enables/disables collection of system metrics (class loader, memory, garbage collection, processor and thread metrics)
41- `edc.metrics.okhttp.enabled`: enables/disables collection of metrics for the OkHttp client
42- `edc.metrics.executor.enabled`: enables/disables collection of metrics for the instrumented ExecutorServices
43- `edc.metrics.jetty.enabled`: enables/disables collection of Jetty metrics
44- `edc.metrics.jersey.enabled`: enables/disables collection of Jersey metrics
45
46Default values are always "true", switch to "false" to disable the corresponding feature.