MicroProfile OpenTracing 1.3

With MicroProfile OpenTracing 1.3, you can get more targeted tracing results and more easily correlate tracing requests with the application URL.

[23.0.0.3 and later]Stabilized features: The MicroProfile OpenTracing 1.3 feature is stabilized. The strategic alternative is mpTelemetry-1.0, a MicroProfile Telemetry feature. For more information, see the MicroProfile OpenTracing to MicroProfile Telemetry 1.0 migration document.

About this task

MicroProfile OpenTracing version 1.3 introduces a new operation name format and the ability to exclude server-side tracing.
Excluding server-side tracing

Server-side tracing can be excluded by specifying a skip pattern. You might want to exclude some trace information so that you get tracing for specific things. In that case, you might choose to exclude server-side tracing to reduce the number of spans that are created.

Operation name
The following operation name format makes it easier to correlate with the request URL:<@path value of endpoint's class>/<@path value of endpoint's method>

Procedure

  • Define the skip pattern by using the MicroProfile Config version 1.3 specification.
    The configuration key is mp.opentracing.ser ver.skip-pattern. The value is a regular expression that complies with java.util.regex.Pattern. If UriInfo.getPath() of the incoming server URL matches with the regular expression, this request is excluded from tracing.
    1. One way to define the skip pattern is to add it to server.env file.
      If your operating systems do not allow you to use characters such as dot (.) and dash (-) in the environment names, then you can substitute those characters with an underscore (_). For example, add mp_opentracing_server_skip_pattern=/inventory.* to the server.env file to exclude server-side tracing of the URL that matches /inventory.*.
  • To use the operation name format, set a MicroProfile Config version 1.3 compliant configuration key, mp.opentracing.server.operation-name-provider, to http-path. The default value is class-method.
    For example, add mp_opentracing_server_operation_name_provider=http-path to the server.env file to change the operation name to the new format.