Skip to content
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

chore: add sourceCategory label to event_delivery_time metric #4569

Merged
13 changes: 7 additions & 6 deletions router/batchrouter/handle_observability.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ func (w *worker) workLoop() {
UserID: userID,
JobID: job.JobID,
SourceID: parameters.SourceID,
SourceCategory: parameters.SourceCategory,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are using similar logic to populate sourceCategory for reporting

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
Loading