-
Notifications
You must be signed in to change notification settings - Fork 567
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
[DO NOT MERGE] Port of jaeger remote sampler support #3827
[DO NOT MERGE] Port of jaeger remote sampler support #3827
Conversation
FYI, contrib is the appropriate place for components like this https://github.com/open-telemetry/opentelemetry-python-contrib. It can't be merged into SDK. |
- Introduce a dependency on tornado, in order to use IOLoop in RemoteControlledSampler - Introduce a variety of new samplers, which support the jaeger remote sampling protocol DRAFT - DO NOT MERGE There are a variety of challenging TODO's and, no doubt, changes to be made based on feedback from project maintainers. The goal of this initial set of changes is to conduct a pretty "straight" port of the corresponding code in jaeger-client-python, to get discussion going on how opentelemetry-python support for jaeger remote sampling should ultimately work.
0897f5a
to
1f5b19b
Compare
@srikanthccv Thanks for the initial feedback, and I completely agree that it seems a little strange/wrong that this isn't in contrib. However there are a couple of key places where, given the way the code is structured, the code at present, unless I'm missing something, technically must be in here. I will cite the areas I see as issues, and I'd appreciate guidance on what to do about them. I'd be happy to put together a minimal PR to this repo to "prep" the lib for accommodation of the larger portion (all the jaeger remote sampling impl) which I'd put in the contrib repo. |
# for RemoteControlledSampler | ||
# Q: Where should sampler.close() be called? I believe it might be | ||
# TracerProvider#shutdown (but not entirely sure) | ||
def close(self) -> None: |
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.
@srikanthccv Existing samplers in this repo are simple and don't need an explicit lifecycle event like this. Are we ok with me proposing to add a close method like this...and then, to call that in something like TracerProvider#shutdown
?
rate_limit_strategy = strategy.get(RATE_LIMITING_SAMPLING_STR) | ||
if not rate_limit_strategy: | ||
return DEFAULT_LOWER_BOUND | ||
return rate_limit_strategy.get(MAX_TRACES_PER_SECOND_STR, DEFAULT_LOWER_BOUND) | ||
|
||
_KNOWN_SAMPLERS = { |
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.
@srikanthccv This is a comprehensive list of samplers, which is checked in _get_from_env_or_default
. Obviously this works against the idea of there being samplers from outside of this repo - what do you suggest I do about this?
self.assertEqual(sampler.get_description(), 'GuaranteedThroughputProbabilisticSampler{op, 0.51, 3}') | ||
|
||
def test_sampler_equality(self): | ||
const1 = sampling.StaticSampler(True) |
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.
@srikanthccv for testing purposes in the ported code, these core samplers are meant to have equality implementations. Are we ok with me submitting equality tests and impl's into this repo?
Closing in favor of splitting this into this core PR and this contrib PR per @srikanthccv 's advice |
DRAFT - DO NOT MERGE
There are a variety of challenging TODO's (marked
TODO(sconover)
) and, no doubt, changes to be made based on feedback from project maintainers.The goal of this initial set of changes is to conduct a pretty "straight" port of the corresponding code in jaeger-client-python, to get discussion going on how opentelemetry-python support for jaeger remote sampling should ultimately work.
Please see the jaeger-client-python project and especially sampler.py and test_sampler.py for the source of much of this port.
New dependencies:
I expect there's a very good chance that opentelemetry python docs will need to be updated in advance of an ultimate merge, and would appreciate advice on what those areas might be.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
jaeger-client-python
Does This PR Require a Contrib Repo Change?
Answer the following question based on these examples of changes that would require a Contrib Repo Change:
Checklist:
I'm leaving all of the above "unchecked". I've made some style changes in the direction of this project and python 3, however I'm hesitant to "compromise" the relatively straight port at this point, to make comparison/contrasting easier for initial reviewers.
Regarding (even) unit tests: while this code is unit tested, the tests are ported, and stylistically are quite different from tests in this project - for example they make extensive use of mocks, among other differences.
Sample flask server and explanation: