You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This sends traces directly to a observability tool, enabling real-time distributed tracing and performance monitoring. To ensure proper tracing, your observability tool (for e.g. Jaeger) must be running to receive trace data.
259
+
Configure signal-specific exporters only when you need to override the shared OTLP endpoint or protocol:
260
+
261
+
[source]
262
+
----
263
+
# Traces exporter (default: otlp)
264
+
otel.traces.exporter=otlp
265
+
266
+
# Metrics exporter (default: otlp)
267
+
otel.metrics.exporter=otlp
268
+
269
+
# Logs exporter (default: otlp)
270
+
otel.logs.exporter=otlp
271
+
----
272
+
273
+
This configuration sends telemetry data directly to an observability backend, enabling real-time distributed tracing, metrics collection, and log correlation. Ensure that the observability backend (for example, Jaeger for traces, or Grafana with Tempo and Loki) is running to receive telemetry data.
255
274
256
-
Using OTLP is advantageous because it is the native standard for OpenTelemetry, ensuring seamless integration with a wide range of observability tools. One of its key benefits is that it allows developers to use multiple observability platforms without changing instrumentation, providing a unified and vendor-neutral tracing solution.
275
+
OTLP is the native standard for OpenTelemetry. It allows you to use multiple observability platforms without changing instrumentation, providing a unified, vendor-neutral telemetry solution.
257
276
258
277
=== Verify the Traces
259
278
260
-
Once tracing is enabled and the appropriate exporter is configured, the next step is to verify that traces are being captured and sent to the observability backend. This ensures that the MicroProfile Telemetry setup is functioning correctly and that distributed tracing data is available for monitoring and debugging.
279
+
After you enable tracing and configure the exporter, verify that the traces are being captured and sent to the observability backend. This step confirms that the MicroProfile Telemetry setup functions correctly and that distributed tracing data is available for monitoring and debugging.
261
280
262
281
==== Run Jaeger
263
282
264
-
The simplest way to run Jaeger is with Docker using the command as below:
283
+
Run Jaeger using Docker with OTLP support:
265
284
266
285
[source, bash]
267
286
----
268
287
docker run -d --name jaeger \
269
-
-e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \
270
-
-p 5775:5775/udp \
271
-
-p 6831:6831/udp \
272
-
-p 6832:6832/udp \
273
-
-p 5778:5778 \
274
288
-p 16686:16686 \
275
-
-p 14268:14268 \
276
-
-p 14250:14250 \
277
-
-p 9411:9411 \
289
+
-p 4317:4317 \
290
+
-p 4318:4318 \
278
291
jaegertracing/all-in-one:latest
279
292
----
280
293
281
-
The above command runs the *all-in-one* Jaeger container, which includes the agent, collector, query service, and UI.
294
+
The above command runs the *all-in-one* Jaeger container, which includes the agent, collector, query service, and UI, with native OTLP support on ports 4317 (gRPC) and 4318 (HTTP/protobuf).
282
295
283
-
The Jaeger UI can be accessed at: `https://<hostname>:16686`.
296
+
Access the Jaeger UI at `http://<hostname>:16686`.
284
297
285
-
Ensure all the services of our MicroProfile E-commerce applications are running.
298
+
Ensure all the services of the MicroProfile E-commerce application are running.
286
299
287
-
Search using parameters like operation name, time range, or service for the traces associated with different microservices and confirm that the telemetry data is visible.
300
+
Search using parameters such as operation name, time range, or service name for the traces associated with different microservices, and confirm that the telemetry data is visible.
288
301
View a detailed breakdown of each span within the trace, including timing and attributes.
289
302
290
303
== Types of Telemetry
@@ -417,7 +430,101 @@ One of the key advantages of agent-based instrumentation is that it requires no
417
430
Refer to the https://opentelemetry.io/docs/zero-code/java/agent/getting-started/[OpenTelemetry Java Agent Getting Started page] for step-by-step instructions on enabling it for your application.
418
431
Once enabled, the agent automatically instruments the application, seamlessly integrating with distributed tracing systems without requiring developer intervention. This makes it an efficient and non-intrusive way to implement observability in MicroProfile applications.
419
432
420
-
Once enabled, the agent automatically instruments the application, seamlessly integrating with distributed tracing systems without requiring developer intervention. This makes it an efficient and non-intrusive way to implement observability in MicroProfile applications.
433
+
== Metrics
434
+
435
+
Metrics are captured measurements of an application's and runtime's behavior. An application can define custom metrics in addition to the required metrics provided by the runtime.
436
+
437
+
=== Access to the OpenTelemetry Metrics API
438
+
439
+
MicroProfile Telemetry MUST provide the following CDI bean for supporting contextual instance injection:
440
+
441
+
* `io.opentelemetry.api.metrics.Meter`
442
+
443
+
Inject the `Meter` to define and record custom metrics:
The `Meter` instance creates instruments such as counters and histograms. The runtime computes separate aggregations for each unique combination of attributes.
480
+
481
+
=== Required Metrics
482
+
483
+
Runtimes MUST provide the following metrics, as defined in the OpenTelemetry Semantic Conventions.
484
+
485
+
.Required HTTP server metric
486
+
[options="header"]
487
+
|===
488
+
|Metric Name |Type
489
+
|`http.server.request.duration` |Histogram
490
+
|===
491
+
492
+
.Required JVM metrics
493
+
[options="header"]
494
+
|===
495
+
|Metric Name |Type
496
+
|`jvm.memory.used` |UpDownCounter
497
+
|`jvm.memory.committed` |UpDownCounter
498
+
|`jvm.memory.limit` |UpDownCounter
499
+
|`jvm.memory.used_after_last_gc` |UpDownCounter
500
+
|`jvm.gc.duration` |Histogram
501
+
|`jvm.thread.count` |UpDownCounter
502
+
|`jvm.class.loaded` |Counter
503
+
|`jvm.class.unloaded` |Counter
504
+
|`jvm.class.count` |UpDownCounter
505
+
|`jvm.cpu.time` |Counter
506
+
|`jvm.cpu.count` |UpDownCounter
507
+
|`jvm.cpu.recent_utilization` |Gauge
508
+
|===
509
+
510
+
Metrics are activated whenever MicroProfile Telemetry is enabled with `otel.sdk.disabled=false`.
511
+
512
+
== Logs
513
+
514
+
The OpenTelemetry Logs bridge API enables existing log frameworks (such as SLF4J, Log4j, JUL, and Logback) to emit logs through OpenTelemetry. This specification does not define new Log APIs. The Logs bridge API is used by runtimes, not directly by application code. Therefore, this specification does not expose any Log APIs to applications.
515
+
516
+
Log output from an application is automatically bridged to the configured OpenTelemetry SDK instance when MicroProfile Telemetry is enabled. Configure the logs exporter in `microprofile-config.properties`:
When a log record is emitted from an application, the runtime bridges it to the configured OpenTelemetry SDK instance, which then exports it using the configured log exporter (for example, via OTLP). When an active trace context exists, the log record automatically includes the `traceId` and `spanId`, enabling correlation between logs and traces.
526
+
527
+
Logs are activated whenever MicroProfile Telemetry is enabled with `otel.sdk.disabled=false`.
421
528
422
529
== Analyzing Traces
423
530
@@ -528,7 +635,6 @@ To prevent unauthorized access during transmission, ensure that telemetry data i
@@ -563,7 +669,7 @@ Random sampling to limiting the amount of trace data collected:
563
669
[source, properties]
564
670
----
565
671
otel.traces.sampler=traceidratio
566
-
otel.traces.sampler.traceidratio=0.1
672
+
otel.traces.sampler.arg=0.1
567
673
----
568
674
569
675
=== Compliance with Regulations
@@ -593,6 +699,21 @@ Tracing can help detect potential security incidents. Monitor traces for unusual
593
699
Set up alerts for these anomalies to investigate and mitigate potential issues. +
594
700
By following these security considerations, you can leverage the benefits of distributed tracing without compromising the security of your system or the privacy of your users. Careful handling of trace data, coupled with robust encryption, access controls, and compliance practices, ensures that tracing remains a valuable yet secure component of your observability strategy.
595
701
702
+
== What's New in MicroProfile Telemetry 2.1
703
+
704
+
MicroProfile Telemetry 2.1 is aligned with MicroProfile 7.1. The following changes are delivered in this release.
* If you are migrating from earlier version of MicroProfile Telemetry, update the `microprofile-telemetry-api` dependency version to `2.1`.
708
+
* Verify that your deployment environment provides the OpenTelemetry Java v1.48.0 libraries or a later patch version.
709
+
* The stabilization of HTTP semantic conventions (attributes such as `http.method` have been renamed to `http.request.method`).
710
+
* The introduction of a single shared OpenTelemetry SDK instance when `otel.sdk.disabled=false` is configured at runtime initialization time.
711
+
* The addition of Metrics and Logs support.
712
+
713
+
=== Impact on Existing Applications
714
+
715
+
Applications that do not use JVM metrics are unaffected by the 2.1 changes. Applications relying on JVM metrics should update their `microprofile-telemetry-api` dependency version to 2.1 to benefit from the corrected JVM metrics configuration.
716
+
596
717
== Conclusion
597
718
598
719
MicroProfile Telemetry provides a robust foundation for observability in Java-based microservices, enabling developers to implement distributed tracing seamlessly. By leveraging this specification, you can gain deep insights into the flow of requests, identify bottlenecks, and enhance the reliability and performance of your applications. The integration of standardized tracing concepts like spans, traces, and context propagation ensures that developers can maintain a cohesive understanding of their system's behavior across service boundaries.
0 commit comments