-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sampling capabilities to the tracing module (#2886)
* Improve assertHasTraceIDMetadata robustness * Add Sampler interface and ProbabilisticSampler implementation This commit adds a Sampler interface defining a contract for implementing support for sampling. This means that any client of a sampler could go through the interface to decide whether or not to perform an action or keep some piece of data. This commit adds a ProbabilisticSampler implementation of Sampler, meant to be implemented by propagators to decide whether they should set their sampling flag to true or false. This commit also adds a chance function which returns true with a `percentage` of chance, to support the ProbabilisticSampler implem. * Make Propagators support sampling by implementing the Sampler interface This commit defines a SamplerPropagator interface, which established the contract for a propagator which bases its sampling flag on a Sampler implementation. It also makes the concrete implementations of Propagators implement the Sampler interface, and ensure the flags field of the generated trace context headers is set based on the Sampler's result. * Implement support for the sampling option * Add sampling support in the tracing Client * Add tracing module sampling example * Address PR feedback from @codebien
- Loading branch information
Showing
9 changed files
with
482 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.