Skip to content

Conversation

@Shubhdeep12
Copy link
Collaborator

@Shubhdeep12 Shubhdeep12 commented Jan 25, 2026

#1145

reference: https://develop.sentry.dev/sdk/telemetry/metrics/

  1. Metrics UI with aggregation and grouping
    • metrics list grouped by name with expandable sections
    • aggregations: sum, avg, min, max, count
    • oercentiles (P50, P90, P95, P99) for gauge and distribution types
    • detail side panel with full information
  2. Server-side metrics processing and formatting
    • parser support for Sentry metric envelopes (trace_metric items)
    • formatters for human, JSON, logfmt, and markdown
  3. MCP tool integration
    • query_metrics tool for filtering by name, type, trace ID, and time window
    • returns all metrics when called without filters
  4. E2E tests for metrics UI
  5. Fixtures for metrics and connected trace
Screen.Recording.2026-01-25.at.10.40.19.PM.mov

@vercel
Copy link

vercel bot commented Jan 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
spotlightjs Skipped Skipped Jan 25, 2026 6:06pm

Request Review

@github-actions
Copy link
Contributor

github-actions bot commented Jan 25, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (spotlight) Metrics support by Shubhdeep12 in #1265
  • Added new codecov action by MathurAditya724 in #1255

Bug Fixes 🐛

  • (cli) Show options in command-specific help output by BYK in #1260
  • (deps) Address Dependabot security alerts by BYK in #1261
  • Updated the codecov action to point to getsentry by MathurAditya724 in #1259

Internal Changes 🔧

  • (ci) Fix workflow warnings for cache action and codecov by BYK in #1251
  • (deps) Bump hono from 4.10.3 to 4.11.4 by dependabot in #1254
  • (release) Fix Docker Latest Target by BYK in #1252
  • Use pull_request_target for changelog preview by BYK in #1256

Other

  • Update documentation link in README.md by sergical in #1253

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 25, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 1476 uncovered lines.
❌ Project coverage is 75.18%. Comparing base (base) to head (head).

Files with missing lines (32)
File Patch % Lines
event.ts 52.61% ⚠️ 263 Missing
mcp.ts 62.01% ⚠️ 215 Missing
messageBuffer.ts 67.57% ⚠️ 120 Missing
docker-compose.ts 77.33% ⚠️ 85 Missing
utils.ts 31.71% ⚠️ 84 Missing
extras.ts 28.13% ⚠️ 69 Missing
debugLogging.ts 29.47% ⚠️ 67 Missing
utils.ts 75.28% ⚠️ 66 Missing
metrics.ts 16.22% ⚠️ 62 Missing
index.ts 24.59% ⚠️ 46 Missing
cors.ts 91.08% ⚠️ 39 Missing and 1 partials
logs.ts 28.85% ⚠️ 37 Missing
traces.ts 93.10% ⚠️ 33 Missing and 1 partials
userAgent.ts 52.63% ⚠️ 27 Missing
index.ts 80.47% ⚠️ 25 Missing
utils.ts 66.67% ⚠️ 23 Missing
errors.ts 75.53% ⚠️ 23 Missing
JsonViewer.tsx 71.62% ⚠️ 21 Missing
traces.ts 75.86% ⚠️ 21 Missing
processEnvelope.ts 86.67% ⚠️ 18 Missing
eventContainer.ts 78.05% ⚠️ 18 Missing
open.ts 42.86% ⚠️ 16 Missing
CodeViewer.tsx 54.55% ⚠️ 15 Missing
contentType.ts 66.67% ⚠️ 15 Missing
helpers.ts 70.45% ⚠️ 13 Missing
Attachment.tsx 90.00% ⚠️ 12 Missing and 1 partials
streaming.ts 76.09% ⚠️ 11 Missing
ShikiProvider.tsx 54.17% ⚠️ 11 Missing
AnsiText.tsx 91.00% ⚠️ 9 Missing
logger.ts 65.22% ⚠️ 8 Missing
logger.ts 87.50% ⚠️ 4 Missing and 1 partials
profileChunkProcessor.ts 100.00% ⚠️ 1 partials
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    76.31%    75.18%    -1.13%
==========================================
  Files           47        48        +1
  Lines         5690      5946      +256
  Branches       611       614        +3
==========================================
+ Hits          4342      4470      +128
- Misses        1348      1476      +128
- Partials         5         5         —

Generated by Codecov Action

@Shubhdeep12 Shubhdeep12 changed the title Feat: metrics Feat(spotlight): metrics support Jan 25, 2026
>
{type}
</span>
);
Copy link

Choose a reason for hiding this comment

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

Duplicate MetricTypeBadge component in two files

Low Severity

The MetricTypeBadge component is identically defined in both MetricDetail.tsx and MetricsList.tsx. Both implementations have the same props, the same color mappings for counter/gauge/distribution, and the same rendering logic. This duplication increases maintenance burden and risks inconsistent bug fixes if either copy needs to be modified.

Additional Locations (1)

Fix in Cursor Fix in Web

min: Math.min(...values),
max: Math.max(...values),
count: metrics.length,
};
Copy link

Choose a reason for hiding this comment

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

Duplicate switch case logic for gauge and distribution

Low Severity

The aggregateMetrics function has identical implementations for the gauge and distribution switch cases. Both return the same properties (sum, avg, min, max, count) calculated in the same way, creating unnecessary code duplication.

Fix in Cursor Fix in Web

getMetricsByName: (name: string) => {
return get().metricsByName.get(name) || [];
},
getMetricNames: () => Array.from(get().metricsByName.keys()),
Copy link

Choose a reason for hiding this comment

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

Unused getMetricsByName and getMetricNames functions

Low Severity

The getMetricsByName and getMetricNames functions are defined in the metrics slice and typed in the store types, but they are never called anywhere in the codebase. These are dead code that add unnecessary complexity and maintenance burden without providing value.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

{type}
</span>
);
}
Copy link

Choose a reason for hiding this comment

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

Duplicated MetricTypeBadge component across two files

Low Severity

The MetricTypeBadge component is defined identically in both MetricsList.tsx and MetricDetail.tsx. Both implementations have the same props, color mappings, and JSX structure. This duplicated logic increases maintenance burden and risks inconsistent bug fixes if changes are needed in the future.

Additional Locations (1)

Fix in Cursor Fix in Web

const payload = itemData as { items?: SentryMetricPayload[] };
if (payload.items && Array.isArray(payload.items)) {
allMetrics.push(...payload.items);
}
Copy link

Choose a reason for hiding this comment

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

Server-side metrics extraction omits required id field

Medium Severity

The extractMetricsFromEnvelopes function casts raw envelope items to SentryMetricPayload[], but the raw data from envelopes lacks the required id field. The type contract specifies id: string is mandatory, yet raw metric items don't include this field. The UI-side processMetricItems correctly adds IDs, but the server-side MCP tool doesn't, creating an inconsistency.

Fix in Cursor Fix in Web

@MathurAditya724
Copy link
Member

This looks awesome 🤩

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants