-
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
Add documentation for the Logfire Query API #405
Conversation
Deploying logfire-docs with Cloudflare Pages
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 128 130 +2
Lines 9355 9499 +144
Branches 1217 1230 +13
==========================================
+ Hits 9355 9499 +144 ☔ View full report in Codecov by Sentry. |
Should I block this bot from the organization? |
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.
style_guide_test.md review details
Line Edit Problems/Proposals
Note: The following 3 comments are grouped by line.
Line 3
Existing text:
# This ia a test file
Issues:
- Style Guide - (Spelling-error) Did you really mean 'ia'?
Line 5
Existing text:
it will flag errors like on pydantic.
Issues:
- Style Guide - (Terms-error) Use 'Pydantic' instead of 'pydantic'.
Line 11
Existing text:
This is is an issue.
Issues:
- Style Guide - (Repetition-error) 'is' is repeated!
- Style Guide - (hyperlint.repeatedWords-error) 'is' is repeated, did you mean to repeat this word?
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.
style_guide_test.md review details
Line Edit Problems/Proposals
Note: The following 3 comments are grouped by line.
Line 3
Existing text:
# This ia a test file
Issues:
- Style Guide - (Spelling-error) Did you really mean 'ia'?
Line 5
Existing text:
it will flag errors like on pydantic.
Issues:
- Style Guide - (Terms-error) Use 'Pydantic' instead of 'pydantic'.
Line 11
Existing text:
This is is an issue.
Issues:
- Style Guide - (Repetition-error) 'is' is repeated!
- Style Guide - (hyperlint.repeatedWords-error) 'is' is repeated, did you mean to repeat this word?
|
||
If no `Accept` header is provided, the default response format is JSON. | ||
|
||
- **Query Parameters**: |
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 doesn't render properly
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.
and sql
needs to be included.
# Set the headers for authentication | ||
headers = { | ||
'Authorization': f'Bearer {read_token}', | ||
'Content-Type': 'application/json' |
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 needs to be Accept
, not Content-Type
- `application/vnd.apache.arrow.stream`: Returns the data in Apache Arrow format, suitable for high-performance data processing. | ||
- `text/csv`: Returns the data in CSV format, which is easy to use with many data tools. | ||
|
||
If no `Accept` header is provided, the default response format is JSON. |
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.
It seems to be required.
Query API
Logfire now provides a web API for programmatically running arbitrary SQL queries against the data in your Logfire projects.
This API can be used to retrieve data for export, analysis, or integration with other tools, allowing you to leverage
your data in a variety of ways.
The API is available at
https://logfire-api.pydantic.dev/v1/query
and requires a read token for authentication.You will be soon able to generate read tokens from the Logfire web interface (this is described in more detail in the docs added in this PR).
The API can return data in various formats, including JSON, Apache Arrow, and CSV.
Changes in this PR:
This PR adds documentation of how to make HTTP requests to this API directly, and also adds sync and async clients in
logfire.experimental.query_client
to make it convenient to write code leveraging these APIs from python.The clients are being included under the
logfire.experimental
namespace for now to indicate that they may be subject to breaking changes, though we do not have any such changes planned at this time and will try to avoid them as much as possible.