-
Notifications
You must be signed in to change notification settings - Fork 773
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
Attributes added by sampler cannot be populated on activity #953
Comments
@lmolkova This is addressed in preview8 :) |
it is called |
Makes sense, thanks for the update! Great that trace-id is addressed already! ShouldSampleReturn value:It produces an output called SamplingResult which contains:
|
Its tracked here: #941. It doesn't require change from .NET as this is SDK only detail. |
I mean there is no way to propagate attributes generated by sampler in |
You can listen to the Activity start in the listener and add the whatever attributes. But you are right, cannot directly propagate attributes inside |
yeah, I can add attributes in Start event, but if sampler generates something (which is my scenario) - there would be no way to reflect them on the Activity. This scenario also seems to be part of OTel spec, so I wonder if we cautiously wanted to drop this scenario and if so why. Otherwise, I'd like to plan on fixing it. |
This scenario is not encountered or requested when we discussed the design with all parties. could you please send a pointer from the specs regarding that? CC @noahfalk |
I guess the scenario is somewhat tricky and not something that exists today at least in .NET so it was hard to expect it. ScenarioThe spec mentions a set of attributes that are returned in It's not crystal clear from the spec, whether it's the initial set of attributes that were used to create activity or sampler can modify them. Sampling OTEP is more clear and clarifies that these attributes are an addition to the initial set:
My scenario is actually the last one (one under discussion): sampler would populate its rate on the Activity and it will be used across multiple services to make consistent sampling decisions regardless of the initial algorithm used. What's the planSo my main concern is: let's say we will want to support this scenario in the next release. We'll need a breaking change for it (return more than I propose to have a new struct that is returned so that we comply with OTel spec and have a room for at least some extensibility here (I'm bad with naming, that's just an example). public readonly struct ActivitySamplingResult
{
public readonly IEnumberable<string, object> Attributes;
public readonly ActivityDataRequest DataRequest;
} And change I only see very hacky ways to solve it now (do this in http-in listeners), but it won't work with the |
Here is how java does it: And go: |
Could you please open a new issue in our runtime repo to discuss it and look at the proposal. |
Thanks @lmolkova for sharing more details. Yes I agree this scenario is not handled. And I also think its not possible to work around in OTel SDK. We need to change the return type to return ActivityDataRequest , and attributes/tags. |
Update: This is being discussed with .NET runtime team. As fixing this requires changes from .NET. |
dotnet/runtime#40339 - Issue tracking this in .NET side. |
[renamed]
Describe your environment. Describe any aspect of your environment relevant to the problem:
N/A
SDK version: (nuget versions of the all the relevant packages)
0.4.0-beta
.NET runtime version (.NET or .NET Core, TargetFramework in the .csproj file):
N/A (any)
Platform and OS version:
any
Steps to reproduce.
opentelemetry-dotnet/src/OpenTelemetry/Sdk.cs
Lines 158 to 191 in 920b0ed
We need a way to pass back trace-id if it was created and attributes that were set by sampler to comply with the spec along with sampling decision.
What is the expected behavior?
Trace-id used to make sampling decision should be reused for consistent sampling across services. Attributes set by sampler should also be propagated back from sampler (see spec).
What is the actual behavior?
Trace id will not be set on the activity (i.e. sampling result will be independent of trace-id and non-deterministic). Old PR about probability sampling suggests we determinism
Assuming another service downstream has a different sampling configuration and would need to recalculate sampling hash - it will create inconsistent sampling decisions between upstream and downstream.
Thoughts? @tarekgh @cijothomas @reyang
The text was updated successfully, but these errors were encountered: