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

Add non-user-code-prefix stuff #829

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add non-user-code-prefix stuff #829

wants to merge 3 commits into from

Conversation

dmontagu
Copy link
Contributor

@dmontagu dmontagu commented Jan 29, 2025

Adds a public API for adding items to the tuple of non-user-code-prefixes, so that the frames are excluded in logfire spans. This will be used in pydantic_ai; see occurrences of the following in that codebase:

# while waiting for https://github.com/pydantic/logfire/issues/745
try:
    import logfire._internal.stack_info
except ImportError:
    pass
else:
    from pathlib import Path

    logfire._internal.stack_info.NON_USER_CODE_PREFIXES += (str(Path(__file__).parent.absolute()),)

Closes #745

Copy link

cloudflare-workers-and-pages bot commented Jan 29, 2025

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 57f2093
Status: ✅  Deploy successful!
Preview URL: https://573fc9e5.logfire-docs.pages.dev
Branch Preview URL: https://non-user-code-prefix.logfire-docs.pages.dev

View logs

@alexmojaki
Copy link
Contributor

alexmojaki commented Jan 29, 2025

Please add it to logfire.testing since that's what this is really intended for and the logfire namespace is already crowded, and make it accept a module for usability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add def non_user_code_prefix
2 participants