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 sampling for child spans when using opencensus trace provider #13267

Closed
RashmiRam opened this issue Sep 25, 2020 · 3 comments
Closed

Fix sampling for child spans when using opencensus trace provider #13267

RashmiRam opened this issue Sep 25, 2020 · 3 comments
Labels
area/tracing enhancement Feature requests. Not bugs or questions. stale stalebot believes this issue/PR has not been touched recently

Comments

@RashmiRam
Copy link

RashmiRam commented Sep 25, 2020

Title: Fix sampling for child spans when using Opencensus trace provider via https://github.com/envoyproxy/envoy/blob/v1.15.0/api/envoy/config/trace/v3/opencensus.proto

Description:
Opencensus trace provider honors envoy's trace sampling decision. But, there is an pending issue at their end census-instrumentation/opencensus-cpp#294 where the child span will always be sampled even if the parent span is not sampled. This leads to lots of orphan child spans which results in confusion.

When parent span is not sampled, child span will fall back either to the sampler present in startSpanOptions sent along while calling startSpan method OR to the default sampler configured at Opencensus traceOptions

IMO, there are 2 ways to solve this.

  1. Opencensus provides a way to configure the default sampler in traceOptions which envoy can expose in their config
  2. While creating a child span at envoy side, we can send the startSpanOptions with the sampler set accordingly as parent span's tracing decision.

[optional Relevant Links:]

Any extra documentation required to understand the issue.

@RashmiRam RashmiRam added enhancement Feature requests. Not bugs or questions. triage Issue requires triage labels Sep 25, 2020
@yanavlasov yanavlasov added area/tracing and removed triage Issue requires triage labels Sep 25, 2020
@RashmiRam
Copy link
Author

Among the mentioned solutions, the 1st one where we can configure the traceOptions of Opencensus through envoy is already existing.

trace_config mentioned in this proto https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/trace/v3/opencensus.proto can be configured like below to avoid orphan child spans showing up in UI

<<elided>>
tracing:
  provider:
    name : envoy.tracers.opencensus
      typed_config:
        "@type": type.googleapis.com/envoy.config.trace.v3.OpenCensusConfig
        trace_config:
          constant_sampler:
            decision: ALWAYS_OFF #See issue: https://github.com/census-instrumentation/opencensus-cpp/issues/294
<<elided>>

We can close this issue if the above is an accepted solution.

@github-actions
Copy link

github-actions bot commented Dec 9, 2020

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Dec 9, 2020
@github-actions
Copy link

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tracing enhancement Feature requests. Not bugs or questions. stale stalebot believes this issue/PR has not been touched recently
Projects
None yet
Development

No branches or pull requests

2 participants