Skip to content

Reject histogram bucket count length changes#18865

Open
JamesNK wants to merge 3 commits into
mainfrom
fix/histogram-bucket-count-validation
Open

Reject histogram bucket count length changes#18865
JamesNK wants to merge 3 commits into
mainfrom
fix/histogram-bucket-count-validation

Conversation

@JamesNK

@JamesNK JamesNK commented Jul 23, 2026

Copy link
Copy Markdown
Member

Description

Malformed histogram telemetry can contain different bucket-count lengths for points in the same instrument and dimension series. The dashboard previously stored both points, then failed while calculating chart data because cumulative histogram values could not be compared across different bucket layouts.

Reject histogram data points when their bucket-count length changes within a series. The valid points already stored for the series remain available, so viewing the instrument no longer fails because of the rejected point.

Add a telemetry repository regression test that sends two individually valid histogram points with different bucket layouts and verifies that only the first point is accepted and stored.

Validation

dotnet test --project tests/Aspire.Dashboard.Tests/Aspire.Dashboard.Tests.csproj --no-launch-profile -- --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Passed: 1512
Failed: 0
Skipped: 0

Fixes # (issue)

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 23, 2026 00:06
@JamesNK
JamesNK requested a review from adamint as a code owner July 23, 2026 00:06
@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 -- 18865

Or

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

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

Rejects histogram points whose bucket-count length changes within a dimension series, preventing chart calculation failures while preserving valid telemetry.

Changes:

  • Validates bucket-count length before storing histogram points.
  • Adds regression coverage for rejecting incompatible points.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
DimensionScope.cs Rejects incompatible histogram bucket lengths.
MetricsTests.cs Tests acceptance and rejection counts and retained data.

Comment thread tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/MetricsTests.cs Outdated
@github-actions

This comment has been minimized.

@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.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 03:38

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 2 out of 2 changed files in this pull request and generated no new comments.

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector (audit mode)

The full test matrix and all jobs still run in audit mode. The tests and jobs below are what selective CI would run under enforcement.

7 / 100 test projects · 4 jobs, from 2 changed files.

Selected test projects (7 / 100)

Aspire.Cli.EndToEnd.Tests, Aspire.Dashboard.Components.Tests, Aspire.Dashboard.Tests, Aspire.Hosting.DotnetTool.Tests, Aspire.Hosting.RemoteHost.Tests, Aspire.Managed.Tests, Aspire.Playground.Tests

Selected jobs (4)

cli-starter, deployment-e2e, extension-e2e, polyglot


How these were chosen — grouped by what changed

🔧 src/Aspire.Dashboard/Otlp/Model/MetricValues/DimensionScope.cs (changed source)
5 via the project graph: Aspire.Dashboard.Components.Tests, Aspire.Hosting.DotnetTool.Tests (2 hops), Aspire.Hosting.RemoteHost.Tests (2 hops), Aspire.Managed.Tests (2 hops), Aspire.Playground.Tests (2 hops)

📦 affected project Aspire.Managed
1 test: Aspire.Cli.EndToEnd.Tests

🧪 tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/MetricsTests.cs (changed test)
1 directly: Aspire.Dashboard.Tests

Job reasons

Job Triggered by
cli-starter • affected project Aspire.Managed
• selected test Aspire.Cli.EndToEnd.Tests
deployment-e2e affected project Aspire.Managed
extension-e2e src/Aspire.Dashboard/Otlp/Model/MetricValues/DimensionScope.cs
• affected project Aspire.Dashboard
polyglot affected project Aspire.Managed

Selection computed for commit 0b47fe6.

@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.

2 participants