Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2020-07-17 14:21:59 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2020-07-17 15:21:43 +0300
commit671c8b83b1299a7061382a2acfdd506ff72063fc (patch)
tree91c94fff2ea592d8434c4f6e04fd382d2a47d068
parent3e87bd7e64b38949788b9d8140845c471630da01 (diff)
praefect: Wire up subtransactions histogram metric
Wire up the new subtransactions histogram metric for the transaction manager.
-rw-r--r--changelogs/unreleased/pks-subtransactions-metric.yml5
-rw-r--r--cmd/praefect/main.go6
-rw-r--r--internal/praefect/metrics/prometheus.go13
3 files changed, 24 insertions, 0 deletions
diff --git a/changelogs/unreleased/pks-subtransactions-metric.yml b/changelogs/unreleased/pks-subtransactions-metric.yml
new file mode 100644
index 000000000..c18939665
--- /dev/null
+++ b/changelogs/unreleased/pks-subtransactions-metric.yml
@@ -0,0 +1,5 @@
+---
+title: Add subtransactions histogram metric
+merge_request: 2390
+author:
+type: added
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index efd65e91d..1553c9c33 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -248,9 +248,15 @@ func run(cfgs []starter.Config, conf config.Config) error {
return err
}
+ subtransactionsHistogram, err := metrics.RegisterSubtransactionsHistogram()
+ if err != nil {
+ return err
+ }
+
transactionManager := transactions.NewManager(
transactions.WithCounterMetric(transactionCounterMetric),
transactions.WithDelayMetric(transactionDelayMetric),
+ transactions.WithSubtransactionsMetric(subtransactionsHistogram),
)
var (
diff --git a/internal/praefect/metrics/prometheus.go b/internal/praefect/metrics/prometheus.go
index d552d5f4d..bfff90eef 100644
--- a/internal/praefect/metrics/prometheus.go
+++ b/internal/praefect/metrics/prometheus.go
@@ -82,6 +82,19 @@ func RegisterTransactionDelay(conf promconfig.Config) (metrics.HistogramVec, err
return transactionDelay, prometheus.Register(transactionDelay)
}
+// RegisterSubtransactionsHistogram creates and registers a Prometheus counter to
+// gauge the number of subtransactions per transaction.
+func RegisterSubtransactionsHistogram() (metrics.Histogram, error) {
+ subtransactionsHistogram := prometheus.NewHistogram(
+ prometheus.HistogramOpts{
+ Namespace: "gitaly",
+ Subsystem: "praefect",
+ Name: "subtransactions_per_transaction_total",
+ },
+ )
+ return subtransactionsHistogram, prometheus.Register(subtransactionsHistogram)
+}
+
var MethodTypeCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "gitaly",