Skip to main content

Custom tags configuration

Custom tags configuration via startup parameter

You can use OTEL_RESOURCE_ATTRIBUTES= startup parameter to pass a custom static tag to all spans generated in the service. For example:


Custom tags configuration through your code

If the default tags are not providing enough relevant data you can add custom tags or attributes into spans. Follow these steps:

Step 1: Satisfy project dependencies

Add the opentelemetry-sdk library.

  • Maven projects

    <!-- -->
  • Gradle projects

    dependencies {
    compile 'io.opentelemetry:opentelemetry-sdk:1.16.0'

Step 2: Import dependencies

Import dependencies in the application Java class file:

import io.opentelemetry.api.trace.Span;

Step 3: Add custom tag into Span

Use the following to add a custom tag:

Span currentSpan = Span.current();
Privacy Statement
Terms of Use

Copyright © 2023 by Sumo Logic, Inc.