Skip to content

HDDS-14961. Move Tracing environment variables to Ozone configuration properties#10029

Open
sravani-revuri wants to merge 2 commits intoapache:masterfrom
sravani-revuri:HDDS-14961
Open

HDDS-14961. Move Tracing environment variables to Ozone configuration properties#10029
sravani-revuri wants to merge 2 commits intoapache:masterfrom
sravani-revuri:HDDS-14961

Conversation

@sravani-revuri
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Currently, OpenTelemetry tracing in TracingUtil relies on environment variables OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_TRACES_SAMPLER_ARG, and OTEL_SPAN_SAMPLING_ARG. which cannot be updated dynamically.
Moving these to the below configs to enable dynamic update.

OTEL_EXPORTER_OTLP_ENDPOINT → ozone.tracing.endpoint
OTEL_TRACES_SAMPLER_ARG → ozone.tracing.sampler
OTEL_SPAN_SAMPLING_ARG → ozone.tracing.span.sampling
Update hdds.tracing.enabled to ozone.tracing.enabled to align with the new naming convention.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14961

How was this patch tested?

Manual Testing and existing test cases.

Valid case:

1) Changing ozone.tracing.sample and ozone.tracing.span.sampling:

configs:

OZONE-SITE.XML_ozone.tracing.enabled=true
OZONE-SITE.XML_ozone.tracing.endpoint=http://jaeger:4317
OZONE-SITE.XML_ozone.tracing.sampler=0.5
OZONE-SITE.XML_ozone.tracing.span.sampling=createKey:0.5

Output:

2 traces when command is run 4 times

image

span level sampling for command:

ozone freon rk --numOfVolumes=1 --numOfBuckets=2 --numOfKeys=2
image

2) Changing tracing.endpoint

configs:

OZONE-SITE.XML_ozone.tracing.enabled=true
OZONE-SITE.XML_ozone.tracing.endpoint=http://jaeger:4319

Output:

image

Invalid case:

1) giving non decimal value to ozone.tracing.sample

configs:

OZONE-SITE.XML_ozone.tracing.enabled=true
OZONE-SITE.XML_ozone.tracing.endpoint=http://jaeger:4317
OZONE-SITE.XML_ozone.tracing.sampler=abc

Output:

ozone freon rk --numOfVolumes=1 --numOfBuckets=1 --numOfKeys=2
2026-04-02 06:58:34,974 [main] WARN tracing.TracingUtil: Invalid value for ozone.tracing.sampler: 'abc'. Falling back to default: 1.0
java.lang.NumberFormatException: For input string: "abc"
image

2) giving wrong values to ozone.tracing.sample and ozone.tracing.span.sampling

configs:

OZONE-SITE.XML_ozone.tracing.enabled=true
OZONE-SITE.XML_ozone.tracing.endpoint=http://jaeger:4317
OZONE-SITE.XML_ozone.tracing.sampler=-0.5
OZONE-SITE.XML_ozone.tracing.span.sampling=createKey:-0.5

Output:

ozone freon rk --numOfVolumes=2 --numOfBuckets=4 --numOfKeys=1
2026-04-02 06:07:50,708 [main] INFO tracing.TracingUtil: Sampling Trace Config = '-0.5'
2026-04-02 06:07:50,708 [main] INFO tracing.TracingUtil: Sampling Span Config = 'createKey:-0.5'
2026-04-02 06:07:50,708 [main] WARN tracing.TracingUtil: rate for span 'createKey' is 0 or less, ignoring sample configuration
2026-04-02 06:07:50,774 [main] ERROR tracing.TracingUtil: Failed to initialize tracing
java.lang.IllegalArgumentException: ratio must be in range [0.0, 1.0]

@sravani-revuri
Copy link
Copy Markdown
Contributor Author

@sumitagrawl could you please review this.

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sravani-revuri for working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants