Repository navigation
perf(telemetry): mirror the Recall telemetry cleanup in the Server, the BFF, and the telemetry skills - #553
Merged
Merged
Conversation
… exception The open generic constraint on IRunsAgainWhenRaced made the DI container throw and catch a TypeLoadException and an ArgumentException for each request that did not match, which dotnet.exceptions counted. The behavior now takes each request and runs again only a marked command.
A request that the caller cancelled threw OperationCanceledException, which set the Error status and counted app.errors. The span keeps its error.type tag, but the cancel by the caller is a client outcome.
Each log line had ThreadId, MachineName, Application, and Environment, and Environment was Production also in Development. The resource attributes give the host, the service, and the environment once. The Server, the BFF, and the AppHost no longer add them, so the Serilog.Enrichers.Environment and Serilog.Enrichers.Thread packages are gone.
A tagged query span has code.file.path and code.line.number, so the tag repeated them in each query span.
service.version was the assembly version, 1.0.0 in each build, so an operator could not tell which build wrote a span. The Server and the BFF now read the informational version, which -p:Version sets and which names the commit in a build from a git checkout.
A published BFF gave a request log and a span for each script and style of a page load, and a dev BFF for each redirect of a page to the Vite dev server. SpaResponse marks the response where the BFF serves the SPA: the static files and the SPA fallback. A marked response with a status under 400 logs at Verbose, and its span loses the Recorded flag, so no exporter sends it. A proxied /api call, a BFF endpoint, an OIDC callback, a missing file, and a failure keep their log and span.
…ails Each run of BffSessionCleanupService started a bff.sessions.cleanup trace with its queries, and most runs delete nothing. The run now checks for an ended session or an expired logout token first, with no instrumentation. It starts the trace only when the check finds rows. A run that fails before the trace starts gets the trace in the catch, with the error.
The MCP SDK wrote three or four Information lines for each tool call, the same facts as the request log and the span of the call. They were in the trace that the client sent in the _meta of the call, so they did not even join the request trace. The MCP log tests now wait for the request log and read the parent trace and the request trace. The Server has no auth handler of its own that logs each challenge, and the JwtBearer challenge already logs from Warning.
…skills The telemetry doc gets a section on the log properties and the levels of the categories, and splits the resource attributes from the version. The aspire-telemetry skill names each signal that is absent on purpose, so that an agent does not look for it. The feature-telemetry skill tells a hosted service on a timer to trace only a run that works or fails.
The tracer of each BFF in a test listens to the sources of the whole process, so a test that ran at the same time put its query spans in the exporter of the cleanup tests. The tests now read the cleanup span, its children, and the tagged check queries. The check needs no suppression scope: no activity is current, so the Npgsql command filter sends no span for it.
…s or fails Each run of DPoPReplayCacheCleanupService started a dpop.replay_cache.cleanup trace, and most runs delete nothing. The run now asks HasExpiredDPoPProofs first and starts the trace only when the check finds an expired proof. The check goes through MediatR, whose RequestTracingBehavior starts a span, so it runs in a SuppressInstrumentationScope. A run that fails before the trace starts gets the trace in the catch, with the error. A cancel at shutdown is not an error. Rule 9 of feature-telemetry.md and the telemetry skills now name the suppression scope for a check through MediatR.
Cut the comments that repeat the code or claim facts about our own code, and correct the claim that the assembly version is 1.0.0.0 in each build.
…he page load The old SpaResponse mark cleared the Recorded flag at the end of the request. By then a signed-in page load had already exported the spans of its session read, and the request duration metric had taken the span as its exemplar. Both then pointed at a span that no exporter got. Now SpaFile decides from the web root file provider whether the static file middleware serves the request. The AspNetCore instrumentation Filter drops such a span at its start, as it drops a health probe, and the request log of such a file is Verbose when its status is under 400. The index.html of a page and the dev redirect keep their span and their log.
…cope With no current activity, the Npgsql command filter drops the span of each check query. But Npgsql 10 also starts a span with no parent when it opens a physical connection, and the BFF has no sampler for a parentless client span. So a cleanup run that found no work could still export a CONNECT trace. The check now runs in a SuppressInstrumentationScope, as the DPoP replay cache cleanup does. Rule 9 of the feature telemetry doc and the two telemetry skills now say that the check always runs in the scope.
BeforeAnyRow is the time at which a cleanup finds no row. The DPoP test names the expiry of its proof and the cleanup time after it. The proof expires after real time, so the hosted cleanup of the test server keeps it until the run.
…et SPA files The server also enriches a log with GrpcStatusDetailRedaction. ThreadId is gone because no resource attribute replaces it and it is noise in async code, not because it is the same on each line. The SDK derives the assembly version from -p:Version too, and the informational version also keeps the pre-release label. The request log, the file table, and the aspire-telemetry skill now describe SpaFile: only a file of the built SPA is quiet, and a page load keeps its log and its span.
Owner
Author
|
review-gate: passed f4d00b0 Two independent thermo-nuclear reviews ran. The first, at e81168a, found one medium and three low findings (orphan session spans under a dropped page-load span, exemplars that point to dropped spans, a parentless Open findings:
|
pdevito3
added a commit
that referenced
this pull request
Dec 4, 2026
…ok its port (#555) ## Why CI on #553 failed `a_worker_whose_worker_group_stops_on_a_fault_of_the_job_store_is_unhealthy` with `Failed to bind to address http://127.0.0.1:32785: address already in use`. `ServerProcess.FreePort` closes its listener before the Server child binds the port, so another process can take it first. Port 32785 is at the bottom of the range that Docker gives to the host ports of test containers. ## What changed - `ServerProcess.StartAsync` starts the Server again on a new port when the child stops with `AddressInUseException`, at most three times. A failed start is disposed before the next one. - After the child exits, the helper waits for the exit, so the output holds every line before it looks for `AddressInUseException`. ## Tradeoffs A child that binds port 0 and reports its address removes the race. It needs a log override for `Microsoft.Hosting.Lifetime` and a parse of two unnamed `http://127.0.0.1:N` lines (the `http` and the `grpc` endpoints), so the retry is the smaller fix. ## Verification - A test hack bound (without listen) the first six ports that `FreePort` gave. On the old helper, 4 of 6 `ServerRoleTests` failed with `The Server stopped with exit code 1`. With the retry, 6 of 6 passed. Without the hack, 6 of 6 passed. - The last commit (wait for the exit) is not run locally, because the local Docker daemon stopped answering. CI runs the role tests.
Owner
Author
|
verifier: PASS+NOTES b5a4bd2 Base: c43bb23 (main). Head: b5a4bd2. What I ran
What I saw (base -> head)
All three recipes passed at base and at head, with no page errors. Notes
|
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.
Why
Recall cleaned up its telemetry in #224, #225, and #227. The template had the same faults: an exception for each MediatR request, a caller that left counted as a server error, repeated log properties, a span and an Information log for each script of a page load, and a trace for each idle cleanup run.
What changed
RaceRetryBehaviorhas no generic constraint, so the DI container throws no first-chance exception for each request that is not marked.RequestTracingBehavior: a caller that left keepserror.type, but gets no Error status and noapp.errorscount.MachineName,ThreadId,Application, orEnvironment. The two enricher packages are gone.app.db.call_siteis gone. It repeated thecode.*tags.service.versionis the informational version (Telemetry.ServiceVersion), so-p:Versionand the commit show in each signal.Verbose.SpaFile.IsRequestedasks the web root file provider, and the instrumentationFilterdrops the span at start. A page load keeps its log and span.BffSessionCleanupServiceandDPoPReplayCacheCleanupServicecheck for work in aSuppressInstrumentationScope, and trace only a run that deletes rows or fails.Warning.docs/telemetry.md, rule 9 ofdocs/backend/feature-telemetry.md, and thefeature-telemetryandaspire-telemetryskills describe each change.Scope
Not ported from Recall:
AlwaysOnSampler(the template's Server spans have the BFF as parent), the job ID tags and job failure logs, the model provider spans, and the SQL text rule. No release workflow exists, so no build passes-p:Versionyet, and an image reports1.0.0.Tradeoffs
/local-apiand/signout-oidc.Verification
dotnet build FullstackTemplate.slnx: 0 warnings. Full suite at 4aa79bf..e97dfea: 4218 of 4218. After the review fixes: BFF 575 of 575, Functional 519 of 519, Unit 2529 of 2529, Integration 599 of 599.CONNECTspans before.app.db.call_siteon query spans. The published path is proven by tests only.