Repository navigation
feat(monitor): serve the Logs tab's site events from the site's OpenTelemetry - #8426
Merged
Merged
Conversation
tlgimenes
enabled auto-merge (squash)
November 10, 2026 15:51
…elemetry The Monitor's Logs tab (#8332, UI only) reads GET /api/:org/monitor/:site/site/events, which had no route: the router answered 404 and the tab showed "Couldn't load the site's logs". The route reads otel_logs and otel_traces from the same warehouse, with the same tenant scope and guard as /site/data: one page of logs and spans, newest first, with a keyset cursor, and on the first page the histogram, the level counts and the service counts the contract asks for. Filters: kinds, levels, services, and q (text in the message, or a trace id). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tlgimenes
force-pushed
the
feat/monitor-site-events
branch
from
November 10, 2026 19:58
c3ea2d6 to
41909c6
Compare
decocms Bot
pushed a commit
that referenced
this pull request
Nov 10, 2026
PR: #8426 feat(monitor): serve the Logs tab's site events from the site's OpenTelemetry Bump type: minor - decocms (apps/api/package.json): 4.568.2 -> 4.569.0 Deploy-Scope: server
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.
Problem
The Monitor's Logs tab (#8332, which was UI only) calls
GET /api/:org/monitor/:site/site/events. That route was never added, so the router answers 404 and the tab shows "Couldn't load the site's logs / Not Found" for every Blocks v8 site.Change
A new route next to
/site/datainmonitor.ts. It uses the samerequireOwnedSiteguard (ownership first, then the plan), the same{ available: false }answer when the warehouse isn't configured, and returns 502 when a query fails.monitor-site-events.tsreadsotel_logsandotel_tracesfrom the same warehouse, with the sameSITE_SCOPEas the aggregated views (the collector's stamp on the site, production only). Every value is bound as a parameter. It returns the shape inapps/web/src/components/monitor/site-events-contract.ts:(ts, id).errorwhen its status is Error, otherwiseok.kinds,levels,services(comma lists, validated) andq(case-insensitive text in the message, or an exact trace id).histogram(one bucket per window step, under every filter except level),facets.levels,facets.services(under every filter except service) andtotal. Pages after a cursor skip these counts.SITE_SCOPE,inWindow,LOGS_TABLEand the newTRACES_TABLEare now exported frommonitor-site.ts.What sites send today, from
@decocms/blocks: error logs at the error sample rate, and spans only when the site raises its trace sample rate (0 by default). So most sites will list error logs only.Verification
monitor-site-events.test.tscovers:nextCursor, totals under a level filter, and no counts after a cursor.bun test apps/api/src/api/routes/monitor*: 39 pass.tsc --noEmit, oxlint, biome and knip are clean.otel_traceswith the standard schema (Timestamp,TraceId,SpanId,SpanName,Duration,StatusCode,SpanAttributes). If that table is missing, the route answers 502 instead of 404. The spans branch would then need to be gated or dropped, and that should be checked right after deploy.🤖 Generated with Claude Code
Summary by cubic
Implements the route behind the Monitor's Logs tab, which until now returned 404 and showed "Couldn't load the site's logs" for every Blocks v8 site.
Adds
GET /api/:org/monitor/:site/site/events, serving the site's own logs and spans from the OpenTelemetry warehouse (otel_logsandotel_traces) with the same tenant scope and ownership guard as/site/data. It returns pages of 100 newest-first events with a keyset cursor; the first page also carries the histogram and level and service counts. New filters:kinds,levels,services, andq(message text or exact trace id). Most sites send only error logs today, since trace sampling defaults to 0, so listings will usually be error logs only.Not verified against the production warehouse — the spans branch assumes the collector writes
otel_traceswith the standard schema, and answers 502 if that table is missing. Worth checking right after deploy.Written for commit 41909c6. Summary will update on new commits.