Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.86 KB

File metadata and controls

48 lines (33 loc) · 1.86 KB

Span stacktrace capture

This module provides a SpanProcessor that captures the code.stacktrace.

Capturing the stack trace is an expensive operation and does not provide any value on short-lived spans. As a consequence it should only be used when the span duration is known, thus on span end.

Usage and configuration

This extension supports autoconfiguration, so it will be automatically enabled by OpenTelemetry SDK when included in the application runtime dependencies.

otel.java.experimental.span-stacktrace.min.duration

  • allows to configure the minimal duration for which spans have a stacktrace captured
  • defaults to 5ms
  • a value of zero will include all spans
  • a negative value will disable the feature

otel.java.experimental.span-stacktrace.filter

  • allows to filter spans to be excluded from stacktrace capture
  • defaults to include all spans.
  • value is the class name of a class implementing java.util.function.Predicate<ReadableSpan>
  • filter class must be publicly accessible and provide a no-arg constructor

Usage with declarative configuration

You can enable the stacktrace span processor using declarative YAML configuration with the OpenTelemetry SDK. For example:

file_format: 1.0-rc.1
tracer_provider:
  processors:
    - stacktrace/development:
        min_duration: 10 # minimal duration in ms, default is 5, MUST be an integer
        filter: my.class.Name # optional, default is to include all spans

This configuration will register the StackTraceSpanProcessor for all spans.

Component owners

Learn more about component owners in component_owners.yml.