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

Composite Samplers #250

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bfd33d9
Creating "Composite Samplers" OTEP.
PeterF778 Feb 29, 2024
611a140
File rename
PeterF778 Feb 29, 2024
16005a5
Merge branch 'main' into composite_samplers
PeterF778 Feb 29, 2024
772ef28
Creating "Composite Samplers" OTEP.
PeterF778 Feb 29, 2024
395bd0c
File rename
PeterF778 Feb 29, 2024
fcb6a4b
Updated version, with examples
PeterF778 Mar 5, 2024
9495d33
Merge branch 'composite_samplers' of https://github.com/PeterF778/ote…
PeterF778 Mar 5, 2024
b37f054
Fixing markdown-lint errors
PeterF778 Mar 5, 2024
7bcd40b
Fixing more markdown-lint errors
PeterF778 Mar 5, 2024
c72b06a
Modfied the behavior of Conjunction sampler.
PeterF778 Mar 12, 2024
7cb67c1
Added description for Approach Two.
PeterF778 Mar 15, 2024
ab8e962
Added description of ConsistentRateLimited, another example, and a fe…
PeterF778 Mar 21, 2024
47084f2
Changing description of sampler as suggested
PeterF778 Apr 9, 2024
a6d3705
Update text/0250-Composite_Samplers.md
PeterF778 Apr 19, 2024
cae3b74
Update text/0250-Composite_Samplers.md
PeterF778 Apr 19, 2024
0d3ce18
Update text/0250-Composite_Samplers.md
PeterF778 Apr 19, 2024
9a7afb3
Update text/0250-Composite_Samplers.md
PeterF778 Apr 22, 2024
129c99c
Update text/0250-Composite_Samplers.md
PeterF778 Apr 22, 2024
10ba0c1
Describing a two-phase processing for Approach Two.
PeterF778 May 1, 2024
1c15c2b
Fixing a typo
PeterF778 May 1, 2024
a0bfb1b
Minor adjustments and corrections, introducing Composable Sampler.
PeterF778 May 3, 2024
e544794
Adding more references
PeterF778 May 3, 2024
635b216
Update text/0250-Composite_Samplers.md
PeterF778 Jun 6, 2024
06cc32d
Update text/0250-Composite_Samplers.md
PeterF778 Jun 6, 2024
5cc2174
Update text/0250-Composite_Samplers.md
PeterF778 Jun 6, 2024
d3c82a3
Changing SamplingAdvice to SamplingIntent.
PeterF778 Jun 11, 2024
bfc3081
Removed EachOf and the incorrect example using ConsistentRateLimiting…
PeterF778 Jun 19, 2024
ed2a314
Removing special handling of THRESHOLD from Approach One.
PeterF778 Jun 21, 2024
424012e
Merge branch 'main' into composite_samplers
PeterF778 Jul 26, 2024
9c47d0f
Minor changes, whitespace fixes.
PeterF778 Jul 26, 2024
05943e9
Fine tuning the behavior of GetAttributes for AnyOf sampler.
PeterF778 Aug 28, 2024
4c40e85
Added link for the PR with the prototype implementation for Java.
PeterF778 Aug 30, 2024
577537e
Updated the link to prototype implementation.
PeterF778 Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions text/0250-Composite_Samplers.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ Each delegate sampler MUST be given a chance to participate in the sampling deci

`Conjunction` is a composite sampler which takes two Samplers (delegates) as the arguments. These delegate samplers will be hereby referenced as First and Second.
PeterF778 marked this conversation as resolved.
Show resolved Hide resolved

Upon invocation of its `shouldSample` method, the Conjunction sampler MUST invoke `shouldSample` method on the First sampler, passing the same arguments as received, and examine the received sampling Decision. Upon receiving `DROP` or `RECORD_ONLY` decision it MUST return the SamplingResult from the First sampler, and it MUST NOT proceed with querying the Second sampler. If the sampling decision from the First sampler is `RECORD_AND_SAMPLE`, the Conjunction sampler MUST invoke `shouldSample` method on the Second sampler.
Upon invocation of its `shouldSample` method, the Conjunction sampler MUST invoke `shouldSample` method on the First sampler, passing the same arguments as received, and examine the received sampling Decision. Upon receiving `DROP` or `RECORD_ONLY` decision it MUST return the SamplingResult from the First sampler, and it MUST NOT proceed with querying the Second sampler. If the sampling decision from the First sampler is `RECORD_AND_SAMPLE`, the Conjunction sampler MUST invoke `shouldSample` method on the Second sampler, effectively passing the `TraceState` received from the First sampler as the parent trace state.
jmacd marked this conversation as resolved.
Show resolved Hide resolved
If the sampling Decision from the Second sampler is `RECORD_AND_SAMPLE`, the Conjunction sampler MUST return a `SamplingResult` which is constructed as follows:

- The sampling Decision is `RECORD_AND_SAMPLE`.
- The set of span Attributes to be added to the `Span` is the sum of the sets of Attributes as provided by the First and the Second sampler.
- The `TraceState` to be used with the new `Span` is obtained by cumulatively applying the potential modfications from the First and Second sampler, with special handling of the `th` sub-key (the sampling rejection `THRESHOLD`) for the `ot` entry as described below.

If both First and Second samplers provided `th` entry in the returned `TraceState`, the resulting `TraceState` MUST contain `th` entry with the `THRESHOLD` being maximum of the `THRESHOLD`s provided by the First and Second samplers. Otherwise, the `th` entry MUST be removed.
If both First and Second samplers provided `th` entry in the returned `TraceState`, and the value of the `THRESHOLD` from the First sampler is `0`, then the resulting `TraceState` MUST contain `th` entry with the `THRESHOLD`as provided by the Second sampler. Otherwise, the `th` entry MUST be removed.
jmacd marked this conversation as resolved.
Show resolved Hide resolved

If the sampling Decision from the Second sampler is `RECORD_ONLY` or `DROP`, the Conjunction sampler MUST return a `SamplingResult` which is constructed as follows:

- The sampling Decision is `DROP`.
- The set of span Attributes to be added to the `Span` is empty.
- The `TraceState` to be used with the new `Span` is the passed-in `TraceState`, but with the `th` entry removed.
- The set of span Attributes to be added to the `Span` is as provided by the First sampler.
- The `TraceState` to be used with the new `Span` is the `TraceState` provided by the First sampler, but with the `th` entry removed.

### RuleBased

Expand Down