Skip to content

improve instrumentation docs #1625

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

Merged
merged 9 commits into from
May 13, 2025
Merged

improve instrumentation docs #1625

merged 9 commits into from
May 13, 2025

Conversation

samuelcolvin
Copy link
Member

No description provided.

Copy link
Contributor

hyperlint-ai bot commented May 1, 2025

PR Change Summary

Improved the instrumentation documentation for Logfire, enhancing clarity and usability.

  • Added detailed instructions for using Logfire with PydanticAI.
  • Updated examples to demonstrate instrumentation setup and usage.
  • Clarified monitoring capabilities for HTTP requests using Logfire.

Modified Files

  • docs/logfire.md
  • docs/troubleshooting.md

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

Copy link

github-actions bot commented May 1, 2025

Docs Preview

commit: ad4e358
Preview URL: https://14b4e940-pydantic-ai-previews.pydantic.workers.dev

@Kludex Kludex requested a review from alexmojaki May 1, 2025 13:37
@Kludex Kludex mentioned this pull request May 1, 2025
Copy link
Contributor

@alexmojaki alexmojaki May 1, 2025

Choose a reason for hiding this comment

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

fair point about the resolution, don't know how that happened.

Is including this stuff helpful?

Screenshot 2025-05-01 at 15 56 09 Screenshot 2025-05-01 at 15 56 02

Why not expand the trace trees fully?

What about the tool call responses on the right?

Copy link
Member Author

Choose a reason for hiding this comment

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

i think showing the full page adds helpful context.


* **Debugging** — Using the live view to see what's happening in your application in real-time.
* **Monitoring** — Using SQL and dashboards to observe the behavior of your application, Logfire is effectively a SQL database that stores information about how your application is running.

### Debugging
Copy link
Contributor

Choose a reason for hiding this comment

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

The video here really needs updating


![Logfire with HTTPX instrumentation](img/logfire-with-httpx.png)
![otel tui simple](img/otel-tui-simple.png)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is missing the httpx instrumentation spans

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's right.

Copy link
Contributor

Choose a reason for hiding this comment

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

Screenshot 2025-05-13 at 13 12 02

i'm saying that it says "running the above code containing logfire.instrument_httpx will display this" and that's not what it will display


agent = Agent('openai:gpt-4o', instrument=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like you've removed all mentions of Agent(instrument=...) which seems extreme

Copy link
Member Author

Choose a reason for hiding this comment

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

it's still in the API docs.

from pydantic_ai.agent import Agent
from pydantic_ai.models.instrumented import InstrumentationSettings

os.environ['OTEL_EXPORTER_OTLP_ENDPOINT'] = 'http://localhost:4318'
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand it might still be worth showing this this way, but I just want to point out that:

  1. OTLPSpanExporter uses that value by default anyway
  2. OTLPSpanExporter(endpoint=...) can be used instead of an env var

@samuelcolvin samuelcolvin merged commit c0afc0d into main May 13, 2025
19 checks passed
@samuelcolvin samuelcolvin deleted the improve-logfire-docs branch May 13, 2025 10:43
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.

2 participants