[[MicroProfile_Telemetry]]
= MicroProfile Telemetry Subsystem

Support for https://microprofile.io/project/eclipse/microprofile-telemetry[MicroProfile Telemetry] is provided by the _microprofile-telemetry_ subsystem.

The MicroProfile Telemetry specification describes how OpenTelemetry can be integrated into a MicroProfile application.

[[subsystem-configuration-microprofile-telemetry]]
== Subsystem

The MicroProfile Telemetry integration is provided by the _microprofle-telemetry_ subsystem, and is included in the default configuration.  If not no present, the subsystem can be added using the following CLI commands.
[NOTE]
=====
The MicroProfile Telemetry subsystem depends on the OpenTelemetry subsystem, so it must be added prior to adding MicroProfile Telemetry.
=====

[source,options="nowrap"]
-----
$ jboss-cli.sh -c <<EOF
    if (outcome != success) of /subsystem=opentelemetry:read-resource
        /extension=org.wildfly.extension.opentelemetry:add()
        /subsystem=opentelemetry:add()
    end-if
    /extension=org.wildfly.extension.microprofile.telemetry:add
    /subsystem=microprofile-telemetry:add
    reload
EOF
-----

== Configuration

The MicroProfile Telemetry subsystem contains no configurable attributes or resources. Any server configuration related to OpenTelemetry should be made to the _opentelemetry_ subsystem, the documentation for which can be found in the relevant section of the Administration Guide.

The MicroProfile Telemetry subsystem does, however, allow for individual applications to override any server configuration via MicroProfile Config. For example, the default service name used in exported traces is derived from the deployment name, so if the deployment archive is `my-application-1.0.war`, the service name will be `my-application-1.0.war`. This can be overridden using the standard OpenTelemetry configuration properties (documented https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md[here]):

[source]
-----
otel.service.name=My Application
-----

Note also that, per spec requirements, MicroProfile Telemetry is *disabled by default* and must be manually enabled on a per-application basis:

[source]
-----
otel.sdk.disabled=false
-----
