feat(logfire): add Pydantic Logfire block, docs - #6075
Conversation
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview The new Search and trace paths build SQL from filters with escaped literals; the raw query tool forwards caller SQL unchanged. Docs, Reviewed by Cursor Bugbot for commit c781e7f. Configure here. |
Greptile SummaryAdds a Pydantic Logfire block with four tools (search records, SQL query, get trace, get token info), shared URL/SQL helpers, registry/icon wiring, and docs.
Confidence Score: 5/5Safe to merge; the previously reported invalid-region URL issue is fixed and no blocking failures remain. No blocking failure remains. Explicit non-us/eu regions and unknown token regions throw clear errors instead of building undefined URLs, covered by regression tests.
|
| Filename | Overview |
|---|---|
| apps/sim/tools/logfire/utils.ts | Shared base URL, host normalization, SQL helpers, and query body builders with invalid-region guards and tests. |
| apps/sim/tools/logfire/query.ts | Raw SQL query tool posting to /v2/query with read-token auth. |
| apps/sim/tools/logfire/search_records.ts | Structured span/log search built as escaped SQL over records. |
| apps/sim/tools/logfire/get_trace.ts | Trace fetch by trace_id with chronological ordering. |
| apps/sim/tools/logfire/get_token_info.ts | Read-token introspection mapped to organization/project outputs. |
| apps/sim/blocks/blocks/logfire.ts | Block UI, operation switch, param mapping, templates, and skills. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Logfire block params] --> B{host set?}
B -->|yes| C[normalizeHost]
B -->|no| D{region auto?}
D -->|no| E{isCloudRegion}
E -->|yes| F[REGION_BASE_URLS]
E -->|no| G[throw invalid region]
D -->|yes| H[token prefix region]
H --> I{isCloudRegion}
I -->|yes| F
I -->|no| J[throw or default US]
C --> K[logfireUrl + path]
F --> K
K --> L["/v2/query or /v1/read-token-info"]
Reviews (4): Last reviewed commit: "feat(logfire): add Pydantic Logfire bloc..." | Re-trigger Greptile
5bffd94 to
81aa003
Compare
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f3e3440. Configure here.
Four read-token tools over Logfire's query API: structured span/log search,
raw SQL against records/metrics, full-trace fetch by ID, and read-token
introspection. Plus the block, icon, registry wiring, and generated docs.
Requests go to /v2/query with the region resolved from the token's
pylf_v{n}_{region}_ prefix, overridable by an explicit region or a self-hosted
host (public HTTPS only, per the tool executor's URL policy). Structured
filters are emitted as escaped SQL literals, using DataFusion contains() so
%/_ in user input stay literal.
Co-Authored-By: Claude <noreply@anthropic.com>
f3e3440 to
c781e7f
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c781e7f. Configure here.
Summary
Adds a Logfire block with four read-token tools — structured span/log search, raw SQL over records/metrics, full-trace fetch, and token introspection — plus icon, registry wiring, and docs.
Queries go to /v2/query with the region auto-detected from the token prefix, overridable by region or a self-hosted host (public HTTPS only); all filter input is escaped as SQL literals.
Type of Change
Testing
Tested manually
Checklist