-
Notifications
You must be signed in to change notification settings - Fork 625
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 use of built-in samplers in SDK configuration #3176
Conversation
ca645d4
to
1be89a8
Compare
51fe90d
to
7f0909d
Compare
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.
Added a question
Signed-off-by: Matej Gera <matej.gera@coralogix.com>
Signed-off-by: Matej Gera <matej.gera@coralogix.com>
c9d923f
to
1aaad26
Compare
Signed-off-by: Matej Gera <matej.gera@coralogix.com>
1aaad26
to
f5b308f
Compare
Hi @srikanthccv, sorry for the back and forth, I implemented it with your suggestion and cleaned up the PR. Hopefully now all is as should be. |
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.
Thanks @matej-g , but the type conversion is also missing here
opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/_configuration/__init__.py
Lines 298 to 299 in f05fa77
sampler_arg = os.getenv(OTEL_TRACES_SAMPLER_ARG, "") | |
sampler = sampler_factory(sampler_arg) |
It should be changed to
sampler_factory = _import_sampler_factory(sampler_name)
kwargs = {}
if sampler_name in ("traceidratio", "parentbased_traceidratio"):
try:
rate = float(os.getenv(OTEL_TRACES_SAMPLER_ARG))
except ValueError:
_logger.warning("Could not convert TRACES_SAMPLER_ARG to float.")
rate = 1.0
kwargs["rate"] = rate
sampler = sampler_factory(**kwargs)
Signed-off-by: Matej Gera <matej.gera@coralogix.com>
Signed-off-by: Matej Gera <matej.gera@coralogix.com>
b408173
to
fffc0b4
Compare
@srikanthccv you're right, that part was still missing. I added your suggestion. Hopefully now everything is fixed as expected. |
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.
Thank you
Hi. Thanks for this fix. Do you know when this fix will be available on PyPI? |
most probably (early) next week based on our monthly release schedule. |
Thanks @srikanthccv 🙌🏽 |
Description
Fixes a configuration bug which causes the instrumentation to fall back on the default sampler when a built-in sampler is specified, due to the samplers missing from entry points. For details see description of #3175.
P.S. I'm not a Python developer, so feedback on if this should be done other way is welcome.
Fixes #3175
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Failed to initialize custom sampler
due to it missing from entry points #3175 with expected behaviorDoes This PR Require a Contrib Repo Change?
Checklist: