sravani-revuri opened a new pull request, #10029:
URL: https://github.com/apache/ozone/pull/10029

   ## 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
   
   <img width="1020" height="200" alt="image" 
src="https://github.com/user-attachments/assets/f283e0e8-e3b2-4cbb-a9a4-4e175b0a505b";
 />
   
   span level sampling for command:
   
   ```
   ozone freon rk --numOfVolumes=1 --numOfBuckets=2 --numOfKeys=2
   ```
   <img width="1000" height="1000" alt="image" 
src="https://github.com/user-attachments/assets/0f54fdb0-1675-4bce-a2f3-9ce3dc2b07f9";
 />
   
   #### **2) Changing tracing.endpoint**
   
   #### **configs:**
   ```
   OZONE-SITE.XML_ozone.tracing.enabled=true
   OZONE-SITE.XML_ozone.tracing.endpoint=http://jaeger:4319
   ```
   #### **Output:**
   
   <img width="2540" height="538" alt="image" 
src="https://github.com/user-attachments/assets/d3dbb07c-6b03-4a35-8eca-197ab699d0cd";
 />
   
   
   ### **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"
   ```
   <img width="2562" height="272" alt="image" 
src="https://github.com/user-attachments/assets/438ca725-eafe-4b17-8bec-363030c984c7";
 />
   
   
   #### **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]
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to