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

fix(sdk): support a "block-list" of things to not instrument #1958

Merged
merged 6 commits into from
Oct 31, 2024

Conversation

codehruv
Copy link
Contributor

  • I have added tests that cover my changes.
    Need help here. There are no specific tests checking for requests. Where should I add the test?

  • If adding a new instrumentation or changing an existing one, I've added screenshots from some observability platform showing the change.
    Could you give a recommendation on how to do this with our HoneyHiveTracer?

Is there a particular example script that would work?

  • PR name follows conventional commits format: feat(instrumentation): ... or fix(instrumentation): ....
  • (If applicable) I have updated the documentation accordingly.
    TBD, once the tests are running

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 13, 2024
@CLAassistant
Copy link

CLAassistant commented Sep 13, 2024

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot bot added new instrumentation python Pull requests that update Python code labels Sep 13, 2024
@codehruv
Copy link
Contributor Author

One more note, if someone specifically asks for requests package instrument, I'm not considering the disable behavior.

Copy link
Member

@nirga nirga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think there's a better way to do it

@@ -62,6 +62,7 @@ class TracerWrapper(object):
def __new__(
cls,
disable_batch=False,
disable_requests_instrumentation=True,
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 requests as a special additional scenario. Block list would be broad enough for future developments as well.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Sep 16, 2024
@nirga nirga changed the title feat(instrumentation): Disable auto-tracing of requests package by default fix(sdk): support a "block-list" of things to not instrument Sep 16, 2024
init_marqo_instrumentor()
init_lancedb_instrumentor()
init_groq_instrumentor()
def init_instrumentations(should_enrich_metrics: bool, block_instruments: Optional[Set[Instruments]] = None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally this might be an opportunity to combine these 2 ways and just have init_instrumentations work the same as the if instruments is not None clause - just set all instrumentations as the value of instruments. WDYT?

@@ -44,6 +44,7 @@ def init(
api_key: str = None,
headers: Dict[str, str] = {},
disable_batch=False,
disable_requests_instrumentation: bool = True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 31, 2024
@nirga nirga force-pushed the disable-requests-instrumentation branch 4 times, most recently from 7c830ba to bf4c0c1 Compare October 31, 2024 11:21
@nirga nirga force-pushed the disable-requests-instrumentation branch from bf4c0c1 to 5607c9b Compare October 31, 2024 11:26
@nirga nirga merged commit ac8d3c5 into traceloop:main Oct 31, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer new instrumentation python Pull requests that update Python code size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants