Instrumentation
Arconia OpenTelemetry supports two instrumentation approaches for Spring Boot applications. You can choose either based on your requirements and the libraries you are using.
| The OpenTelemetry Java Agent is not supported by Arconia OpenTelemetry. If you’d like to continue using the Agent, check out the OpenTelemetry Buildpack for adding it to your application out-of-the-box. |
Micrometer APIs
The Micrometer project provides APIs for instrumenting Java applications. The Spring portfolio is instrumented with Micrometer, following stable semantic conventions. Arconia OpenTelemetry includes bridges between Micrometer and OpenTelemetry, so all Micrometer-generated telemetry is automatically exported to OpenTelemetry backends.
The following APIs are available:
-
Observation: the recommended API. A single observation produces both metrics and traces, decoupling the capturing of contextual information from the generation of telemetry data. -
MeterRegistry: for metrics-only instrumentation. Metrics are automatically exported to OpenTelemetry via the Micrometer Metrics Registry OTLP or the Micrometer Metrics OpenTelemetry Bridge. -
Tracer: for traces-only instrumentation. Traces are automatically exported to OpenTelemetry via the Micrometer Tracing OpenTelemetry Bridge.
Check out the Micrometer and Spring Boot documentation for more information.
By default, Micrometer-based instrumentation uses its own stable naming conventions. Arconia lets you switch to different types like the OpenTelemetry Semantic Conventions or the OpenInference Semantic Conventions instead. Check out the Semantic Conventions documentation for more details.
Ignoring HTTP Server Requests
In Servlet web applications, Arconia records no observations for the HTTP requests sent to certain paths, so that frequent Kubernetes liveness and readiness probes don’t flood your telemetry backend. Spring Boot doesn’t provide a way to do this yet (see spring-boot#34801).
By default, the following paths are ignored:
-
/actuator/health/** -
/livez -
/readyz
Both metrics and traces are skipped, since they’re produced by the same observation. The observations started while handling an ignored request are skipped too, such as the Spring Security ones or the JDBC ones from a health indicator querying the database. Otherwise, they would have no parent and show up as separate traces (see spring-security#12854).
The /actuator/health/** pattern matches the health endpoint and its groups, such as /actuator/health/liveness. The defaults assume Spring Boot’s default management.endpoints.web.base-path, and the /livez and /readyz entries match the additional probe paths Spring Boot registers on the main server port when management.endpoint.health.probes.add-additional-paths is enabled. Adjust the paths if you change the base path or register different additional paths.
Patterns are matched against the path within the application, so they keep working when the application is deployed under a context path. With server.servlet.context-path=/app, the /livez pattern matches a request to /app/livez.
The decision is made once, when the request starts, and applies to the whole request. A request to an ignored path is not observed even when it fails, including the error page it’s forwarded to. Observations can’t be turned on halfway through a request, and those started on the error dispatch alone would show up as separate traces with no link to the failed request. The failure is still visible in the application logs, and Kubernetes reports failing probes as events. A health check reporting a DOWN status is a regular response with a 503 status, and is ignored like any other probe.
You can add additional paths to ignore without replacing the defaults:
arconia:
observations:
http:
server:
additional-ignore-paths:
- /internal/**
You can also replace the default ignored paths entirely:
arconia:
observations:
http:
server:
ignore-paths:
- /actuator/health/**
- /healthz
To observe every request again, set ignore-paths to an empty value:
arconia:
observations:
http:
server:
ignore-paths: ""
Ignoring requests is independent of the OpenTelemetry support, and still applies when it’s disabled with arconia.otel.enabled=false.
The following limitations apply:
-
Only requests on the main server port are ignored. If you serve the actuator on a separate port with
management.server.port, configure the probes to use the additional paths on the main port, for example withmanagement.endpoint.health.group.liveness.additional-path=server:/livez. Spring Boot doesn’t apply the application’s servlet filters to the separate management port (see spring-boot#31811), so requests on that port get no HTTP server observation and the request isn’t available when other observations start. With Spring Security, every request on that port, ignored path or not, still produces Spring Security traces with no parent (see spring-security#12854). -
Only observations started on the thread handling the request are ignored. Observations started on other threads, for example by an
@Asyncmethod called while handling a request to a path you added, are still recorded, and show up as separate traces.
| Property | Default | Description |
|---|---|---|
|
|
HTTP request paths for which no observations are recorded, including those started while handling the request. |
|
|
Additional HTTP request paths for which no observations are recorded, including those started while handling the request. |
OpenTelemetry APIs
The OpenTelemetry Java project provides its own APIs for instrumenting applications. The main APIs available for instrumentation are:
-
Tracer: for creating spans and distributed traces. -
Meter: for recording metrics (counters, histograms, gauges). -
Logger: for emitting structured log records. -
Context: for propagating context across threads and services.
Check out the OpenTelemetry Java API documentation for more information on how to use these APIs directly.
OpenTelemetry Java Instrumentation Libraries
The OpenTelemetry Java Instrumentation project provides libraries that instrument different Java libraries and frameworks. A full list of supported libraries is available in the project documentation.
Arconia OpenTelemetry doesn’t use any of these libraries by default. It is possible to add them to your project, but the recommendation is to prefer the built-in instrumentation in the Spring portfolio based on Micrometer. With Arconia, you can easily adopt the OpenTelemetry Semantic Conventions on top of the Micrometer-based instrumentation, getting the best of both worlds: stable instrumentation with standard naming.
| Several instrumentation libraries in the OpenTelemetry Java Instrumentation project are not stable yet (marked as experimental) and follow experimental semantic conventions. Both the libraries and the conventions are subject to breaking changes without notice. Always check the documentation and stability status of the specific instrumentation library before adopting it. |