feat: per-component transform latency on pipeline metrics page#95
Merged
TerrifiedBug merged 12 commits intomainfrom Mar 11, 2026
Merged
feat: per-component transform latency on pipeline metrics page#95TerrifiedBug merged 12 commits intomainfrom
TerrifiedBug merged 12 commits intomainfrom
Conversation
Contributor
Greptile SummaryThis PR adds per-component transform latency tracking to VectorFlow's pipeline metrics page. It extends Key points:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Agent as Vector Agent
participant HB as /api/agent/heartbeat
participant Ingest as ingestMetrics()
participant DB as PipelineMetric (DB)
participant tRPC as getComponentLatencyHistory
participant UI as Pipeline Metrics Page
Agent->>HB: POST heartbeat {pipelines, componentMetrics}
HB->>Ingest: fire-and-forget (counter deltas → nodeId rows + nodeId:null aggregate)
Note over HB: minuteTimestamp = now with seconds zeroed
loop per pipeline × per component
HB->>DB: findFirst(pipelineId, nodeId, componentId, timestamp)
alt row exists
HB->>DB: update latencyMeanMs
else
HB->>DB: create row {nodeId≠null, componentId≠null}
end
end
HB-->>Agent: 200 OK
UI->>tRPC: getComponentLatencyHistory(pipelineId, minutes)
tRPC->>DB: findMany(pipelineId, componentId≠null, timestamp≥since)
DB-->>tRPC: rows [{componentId, timestamp, latencyMeanMs}]
Note over tRPC: Average rows by (componentId, timestamp)<br/>to collapse multi-node deployments
tRPC-->>UI: {components: Record<id, [{timestamp, latencyMeanMs}]>}
UI->>UI: Render multi-line LineChart (one line per transform)
Last reviewed commit: 3691f2b |
- Add withTeamAccess("VIEWER") to getComponentLatencyHistory procedure
- Replace createMany with findFirst+upsert to deduplicate per-component
latency rows within the same minute bucket
Average per-component latency across nodes in getComponentLatencyHistory to handle multi-node pipeline deployments correctly
Await per-component latency upserts sequentially to eliminate TOCTOU race between concurrent heartbeat requests
prisma/migrations/20260311030000_add_component_id_to_pipeline_metric/migration.sql
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
componentIdcolumn toPipelineMetricto store per-component latency rows alongside aggregate rowscomponentId: nullfilter to all 13 existing aggregate queries across 5 files to prevent per-component rows from inflating metricscreateMany(separate from the delta-trackingingestMetricspipeline, since latency is a gauge)getComponentLatencyHistorytRPC procedure for historical per-component latency datacomponent_latency_mean_secondsfor transforms, not sources/sinks)Test plan
PipelineMetrictable/pipelines/[id]/metrics) shows multi-line transform latency chart with one line per component