-
Notifications
You must be signed in to change notification settings - Fork 711
fix: fixed stream name in traces RED queries #8795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Overview
Summary
Fixed hardcoded stream name in traces RED (Rate, Errors, Duration) metrics queries by replacing the hardcoded "default" stream name with a dynamic [STREAM_NAME] placeholder that gets populated with the currently selected stream.
Key Changes:
- Updated
metrics.jsonto replace hardcodedFROM "default"withFROM [STREAM_NAME]placeholder in all three RED metric queries - Consolidated three separate queries into one optimized base query that calculates all metrics (duration, rate, error) in a single CTE
- Added stream name replacement logic in
TracesMetricsDashboard.vueto substitute placeholder withsearchObj.data.stream.selectedStream.value - Added 10-second buffer to trace detail query time windows to ensure edge cases are captured
Impact:
This fix ensures RED metrics dashboards correctly query the user's selected trace stream rather than always querying the hardcoded "default" stream, which would have shown incorrect or missing metrics for users with differently-named trace streams.
Confidence Score: 5/5
- This PR is safe to merge with minimal risk
- The changes are well-scoped and fix a clear bug where metrics queries used a hardcoded stream name. The fix follows established patterns in the codebase for dynamic stream selection, and the additional query optimization consolidates redundant CTEs. The time buffer addition is a defensive improvement for edge cases.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| web/src/plugins/traces/metrics/metrics.json | 4/5 | Replaced hardcoded "default" stream with [STREAM_NAME] placeholder and unified all three RED queries to use a single optimized base query |
| web/src/plugins/traces/metrics/TracesMetricsDashboard.vue | 5/5 | Added dynamic stream name replacement logic that substitutes [STREAM_NAME] placeholder with the currently selected stream name |
| web/src/plugins/traces/TraceDetails.vue | 5/5 | Formatting changes only (indentation/whitespace), added 10-second buffer to trace query time windows |
Sequence Diagram
sequenceDiagram
participant User
participant TracesUI
participant TracesMetricsDashboard
participant Dashboard
participant QueryEngine
participant Database
User->>TracesUI: Select stream (e.g., "my_traces")
TracesUI->>TracesMetricsDashboard: Pass selectedStream.value
TracesMetricsDashboard->>TracesMetricsDashboard: Load metrics.json template
Note over TracesMetricsDashboard: Template contains [STREAM_NAME] placeholder
TracesMetricsDashboard->>TracesMetricsDashboard: Replace [STREAM_NAME] with "my_traces"
Note over TracesMetricsDashboard: Query: FROM "my_traces" WHERE...
TracesMetricsDashboard->>TracesMetricsDashboard: Replace [WHERE_CLAUSE] with filters
TracesMetricsDashboard->>Dashboard: Pass dashboard with final queries
Dashboard->>QueryEngine: Execute SQL queries (Duration, Rate, Errors)
QueryEngine->>Database: Query "my_traces" stream
Database-->>QueryEngine: Return results
QueryEngine-->>Dashboard: Return metrics data
Dashboard-->>User: Display RED metrics charts
3 files reviewed, no comments
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| 1 test failed | 185 | 167 | 1 | 15 | 2 | 90% | 23m 21s |
Test Failure Analysis
- alerts-import.spec.js: Visibility assertion failure due to multiple matching elements
- Alerts Import/Export Destination Import from URL and File: 'Successfully imported' resolved to 2 elements, causing strict mode violation.
Root Cause Analysis
- The recent changes in TraceDetails.vue may have affected the visibility of notification messages, leading to the test failure.
Recommended Actions
- Modify the test to specify a more unique text for visibility checks to avoid multiple matches.
- Review the notification rendering logic in TraceDetails.vue to ensure distinct messages are used for different import actions.
- Increase the timeout duration in the test to accommodate potential delays in rendering notifications.
042615c to
86bb9da
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 292 | 262 | 0 | 19 | 11 | 90% | 56m 5s |
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 335 | 0 | 19 | 10 | 92% | 5m 1s |
b3908b3 to
aea82de
Compare
|
| Status | Total | Passed | Failed | Skipped | Flaky | Pass Rate | Duration |
|---|---|---|---|---|---|---|---|
| All tests passed | 364 | 333 | 0 | 19 | 12 | 91% | 5m 0s |
PR Type
Bug fix, Enhancement
Description
Expand trace time window ±10s
Use selected stream in metrics
Unify metrics queries placeholders
Minor template formatting fixes
Diagram Walkthrough
File Walkthrough
TraceDetails.vue
Add time padding and tidy templateweb/src/plugins/traces/TraceDetails.vue
TracesMetricsDashboard.vue
Use selected stream in metrics queriesweb/src/plugins/traces/metrics/TracesMetricsDashboard.vue
metrics.json
Unify metrics SQL and field mappingsweb/src/plugins/traces/metrics/metrics.json