Skip to content

ref(dashboards): Extract spans confidence footer into reusable component#109939

Merged
nsdeschenes merged 4 commits intomasterfrom
nd/logs-586/spans-confidence-refactor
Mar 6, 2026
Merged

ref(dashboards): Extract spans confidence footer into reusable component#109939
nsdeschenes merged 4 commits intomasterfrom
nd/logs-586/spans-confidence-refactor

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Mar 5, 2026

Extract the inline ConfidenceFooter from chart.tsx into a dedicated WidgetCardConfidenceFooter component and thread dataScanned through the widget query data pipeline alongside existing confidence/sampleCount props.

This is a refactor that prepares the confidence footer infrastructure for reuse across multiple widget types (logs and trace metrics will follow in stacked PRs). Currently scoped to spans widgets only -- no behavior change for other widget types.

Key changes:

  • New WidgetCardConfidenceFooter component that encapsulates the top-N calculation, series conversion, and sampling metadata logic previously inline in chart.tsx
  • New useWidgetRawCounts hook for fetching raw span counts
  • dataScanned prop threaded through genericWidgetQueries -> widgetCardChartContainer -> chart
  • useRawCounts updated to accept an optional selection prop for dashboard widget contexts

Stack:

  • This PR (base: master)
  • PR 2: Logs confidence (base: this branch)
  • PR 3: Trace metrics confidence (base: this branch)

Made with Cursor

Example:
Screenshot 2026-03-05 at 11 17 35

Extract the inline ConfidenceFooter from chart.tsx into a dedicated
WidgetCardConfidenceFooter component. Thread dataScanned through the
widget query pipeline alongside existing confidence/sampleCount props.
Create useWidgetRawCounts hook for fetching raw span counts.

Currently scoped to spans widgets only; logs and trace metrics support
will follow in subsequent PRs.

Co-Authored-By: Claude <noreply@anthropic.com>
Made-with: Cursor
@nsdeschenes
Copy link
Contributor Author

@cursor review

Thread showConfidenceWarning, confidence, dataScanned, isSampled, and
sampleCount through VisualizationWidget so the confidence footer renders
in the timeseries visualization path (used when the
dashboards-widget-timeseries-visualization flag is enabled).

Co-Authored-By: Claude <noreply@anthropic.com>
Made-with: Cursor
@nsdeschenes
Copy link
Contributor Author

@cursor review

Copy link
Contributor

@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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

… padding

Move padding to Container wrapper instead of applying it directly to
the Flex parent, keeping layout consistent between breakdown and
non-breakdown views.

Co-Authored-By: Claude <noreply@anthropic.com>
Made-with: Cursor
@nsdeschenes nsdeschenes requested a review from narsaynorath March 5, 2026 15:44
@nsdeschenes nsdeschenes marked this pull request as ready for review March 5, 2026 15:44
@nsdeschenes nsdeschenes requested review from a team as code owners March 5, 2026 15:44
Copy link
Member

@gggritso gggritso left a comment

Choose a reason for hiding this comment

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

👍🏻 I'm hoping we can do even more cleanup here soon by using /events-timeseries/ which has all the confidence information alongside the series, so we don't have to pass so many props along, but this seems reasonable for right now

@nsdeschenes nsdeschenes merged commit f437cb7 into master Mar 6, 2026
62 checks passed
@nsdeschenes nsdeschenes deleted the nd/logs-586/spans-confidence-refactor branch March 6, 2026 11:49
nsdeschenes added a commit that referenced this pull request Mar 6, 2026
…dgets (#109941)

Implement real confidence extraction for trace metrics widgets
(replacing the previous TODO stub) and wire it into the dashboard widget
card system.

Key changes:
- `traceMetricsWidgetQueries.tsx` now extracts confidence, dataScanned,
sampleCount, and isSampled from timeseries results using
`determineSeriesSampleCountAndIsSampled` and
`combineConfidenceForSeries`
- `WidgetCardConfidenceFooter` extended with `WidgetType.TRACEMETRICS`
branch using the explore `MetricsConfidenceFooter`
- `useWidgetRawCounts` extended to derive the correct `count(value,...)`
aggregate from the widget's trace metric definition
- `showConfidenceWarning` extended to include `WidgetType.TRACEMETRICS`
in widget viewer modal and widget preview

**Stack:**
- PR 1: Spans confidence refactor (base: master) #109939
- **This PR** (base: PR 1)

Made with [Cursor](https://cursor.com)
nsdeschenes added a commit that referenced this pull request Mar 6, 2026
…09940)

Wire up `LogsWidgetQueries` for sampling-aware log widget queries and
add logs confidence footer rendering to the dashboard widget card
system.

Key changes:
- New `LogsWidgetQueries` component (mirrors `SpansWidgetQueries`
pattern) that extracts confidence and sampling metadata from timeseries
results
- Logs routing added to `WidgetCardDataLoader`
- `WidgetCardConfidenceFooter` extended with `WidgetType.LOGS` branch
using the explore `LogsConfidenceFooter`
- `useWidgetRawCounts` extended to fetch raw counts for the `ourlogs`
dataset
- `showConfidenceWarning` extended to include `WidgetType.LOGS` in
widget viewer modal and widget preview

**Stack:**
- PR 1: Spans confidence refactor (base: master) #109939
- **This PR** (base: PR 1)

Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants