-
Notifications
You must be signed in to change notification settings - Fork 440
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
Parent-or-else Sampler #142
Conversation
Codecov Report
@@ Coverage Diff @@
## master #142 +/- ##
==========================================
+ Coverage 93.61% 93.75% +0.13%
==========================================
Files 71 74 +3
Lines 1754 1792 +38
==========================================
+ Hits 1642 1680 +38
Misses 112 112
|
* A placeholder class that stores the states of a span. | ||
* Will be replaced by the real SpanContext class once it is implemented. | ||
*/ | ||
class Sampler::SpanContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
private: | ||
std::shared_ptr<Sampler> delegate_sampler_; | ||
std::string description_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could make both members const
, as there's no way to change them.
{ | ||
return {Decision::NOT_RECORD, nullptr}; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could flatten this out, to increase readability:
if (parent_context == nullptr)
{
return delegate_sampler_->ShouldSample(parent_context, trace_id, name, span_kind, attributes);
}
if (parent_context->sampled_flag)
{
return {Decision::RECORD_AND_SAMPLE, nullptr};
}
return {Decision::NOT_RECORD, nullptr};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Extracting the SpanContext
class will happen in a separate PR.
@reyang this should be ready to merge. |
} | ||
} // namespace trace | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: would you add an empty line before EOF?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
bool is_recording; | ||
bool sampled_flag; | ||
}; | ||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: probably add an empty line here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Please rebase after fixing the nits. |
Create a ParentOrElse sampler and corresponding test cases described in the spec.