Repository navigation
feat: trace requests across the frontend and backend - #150
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
lewisjared
added a commit
that referenced
this pull request
Oct 24, 2026
Bumps FastAPI to 0.162, which traces each request once a tracer provider is installed. This takes metrics, tracing and the /livez and /readyz probes from cr-service.
API calls carry traceparent, so backend spans join the browser trace.
lewisjared
force-pushed
the
observability
branch
from
October 24, 2026 00:26
1a88138 to
4d4a7dd
Compare
lewisjared
marked this pull request as ready for review
October 24, 2026 00:29
VITE_SENTRY_TRACES_SAMPLE_RATE defaults to 0.1, because the dashboard serves around 500k API requests a month.
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds request tracing across the frontend and backend, and moves the backend's metrics onto the shared
cr-servicepackage.cr-serviceinstalls one only whenOTEL_EXPORTER_OTLP_ENDPOINTis set, so local runs stay quiet, and adds a span per SQLAlchemy statement.*.climate-ref.org/apihost carrytraceparent, so the backend's spans join the browser trace./metricsnow comes fromcr-service, with ungrouped status codes and the shared latency buckets, so the shared Grafana Application dashboard reads it./livezand/readyz. They stay out of metrics and traces, but/api/v1/utils/health-check/no longer does, so the deployment probes should move to the new paths once this ships.ENVIRONMENT=localthe API logs one compact JSON object per line, in thecr-serviceshape (ts,level,logger,message), withtrace_idandspan_idinside a traced request. Grafana links a Loki line to its Tempo trace and back through that field. Local runs keep loguru's text output. The stdlib intercept now reports the real caller, where it used to reportlogging.SENTRY_TRACES_SAMPLE_RATE, which defaults to 1.0 like the oldenable_tracing=True.The browser traces 10% of page loads by default, set at build time by
VITE_SENTRY_TRACES_SAMPLE_RATE(also a Docker build arg), so one image carries one rate. The backend follows the browser's decision, so this rate also sets how many API spans from the dashboard reach Sentry and Tempo. Requests without a browser trace useSENTRY_TRACES_SAMPLE_RATEfor Sentry and are always kept in Tempo. Cross-origin API calls now send a CORS preflight because of the tracing headers.tests/test_tracing.pychecks that an incomingtraceparentbecomes the request span's trace id.