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

Clean up ProbabilitySampler for 64 bit trace IDs #238

Merged
merged 11 commits into from
Feb 13, 2020

Conversation

c24t
Copy link
Member

@c24t c24t commented Oct 24, 2019

Follow up to #225.

This PR changes ProbabilitySampler so that it checks the left bits of the trace ID (following open-telemetry/opentelemetry-specification#331) instead of the right bits (like OpenCensus).

Whether this is the right behavior depends on open-telemetry/opentelemetry-specification#331, and does break from the other clients.

@c24t c24t added api Affects the API package. sdk Affects the SDK package. tracing labels Oct 24, 2019
This change because mypy isn't willing to believe the exponent is always
positive. See python/typeshed#285.
@a-feld a-feld removed their request for review December 10, 2019 00:56
@c24t c24t requested a review from a team February 7, 2020 23:56
@c24t c24t changed the title Make ProbabilitySampler check high bytes Clean up ProbabilitySampler for 64 bit trace IDs Feb 7, 2020
@c24t
Copy link
Member Author

c24t commented Feb 8, 2020

I reverted most of the changes in f2251ea now that we've decided to use the low bits for sampling decisions for compatibility with 64 bit trace IDs in w3c/trace-context#349. This is now mostly a cosmetic and testing change.

@c24t c24t added the needs reviewers PRs with this label are ready for review and needs people to review to move forward. label Feb 8, 2020
@codecov-io
Copy link

codecov-io commented Feb 8, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@2747f23). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #238   +/-   ##
=========================================
  Coverage          ?   85.32%           
=========================================
  Files             ?       38           
  Lines             ?     1956           
  Branches          ?      231           
=========================================
  Hits              ?     1669           
  Misses            ?      221           
  Partials          ?       66

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2747f23...29f5eff. Read the comment docs.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, just one question and a typo fix.

opentelemetry-api/src/opentelemetry/trace/sampling.py Outdated Show resolved Hide resolved
opentelemetry-api/src/opentelemetry/trace/sampling.py Outdated Show resolved Hide resolved
Copy link
Member

@mauriciovasquezbernal mauriciovasquezbernal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple of nits.

@@ -147,7 +148,7 @@ def test_probability_sampler(self):
trace.SpanContext(
0xDEADBEF0, 0xDEADBEF1, trace_options=TO_SAMPLED
),
0x8000000000000001,
0x8000000000000000,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would 0x0 make it more clear?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reason as above, but not a strong preference in either case.

@c24t c24t merged commit c50aab8 into open-telemetry:master Feb 13, 2020
@c24t c24t deleted the sampler-api-go-high branch February 13, 2020 17:32
toumorokoshi pushed a commit to toumorokoshi/opentelemetry-python that referenced this pull request Feb 17, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
* feat: add BatchSpanProcessor

* fix: remove default value, already done Ctor

* fix: append the MS unit

* fix: move unrefTimer function in core

* fix: use SetInterval instead of SetTimer

* fix: rename TraceOptions -> TraceFlags

* Update packages/opentelemetry-basic-tracer/src/export/BatchSpanProcessor.ts

Co-Authored-By: Olivier Albertini <olivier.albertini@montreal.ca>

* fix: remove _MS

* fix: rename _lastSpanWrite -> _lastSpanFlush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Affects the API package. needs reviewers PRs with this label are ready for review and needs people to review to move forward. sdk Affects the SDK package. tracing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants