-
Notifications
You must be signed in to change notification settings - Fork 78
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
Improve logfire inspect
#727
base: main
Are you sure you want to change the base?
Conversation
Deploying logfire-docs with Cloudflare Pages
|
6afdee2
to
9495827
Compare
def test_inspect_drop_dependant_packages( | ||
tmp_dir_cwd: Path, logfire_credentials: LogfireCredentials, capsys: pytest.CaptureFixture[str] | ||
) -> None: | ||
logfire_credentials.write_creds_file(tmp_dir_cwd / '.logfire') | ||
with ExitStack() as stack: | ||
find_spec = stack.enter_context(patch('importlib.util.find_spec')) | ||
find_spec.side_effect = [True, None] * len(OTEL_PACKAGES) | ||
|
||
main(['inspect']) | ||
output = capsys.readouterr().err | ||
assert 'opentelemetry-instrumentation-fastapi' in output | ||
assert 'opentelemetry-instrumentation-starlette' not in output |
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.
This now fails because we handle the logic in a more assertive way.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #727 +/- ##
===========================================
- Coverage 100.00% 99.83% -0.17%
===========================================
Files 139 139
Lines 11206 11235 +29
Branches 1572 1583 +11
===========================================
+ Hits 11206 11217 +11
- Misses 0 12 +12
- Partials 0 6 +6 ☔ View full report in Codecov by Sentry. |
This doesn't pick up packages that are merely installed with e.g.
|
And when I use it in the logfire venv it tells me to install |
This PR adds the following arguments to
logfire inspect
:--explain
: Shouldn't be used frequently, but it helps, because it mentions the reason why the opentelemetry package was suggested.--ignore-package
: Used to ignore packages that user don't want to instrument.--ignore-standard-library
: Redundant if you use--ignore-package urllib --ignore-package sqlite3
, but helps as a shortcut.I've added a logic to handle packages that are only required by
opentelemetry
, like what is mentioned here: #330.Suggestions welcome on how to test this.