-
Notifications
You must be signed in to change notification settings - Fork 46
OTel Benchmarker, Fixes AB#3404902 #2786
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
Conversation
|
✅ Work item link check complete. Description contains link AB#3404902 to an Azure Boards work item. |
c3ae409 to
8b77649
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an OpenTelemetry benchmarking system that can capture and report detailed timing statistics for telemetry spans. The benchmarker is disabled by default and provides statistical analysis (averages, percentiles) of span events with timing data.
Key changes:
- Refactored OTelUtility from Java to Kotlin with a factory pattern to support pluggable span implementations
- Added benchmarking infrastructure with configurable span factories and asynchronous data collection
- Introduced stress testing support by allowing bypass of silent token command caching
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| OTelUtility.kt | New Kotlin implementation with factory pattern for span creation |
| OTelUtility.java | Removed original Java implementation |
| OTelBenchmarkSpanFactory.kt | Factory that creates benchmark-enabled spans for specified span names |
| IOTelSpanFactory.kt | Interface defining span factory contract |
| DefaultOTelSpanFactory.kt | Default factory implementation maintaining original behavior |
| IBenchmarkSpanPrinter.kt | Interface for asynchronous benchmark data printing |
| DefaultBenchmarkSpanPrinter.kt | Implementation that writes statistical reports to files |
| BenchmarkSpan.kt | Span wrapper that captures timing data for benchmarking |
| CommandDispatcher.java | Added method to get active thread count for concurrent request tracking |
| SilentTokenCommand.java | Added ability to bypass caching for stress testing |
| build.gradle | Added build configuration for stress test cache bypass |
| changelog.txt | Updated with new feature entry |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
common4j/src/main/com/microsoft/identity/common/java/opentelemetry/DefaultOTelSpanFactory.kt
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/opentelemetry/DefaultOTelSpanFactory.kt
Show resolved
Hide resolved
8b77649 to
ded76d0
Compare
common4j/src/main/com/microsoft/identity/common/java/opentelemetry/OTelUtility.kt
Show resolved
Hide resolved
[AB#3404910](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3404910) NOTE: in order for this to work, the build config ```shouldSkipSilentTokenCommandCacheForStressTest``` must be set to true. Otherwise, the redundant requests will be absorbed by the CommandDispatcher cache and it won't be fired concurrently to broker. See AzureAD/microsoft-authentication-library-common-for-android#2786) <img width="654" height="1408" alt="image" src="https://github.com/user-attachments/assets/9603c253-a906-4ee3-afdd-f1d8767a1e35" /> --------- Co-authored-by: Copilot <[email protected]>
AB#3404902
Add a benchmarker that can be hooked up with OTelUtility. This is disabled by default.
To Enable it, set this when the process (e.g. broker) is initiated.

This benchmarker will record the timestamp every time an attribute/event is set in the given span(s).
It would calculate (average, by percentile) and print a summary to a file that would look like this.