Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ns and us for config duration units #6654

Merged
merged 5 commits into from
Aug 20, 2024

Conversation

SylvainJuge
Copy link
Contributor

When using autoconfiguration SPI, configuration options can be parsed as a java.time.Duration by using ConfigProperties#getDuration.

However, the nanoseconds and microseconds are not supported, the smallest unit we can use is milliseconds (which is also the default).

This PR adds support for both nanoseconds ns and microseconds us.

Also, this adds a test to ensure using a negative duration can be used as a way to mark a configuration option as disabled (no change in implementation needed though).

@SylvainJuge SylvainJuge requested a review from a team August 19, 2024 09:20
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.05%. Comparing base (3e8092d) to head (02a0a12).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6654      +/-   ##
============================================
- Coverage     90.05%   90.05%   -0.01%     
- Complexity     6276     6278       +2     
============================================
  Files           697      697              
  Lines         18949    18951       +2     
  Branches       1858     1858              
============================================
+ Hits          17065    17066       +1     
  Misses         1312     1312              
- Partials        572      573       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Seems reasonable. Out of curiosity, what's the motivation? Which properties are you trying to configure to this level of granularity?

@SylvainJuge
Copy link
Contributor Author

Seems reasonable. Out of curiosity, what's the motivation? Which properties are you trying to configure to this level of granularity?

For the span stacktrace we need to define a otel.span.stacktrace.min.duration configuration option to configure it. When updating the tests in the implementation PR open-telemetry/opentelemetry-java-contrib#1414 we used to test with very short spans like 1ns and using the Duration parsing feature did not allow for such short durations.

In the mean time I've updated the tests in the PR to use milliseconds as the feature does not require such short durations, however there should not be any limitation on the configuration options.

In practice for this span stacktrace feature, I don't expect end-users to use nanosecond granularity, however having the ability to configure it with less than a millisecond would be relevant for example to help identify what triggers very short-lived spans like a call to an in-memory cache which can be less than a millisecond.

@jack-berg jack-berg merged commit d4b10a8 into open-telemetry:main Aug 20, 2024
18 checks passed
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