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

Align sampling specs in SDK #1034

Merged
merged 24 commits into from
Aug 31, 2020
Merged

Align sampling specs in SDK #1034

merged 24 commits into from
Aug 31, 2020

Conversation

lzchen
Copy link
Contributor

@lzchen lzchen commented Aug 22, 2020

Description

Part of #906 to adhere to https:/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#sampling
Updates classes to adhere to the sampling spec.

Fixes # (issue)

Sampling changes

  • Decision is an enum.
  • Change Decision -> Sampling Result
  • should_sample returns sampling result
  • Remove span_id from should_sample fn def
  • Seperates ProbabilitySampler from ParentOrElse
  • ParentOrElseSampler new class
  • GetDescription method for all samplers
  • change is_recording_Events to is_recording
  • Remove "Optional" typing for Attributes in some method definitions (Attributes already has Optional typing)

TODO

  1. Make attributes in samplers immutable
  2. how to handle is_recording -> send to processor/exporter

@lzchen lzchen requested a review from a team August 22, 2020 07:31
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.

Most of the changes here look good, couple of minor suggestions/questions.

Should ParentOrElse be ParentBased? Looking at the spec, it looks like it was renamed: https:/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#parentbased

opentelemetry-sdk/src/opentelemetry/sdk/trace/sampling.py Outdated Show resolved Hide resolved
opentelemetry-sdk/tests/trace/test_sampling.py Outdated Show resolved Hide resolved
opentelemetry-sdk/tests/trace/test_sampling.py Outdated Show resolved Hide resolved
@aabmass
Copy link
Member

aabmass commented Aug 28, 2020

Should ParentOrElse be ParentBased? Looking at the spec, it looks like it was renamed: https:/open-telemetry/opentelemetry-specification/blob/master/specification/trace/sdk.md#parentbased

Also looks like ProbabilitySampler should be TraceIdRatioBased?

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, thanks for the update!

@lzchen lzchen merged commit c435600 into open-telemetry:master Aug 31, 2020
@lzchen lzchen deleted the sample branch August 31, 2020 19:07
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

Successfully merging this pull request may close these issues.

4 participants