MicroProfile Telemetry
2.0
1.1
1.0

This feature provides support for the Eclipse MicroProfile Telemetry specification for enterprise Java.

MicroProfile Telemetry 2.0 is compatible with multiple versions of the MicroProfile umbrella feature. It is automatically enabled when you enable microprofile-6.1 or microprofile-7.0. However, it also works with microprofile-5.0, microprofile-4.1, or microprofile-1.4 if you separately enable it alongside any of those features.

Enabling this feature

To enable the MicroProfile Telemetry 2.0 feature, add the following element declaration into your server.xml file, inside the featureManager element:

<feature>mpTelemetry-2.0</feature>

Examples

Enable OpenTelemetry

To enable OpenTelemetry for Open Liberty, in addition to enabling the MicroProfile Telemetry feature, you must also set the otel.sdk.disabled=false system property in one of the valid configuration sources. Depending on your application scenario, you can set this property at the runtime level or the application level. For more information, see Collecting and exporting logs, metrics, and traces with OpenTelemetry.

The following example demonstrates how to enable OpenTelemetry at the runtime level by setting the property in your bootstrap.properties file:

otel.sdk.disabled=false

When you enable the MicroProfile Telemetry feature and set this property, your system is ready to collect and export logs, metrics, and traces.

Collect logs from a specified source

To enable the MicroProfile Telemetry feature to collect logs from different sources in the Open Liberty runtime environment, configure the source attribute for the mpTelemetry element with a comma-separated list of log sources.

<mpTelemetry source="message, trace, ffdc"/>
  • The mpTelemetry configuration element is optional. If you do not specify it or the source attribute, the default configuration source is message.

  • If the source attribute is empty (source=“”), no sources are collected, and nothing is routed to the configured OpenTelemetry logs exporter.

  • The attributes and values are case insensitive.

Customize your application telemetry with the OpenTelemetry API

Although OpenTelemetry automatically collects a default set of logs, metrics, and traces, if you need to manually instrument your code to collect traces or define custom metrics, you must make the OpenTelemetry API visible in your development environment.

Enable third-party APIs for your application by adding the following code in your server.xml file:

<webApplication id="app-name" location="app-name.war">
    <classloader apiTypeVisibility="+third-party"/>
</webApplication>

Feature configuration elements

Third-party API packages provided by this feature

  • io.opentelemetry.api

  • io.opentelemetry.api.baggage

  • io.opentelemetry.api.baggage.propagation

  • io.opentelemetry.api.common

  • io.opentelemetry.api.logs

  • io.opentelemetry.api.metrics

  • io.opentelemetry.api.trace

  • io.opentelemetry.context

  • io.opentelemetry.context.propagation

  • io.opentelemetry.exporter.logging

  • io.opentelemetry.exporter.otlp

  • io.opentelemetry.exporter.otlp.logs

  • io.opentelemetry.extension.incubator.metrics

  • io.opentelemetry.instrumentation.annotations

  • io.opentelemetry.sdk.autoconfigure.spi

  • io.opentelemetry.sdk.autoconfigure.spi.logs

  • io.opentelemetry.sdk.autoconfigure.spi.metrics

  • io.opentelemetry.sdk.autoconfigure.spi.traces

  • io.opentelemetry.sdk.common

  • io.opentelemetry.sdk.logs.data

  • io.opentelemetry.sdk.logs.export

  • io.opentelemetry.sdk.metrics

  • io.opentelemetry.sdk.metrics.data

  • io.opentelemetry.sdk.metrics.export

  • io.opentelemetry.sdk.resources

  • io.opentelemetry.sdk.trace

  • io.opentelemetry.sdk.trace.data

  • io.opentelemetry.sdk.trace.export

  • io.opentelemetry.sdk.trace.samplers

  • io.opentelemetry.semconv

Features that this feature enables

Supported Java versions

  • JavaSE-11.0

  • JavaSE-17.0

  • JavaSE-21.0

  • JavaSE-23.0

Features that enable this feature

Developing a feature that depends on this feature

If you are developing a feature that depends on this feature, include the following item in the Subsystem-Content header in your feature manifest file.

io.openliberty.mpTelemetry-2.0; type="osgi.subsystem.feature"

SPI packages provided by this feature