Skip to content

Commit

Permalink
chore: add sourceCategory label to event_delivery_time metric (#4569)
Browse files Browse the repository at this point in the history
  • Loading branch information
satishrudderstack committed Apr 15, 2024
1 parent c41ae57 commit 1a5da41
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
13 changes: 7 additions & 6 deletions router/batchrouter/handle_observability.go
Expand Up @@ -188,12 +188,13 @@ func (brt *Handle) recordUploadStats(destination Connection, output UploadResult

if receivedTime, err := time.Parse(misc.RFC3339Milli, output.FirstEventAt); err == nil {
eventDeliveryTimeStat := stats.Default.NewTaggedStat("event_delivery_time", stats.TimerType, map[string]string{
"module": "batch_router",
"destType": brt.destType,
"destination": destinationTag,
"workspaceId": destination.Source.WorkspaceID,
"sourceId": destination.Source.ID,
"destinationId": destination.Destination.ID,
"module": "batch_router",
"destType": brt.destType,
"destination": destinationTag,
"workspaceId": destination.Source.WorkspaceID,
"sourceId": destination.Source.ID,
"destinationId": destination.Destination.ID,
"sourceCategory": destination.Source.SourceDefinition.Category,
})
eventDeliveryTimeStat.SendTiming(time.Since(receivedTime))
}
Expand Down
1 change: 1 addition & 0 deletions router/types/types.go
Expand Up @@ -65,6 +65,7 @@ type JobMetadataT struct {
UserID string `json:"userId"`
JobID int64 `json:"jobId"`
SourceID string `json:"sourceId"`
SourceCategory string `json:"sourceCategory"`
DestinationID string `json:"destinationId"`
AttemptNum int `json:"attemptNum"`
ReceivedAt string `json:"receivedAt"`
Expand Down
14 changes: 8 additions & 6 deletions router/worker.go
Expand Up @@ -166,6 +166,7 @@ func (w *worker) workLoop() {
UserID: userID,
JobID: job.JobID,
SourceID: parameters.SourceID,
SourceCategory: parameters.SourceCategory,
DestinationID: parameters.DestinationID,
AttemptNum: job.LastJobStatus.AttemptNum,
ReceivedAt: parameters.ReceivedAt,
Expand Down Expand Up @@ -1065,12 +1066,13 @@ func (w *worker) sendEventDeliveryStat(destinationJobMetadata *types.JobMetadata
if err == nil {
eventsDeliveryTimeStat := stats.Default.NewTaggedStat(
"event_delivery_time", stats.TimerType, map[string]string{
"module": "router",
"destType": w.rt.destType,
"destID": destination.ID,
"destination": destinationTag,
"workspaceId": status.WorkspaceId,
"sourceId": destinationJobMetadata.SourceID,
"module": "router",
"destType": w.rt.destType,
"destID": destination.ID,
"destination": destinationTag,
"workspaceId": status.WorkspaceId,
"sourceId": destinationJobMetadata.SourceID,
"sourceCategory": destinationJobMetadata.SourceCategory,
})

eventsDeliveryTimeStat.SendTiming(time.Since(receivedTime))
Expand Down

0 comments on commit 1a5da41

Please sign in to comment.