-
Notifications
You must be signed in to change notification settings - Fork 675
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(sdk): support a "block-list" of things to not instrument #1958
Changes from 1 commit
573a7bb
00bb29c
7d6c5b6
9a66946
d96d703
5607c9b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ class TracerWrapper(object): | |
def __new__( | ||
cls, | ||
disable_batch=False, | ||
disable_requests_instrumentation=True, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems highly specific, don't you think? I think I'd rather add something like the "instruments" parameter but that can be sort of a "block list" where any of the libraries in that parameter won't be instrumented. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Block list sounds like a better idea. The reason I went specific was because the tracer is normally expected to instrument GenAI-related packages, but has |
||
processor: SpanProcessor = None, | ||
propagator: TextMapPropagator = None, | ||
exporter: SpanExporter = None, | ||
|
@@ -125,7 +126,7 @@ def __new__( | |
|
||
instrument_set = False | ||
if instruments is None: | ||
init_instrumentations(should_enrich_metrics) | ||
init_instrumentations(should_enrich_metrics, disable_requests_instrumentation) | ||
instrument_set = True | ||
else: | ||
for instrument in instruments: | ||
|
@@ -525,7 +526,7 @@ def init_tracer_provider(resource: Resource) -> TracerProvider: | |
return provider | ||
|
||
|
||
def init_instrumentations(should_enrich_metrics: bool): | ||
def init_instrumentations(should_enrich_metrics: bool, disable_requests_instrumentation: bool): | ||
init_openai_instrumentor(should_enrich_metrics) | ||
init_anthropic_instrumentor(should_enrich_metrics) | ||
init_cohere_instrumentor() | ||
|
@@ -542,7 +543,6 @@ def init_instrumentations(should_enrich_metrics: bool): | |
init_transformers_instrumentor() | ||
init_together_instrumentor() | ||
init_redis_instrumentor() | ||
init_requests_instrumentor() | ||
init_urllib3_instrumentor() | ||
init_pymysql_instrumentor() | ||
init_bedrock_instrumentor(should_enrich_metrics) | ||
|
@@ -555,6 +555,9 @@ def init_instrumentations(should_enrich_metrics: bool): | |
init_lancedb_instrumentor() | ||
init_groq_instrumentor() | ||
|
||
if not disable_requests_instrumentation: | ||
init_requests_instrumentor() | ||
|
||
|
||
def init_openai_instrumentor(should_enrich_metrics: bool): | ||
try: | ||
|
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.
remove?