forked from grafana/loki
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix panic when using cassandra in multiple periodic configs or as a s…
…tore for both index and delete requests (grafana#2774) * add purpose label to metric being used for tracing cassandra session and relevant tests Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> * update changelog Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> * passing registerer wrapped with purpose to index client factory functions Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> * add registerer for metrics in dynamodb clients Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> * changes suggested from PR review Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> * minor nit Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> * changes suggested from PR review Signed-off-by: Sandeep Sukhani <sandeep.d.sukhani@gmail.com> Co-authored-by: Marco Pracucci <marco@pracucci.com>
- Loading branch information
1 parent
b9064e4
commit 32b5a9b
Showing
12 changed files
with
194 additions
and
117 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package aws | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
"github.com/prometheus/client_golang/prometheus/promauto" | ||
"github.com/weaveworks/common/instrument" | ||
) | ||
|
||
type dynamoDBMetrics struct { | ||
dynamoRequestDuration *instrument.HistogramCollector | ||
dynamoConsumedCapacity *prometheus.CounterVec | ||
dynamoThrottled *prometheus.CounterVec | ||
dynamoFailures *prometheus.CounterVec | ||
dynamoDroppedRequests *prometheus.CounterVec | ||
dynamoQueryPagesCount prometheus.Histogram | ||
} | ||
|
||
func newMetrics(r prometheus.Registerer) *dynamoDBMetrics { | ||
m := dynamoDBMetrics{} | ||
|
||
m.dynamoRequestDuration = instrument.NewHistogramCollector(promauto.With(r).NewHistogramVec(prometheus.HistogramOpts{ | ||
Namespace: "cortex", | ||
Name: "dynamo_request_duration_seconds", | ||
Help: "Time spent doing DynamoDB requests.", | ||
|
||
// DynamoDB latency seems to range from a few ms to a several seconds and is | ||
// important. So use 9 buckets from 1ms to just over 1 minute (65s). | ||
Buckets: prometheus.ExponentialBuckets(0.001, 4, 9), | ||
}, []string{"operation", "status_code"})) | ||
m.dynamoConsumedCapacity = promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "cortex", | ||
Name: "dynamo_consumed_capacity_total", | ||
Help: "The capacity units consumed by operation.", | ||
}, []string{"operation", tableNameLabel}) | ||
m.dynamoThrottled = promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "cortex", | ||
Name: "dynamo_throttled_total", | ||
Help: "The total number of throttled events.", | ||
}, []string{"operation", tableNameLabel}) | ||
m.dynamoFailures = promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "cortex", | ||
Name: "dynamo_failures_total", | ||
Help: "The total number of errors while storing chunks to the chunk store.", | ||
}, []string{tableNameLabel, errorReasonLabel, "operation"}) | ||
m.dynamoDroppedRequests = promauto.With(r).NewCounterVec(prometheus.CounterOpts{ | ||
Namespace: "cortex", | ||
Name: "dynamo_dropped_requests_total", | ||
Help: "The total number of requests which were dropped due to errors encountered from dynamo.", | ||
}, []string{tableNameLabel, errorReasonLabel, "operation"}) | ||
m.dynamoQueryPagesCount = promauto.With(r).NewHistogram(prometheus.HistogramOpts{ | ||
Namespace: "cortex", | ||
Name: "dynamo_query_pages_count", | ||
Help: "Number of pages per query.", | ||
// Most queries will have one page, however this may increase with fuzzy | ||
// metric names. | ||
Buckets: prometheus.ExponentialBuckets(1, 4, 6), | ||
}) | ||
|
||
return &m | ||
} |
This file contains 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
Oops, something went wrong.