ENG-9166 feat(otel): compile spans (2/3) - #6900
Conversation
Greptile SummaryThe PR instruments application compilation with an OpenTelemetry root span and nested stage spans while remaining inert when tracing is disabled.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/reflex-base/src/reflex_base/otel.py | Adds no-op-aware generic and compile span helpers with compile metadata attributes. |
| reflex/app.py | Wraps the existing compile and telemetry-accounting flow in the new root compile span. |
| reflex/compiler/compiler.py | Adds child spans around the major compile stages without changing their underlying operations. |
| tests/units/reflex_base/test_otel.py | Covers disabled helpers, compile attributes, and parent-child span relationships. |
| tests/units/test_app.py | Verifies a real compile emits root and stage spans with the expected hierarchy. |
Reviews (4): Last reviewed commit: "feat(otel): compile spans" | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e88ec4f6ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
All reported issues were addressed across 28 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
e88ec4f to
1f5b784
Compare
1f5b784 to
7c86654
Compare
7c86654 to
acf9a22
Compare
Alek99
left a comment
There was a problem hiding this comment.
The initial compile trace works locally, but the common backend-startup/stateful-marker path omits one advertised stage.
| with console.timing("Evaluate Pages (Backend)"): | ||
| with ( | ||
| console.timing("Evaluate Pages (Backend)"), | ||
| otel.span("reflex.compile.evaluate_pages"), |
There was a problem hiding this comment.
[P2] Include the stateful-marker backend evaluation in reflex.compile.evaluate_pages
When .web/backend exists and stateful_pages.json is present, the earlier branch evaluates each marked page with _compile_page(..., save_page=False) and returns at line 1171 before this span is entered. I reproduced that normal backend_startup path with an OTLP exporter: only the reflex.compile root was emitted even though page evaluation ran. Please wrap the marker-driven loop in the same stage span (or factor both paths through a shared helper) and cover the early-return marker path.
Part of #6227 (ENG-9166). Stack: 1/3 → 2/3 (this) → 3/3. Base is
farhan/eng-9166-reflex-otel(1/3); the diff is one commit.What
App._compileruns inside areflex.compilespan (reflex.compile.trigger,reflex.compile.dry_run); the compile stages get explicit child spans incompiler.py:reflex.compile.evaluate_pages,.pages,.copy_assets,.install_frontend_packages,.write.otel.span()/otel.compile_span()helpers (no-opnullcontextwhen disabled; compile is not a hot path).Log correlation (
trace_id/span_idon JSON log records) was split out of this stack: it needs theJsonHandlerfrom the logging pipeline (#6863) and will follow as a small PR once that lands (#6903).Tests
test_otel.py(span helpers, compile_span attributes/nesting),test_app.py::test_compile_emits_stage_spans(real compile, stages nest underreflex.compile).