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

RedisInstrumentor doesn't respect "supress_instrumentation" flag #2057

Open
martimors opened this issue Nov 13, 2023 · 0 comments · May be fixed by #2064
Open

RedisInstrumentor doesn't respect "supress_instrumentation" flag #2057

martimors opened this issue Nov 13, 2023 · 0 comments · May be fixed by #2064
Labels
bug Something isn't working

Comments

@martimors
Copy link

martimors commented Nov 13, 2023

We have a healtcheck in our app, which checks Redis connectivity using the PING command. It is very uninteresting to trace, and spams our trace storage so much that we cannot currently use the RedisInstrumentor for our application.

Other instrumentor libraries, such as the requests one and the gRPC one, check for this flag when deciding whether or not to start a new trace. The same solution could be applied here.

Same issue in gRPC client instrumentor: #559
Nice illustration of the exact way to fix it for the Redis instrumentor:

if context.get_value(
_SUPPRESS_INSTRUMENTATION_KEY
) or context.get_value(_SUPPRESS_HTTP_INSTRUMENTATION_KEY):
(this is how I fixed it for the Redis instrumentor too).

I've already implemented and verified a fix for this, just waiting for internal approval to submit it.

Steps to reproduce

from opentelemetry.instrumentation.redis import RedisInstrumentor
from redis import Redis
from opentelemetry.context import attach, detach, set_value
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY

RedisInstrumentor.instrument()

client = Redis()
token = attach(set_value(_SUPPRESS_INSTRUMENTATION_KEY, True))
client.ping()
detach(token)

What is the expected behavior?
No trace

What is the actual behavior?
Trace

Additional context
Add any other context about the problem here.

@martimors martimors added the bug Something isn't working label Nov 13, 2023
@martimors martimors linked a pull request Nov 15, 2023 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant