Skip to content

Commit

Permalink
feat: improve duration usability
Browse files Browse the repository at this point in the history
  • Loading branch information
Iusupov Anton committed Aug 15, 2024
1 parent 67ebc1e commit 34fa496
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions metrics/series.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ func (s Series) Error(message string) (string, prometheus.Labels) {
return "operation_count", mergeLabels(labels, s.labels)
}

// Duration returns the metric name and labels for recording a duration.
func (s Series) Duration(d time.Duration) (string, prometheus.Labels, float64) {
// Duration returns the metric name and labels for recording a duration, where msg carries any additional information
func (s Series) Duration(d time.Duration, msg string) (string, prometheus.Labels, float64) {
labels := prometheus.Labels{
"series_type": s.seriesType.String(),
"sub_type": s.subType,
"operation": s.operation,
"status": seriesTypeDuration,
"message": "",
"message": msg,
}

return "operation_duration_seconds", mergeLabels(labels, s.labels), d.Seconds()
Expand Down

0 comments on commit 34fa496

Please sign in to comment.