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

Fix the OTEL_TRACES_SAMPLER_ARG before executing sampler #103

Open
birojnayak opened this issue Sep 7, 2024 · 2 comments
Open

Fix the OTEL_TRACES_SAMPLER_ARG before executing sampler #103

birojnayak opened this issue Sep 7, 2024 · 2 comments

Comments

@birojnayak
Copy link
Collaborator

Based on this specification here , we should define OtelTracesSamplerArg (OTEL_TRACES_SAMPLER_ARG) into three parts (or at least assume people might provide). First things you should do is, split into 3 parts, if any part has error, set the default value, afterwards execute below.

        string? tracesSampler = System.Environment.GetEnvironmentVariable(OtelTracesSampler);
        string? tracesSamplerArg = System.Environment.GetEnvironmentVariable(OtelTracesSamplerArg);
        double samplerProbability = 1.0;
        if (tracesSampler != null)
        {
            try
            {
                samplerProbability = Convert.ToDouble(tracesSamplerArg);
            }
            catch (Exception)
            {
                Logger.Log(LogLevel.Trace, "Could not convert OTEL_TRACES_SAMPLER_ARG to double. Using default value 1.0.");
            }
        }

@AsakerMohd
Copy link
Collaborator

I don't think there's anything to be done here. The 3 parts in the spec is mentioned for For jaeger_remote and parentbased_jaeger_remote and not xray (which we have our own guidance for about using endpoint and polling_interval). The jaeger ones use pollingIntervalMs instead of polling_interval for example. If you set them incorrectly (like using the jaeger ones instead of the xray ones), then it's expected that the distro would throw an error in this case.

@birojnayak
Copy link
Collaborator Author

I got confused as the behavior for xray sampler is bit different to other sampler. Please document in the repo or some external documentation on how to use, so that customers are not confused (just like me). Ideally I would prefer to be documented in readme file.

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

No branches or pull requests

2 participants