Skip to content

Persist Dashboard telemetry and run history in SQLite#18768

Draft
JamesNK wants to merge 77 commits into
microsoft:mainfrom
JamesNK:feature/dashboard-run-history
Draft

Persist Dashboard telemetry and run history in SQLite#18768
JamesNK wants to merge 77 commits into
microsoft:mainfrom
JamesNK:feature/dashboard-run-history

Conversation

@JamesNK

@JamesNK JamesNK commented Jul 14, 2026

Copy link
Copy Markdown
Member

Description

Dashboard telemetry previously existed only for the lifetime of the Dashboard process, which made it difficult to inspect an application after it stopped or compare behavior across runs. This change introduces SQLite-backed resource and telemetry repositories so the active run and completed runs can be queried efficiently from the Dashboard.

Highlights

  • Adds versioned, normalized SQLite schemas and repositories for resources, console logs, structured logs, traces, spans, metrics, dimensions, histogram buckets, and exemplars. Telemetry is stored relationally rather than as opaque JSON or protobuf payloads.
  • Adds None, Runs, and Append persistence modes. AppHost Dashboards default to Runs, which stores runs separately, prunes older runs, handles abandoned or in-use run directories, and opens historical databases read-only.
  • Adds a run selector to the Dashboard header. Users can switch between Current and a previous run without reloading the page. Historical views disable mutation controls and freeze metric charts at the latest stored timestamp.
  • Refactors Dashboard data-source and repository ownership so pages and services can use either the live repositories or a selected historical run. The shared in-memory telemetry repository remains available for parity testing.
  • Moves filtering, searching, paging, aggregation, retention, and field-value queries into SQLite. Connection pooling, batched writes, transactions, metadata/object caches, and bulk cleanup reduce command count and improve high-volume ingestion for logs, traces, metrics, exemplars, and histogram data.
  • Adds Dashboard self-observability. SQLite commands emit client activities with database operation, namespace, query text, error, and peer.service=dashboard.db attributes. ASP.NET Core request activities and SQLite activities are exported through OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is configured.
  • Passes the normalized application name, Dashboard data directory, and persistence configuration from the AppHost, and includes the required SQLite native assets in the managed Dashboard bundle.

User-facing usage

Use the run selector in the Dashboard header to choose Current or a previous run identified by its local start time. The resources, console logs, structured logs, traces, and metrics pages then show data from that run. Previous runs are read-only.

Screenshots / Recordings

This PR includes UI changes. Please add screenshots or screen recordings so reviewers can evaluate the visual changes without running locally.

  • For before/after comparisons, place them side-by-side or label them clearly.
  • For interactive changes, prefer a short screen recording.

TODO: Capture the run selector and a selected historical run showing disabled mutation controls and a frozen metric chart.

Security considerations

Persisted Dashboard data can include resource properties, logs, trace attributes, metric dimensions, and other application-supplied telemetry. The database inherits access controls from its containing Dashboard data directory, which must be protected from undesirable accounts. SQLite self-telemetry includes SQL query text and is sent to the configured OTLP endpoint when Dashboard self-export is enabled. This change does not expose a new inbound network endpoint. No threat model or security review has been completed for this change.

Validation

  • dotnet test --project tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj --configuration Release --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" (1,740 passed)
  • dotnet test --project tests/Aspire.Dashboard.Components.Tests/Aspire.Dashboard.Components.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" (200 passed)
  • dotnet build src/Aspire.Dashboard/Aspire.Dashboard.csproj --no-restore
  • Manually ran TestShop with all 14 resources healthy and verified that its AppHost Dashboard exported fresh ASP.NET Core and SQLite spans to a standalone Dashboard started with aspire dashboard run.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Copilot AI review requested due to automatic review settings July 14, 2026 02:01
@JamesNK
JamesNK marked this pull request as draft July 14, 2026 02:01
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 18768

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 18768"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum diff size. Try reducing the number of changed files and lines, and requesting a review from Copilot again.

@JamesNK
JamesNK force-pushed the feature/dashboard-run-history branch from 00f9f9e to bd4214e Compare July 14, 2026 02:42
Copilot AI review requested due to automatic review settings July 14, 2026 02:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum diff size. Try reducing the number of changed files and lines, and requesting a review from Copilot again.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI review requested due to automatic review settings July 14, 2026 06:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 138 out of 139 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • src/Aspire.Dashboard/Resources/Dialogs.Designer.cs: Generated file

Comment thread src/Aspire.Hosting/Dashboard/DashboardEventHandlers.cs Outdated
Comment thread src/Aspire.Dashboard/ServiceClient/DashboardSqliteDatabase.cs
Comment thread src/Aspire.Dashboard/ServiceClient/SelectedDashboardClient.cs Outdated
Comment thread src/Aspire.Dashboard/Otlp/Storage/SqliteTelemetryRepository.cs Outdated
Comment thread src/Aspire.Dashboard/Components/Controls/Chart/ChartContainer.razor.cs Outdated
Copilot AI review requested due to automatic review settings July 14, 2026 06:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 138 out of 139 changed files in this pull request and generated 5 comments.

Files not reviewed (1)
  • src/Aspire.Dashboard/Resources/Dialogs.Designer.cs: Generated file

Comment thread src/Aspire.Dashboard/ServiceClient/SelectedDashboardClient.cs Outdated
Comment thread src/Aspire.Dashboard/ServiceClient/DashboardClient.cs Outdated
Comment thread src/Aspire.Dashboard/ServiceClient/DashboardSqliteDatabase.cs
Comment thread src/Aspire.Dashboard/ServiceClient/DashboardRunStore.cs
Comment thread src/Aspire.Dashboard/Otlp/Storage/SqliteTelemetryRepository.Metrics.cs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI review requested due to automatic review settings July 14, 2026 08:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants