[release/13.2] Simplify TelemetryApiService.GetTrace and support short trace IDs#15613
Open
JamesNK wants to merge 4 commits intorelease/13.2from
Open
[release/13.2] Simplify TelemetryApiService.GetTrace and support short trace IDs#15613JamesNK wants to merge 4 commits intorelease/13.2from
JamesNK wants to merge 4 commits intorelease/13.2from
Conversation
- Use TelemetryRepository.GetTrace instead of fetching all traces - Add early return in GetTraceUnsynchronized for IDs shorter than ShortenedIdLength - Add parameterized unit test for full, short, and nonexistent trace IDs
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15613Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15613" |
davidfowl
approved these changes
Mar 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR streamlines trace lookup in the Dashboard telemetry API and aims to support shortened (prefix) trace IDs by delegating lookup to TelemetryRepository.GetTrace, which uses OtlpHelpers.MatchTelemetryId.
Changes:
- Reworked
TelemetryApiService.GetTraceto callTelemetryRepository.GetTrace(traceId)directly instead of pagingGetTraces()and searching in-memory. - Added a short-circuit in
TelemetryRepository.GetTraceUnsynchronizedfor trace IDs shorter thanShortenedIdLength(7). - Added a parameterized unit test covering full ID, 7-char prefix ID, and not-found cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Aspire.Dashboard/Api/TelemetryApiService.cs |
Simplifies trace retrieval by using repository direct lookup (enables shortened ID matching via repository logic). |
src/Aspire.Dashboard/Otlp/Storage/TelemetryRepository.cs |
Adds an early return for “too short” trace IDs in GetTraceUnsynchronized. |
tests/Aspire.Dashboard.Tests/TelemetryApiServiceTests.cs |
Adds theory coverage for full/prefix/invalid trace ID lookups through the API service. |
MatchTelemetryId already handles short IDs correctly with exact equality fallback, so the guard was preventing valid exact-match lookups.
Contributor
|
🎬 CLI E2E Test Recordings — 51 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23583252353 |
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.
Description
Simplify
TelemetryApiService.GetTraceand add support for short trace ID lookups.Changes:
TelemetryApiService.GetTrace: Replaced manualGetTraces()+ LINQ search with a direct call toTelemetryRepository.GetTrace(traceId), which already handles short trace ID matching viaOtlpHelpers.MatchTelemetryId.TelemetryRepository.GetTraceUnsynchronized: Added early return for trace IDs shorter thanShortenedIdLength(7 chars) to skip the loop when the ID is too short for a meaningful prefix match.Fixes #15611
Checklist