Skip to content

Commit 94bf57d

Browse files
Merge branch 'development' into redis-pubsub
2 parents 845befc + d40f92a commit 94bf57d

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

pkg/gofr/datasource/opentsdb/observability.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ func sendOperationStats(
4545
status, message *string,
4646
span trace.Span,
4747
) {
48-
duration := time.Since(start).Microseconds()
48+
duration := time.Since(start)
4949

5050
logger.Debug(&QueryLog{
5151
Operation: operation,
5252
Status: status,
53-
Duration: duration,
53+
Duration: duration.Microseconds(),
5454
Message: message,
5555
})
5656

5757
if span != nil {
58-
span.SetAttributes(attribute.Int64(fmt.Sprintf("opentsdb.%v.duration", operation), duration))
58+
span.SetAttributes(attribute.Int64(fmt.Sprintf("opentsdb.%v.duration", operation), duration.Microseconds()))
5959
span.End()
6060
}
6161

@@ -74,7 +74,7 @@ func sendOperationStats(
7474
labels = append(labels, "host", host)
7575
}
7676

77-
metrics.RecordHistogram(ctx, opentsdbOperationDurationName, float64(duration), labels...)
77+
metrics.RecordHistogram(ctx, opentsdbOperationDurationName, float64(duration.Milliseconds()), labels...)
7878
metrics.IncrementCounter(ctx, opentsdbOperationTotalName, labels...)
7979
}
8080
}

pkg/gofr/datasource/opentsdb/opentsdb.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const (
5555
// and 'tsd.http.request.max_chunk = 40960' are all in the opentsdb.conf.
5656
defaultMaxContentLength = 40960
5757

58-
opentsdbOperationDurationName = "app_opentsdb_operation_duration_us"
58+
opentsdbOperationDurationName = "app_opentsdb_operation_duration"
5959
opentsdbOperationTotalName = "app_opentsdb_operation_total"
6060
)
6161

@@ -138,21 +138,21 @@ func (c *Client) registerMetrics() {
138138
}
139139

140140
durationBuckets := []float64{
141-
1000, // 1 ms
142-
5000, // 5 ms
143-
10000, // 10 ms
144-
50000, // 50 ms
145-
100000, // 100 ms
146-
250000, // 250 ms
147-
500000, // 500 ms
148-
1000000, // 1 s
149-
2000000, // 2 s
150-
5000000, // 5 s
141+
1, // 1 ms
142+
5, // 5 ms
143+
10, // 10 ms
144+
50, // 50 ms
145+
100, // 100 ms
146+
250, // 250 ms
147+
500, // 500 ms
148+
1000, // 1 s
149+
2000, // 2 s
150+
5000, // 5 s
151151
}
152152

153153
c.metrics.NewHistogram(
154154
opentsdbOperationDurationName,
155-
"Duration of OpenTSDB operations in microseconds.",
155+
"Duration of OpenTSDB operations in milliseconds.",
156156
durationBuckets...,
157157
)
158158

0 commit comments

Comments
 (0)