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:
authorJohn Cai <jcai@gitlab.com>2021-11-17 02:12:56 +0300
committerJohn Cai <jcai@gitlab.com>2021-11-17 02:21:07 +0300
commit041187c33e166e1e9b1e826f35ab278f9e1c1d03 (patch)
treee273b955f4593a122221e0e7266454b5ea2bc2cd
parent284a2395b24fcbf1614f486a190379bf42eac6a6 (diff)
Add config value MetatdataMonitoringEnabledjc-metadata-monitoring-flag
With multiple Praefect instances running, each one will hit the database for metrics. This causes unnecessary load on the database and in some cases, fatally so. To fix this, we will add a new config value so that we can control whicih Praefect serves as thei one that will monitor the database. Changelog: added
-rw-r--r--cmd/praefect/main.go2
-rw-r--r--internal/gitaly/config/prometheus/config.go2
2 files changed, 3 insertions, 1 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go
index e2210e659..40e45b370 100644
--- a/cmd/praefect/main.go
+++ b/cmd/praefect/main.go
@@ -390,7 +390,7 @@ func run(cfgs []starter.Config, conf config.Config, b bootstrap.Listener, promre
)
)
metricsCollectors = append(metricsCollectors, transactionManager, coordinator, repl)
- if db != nil {
+ if db != nil && conf.Prometheus.MonitorMetadata {
promreg.MustRegister(
datastore.NewRepositoryStoreCollector(logger, conf.VirtualStorageNames(), db, conf.Prometheus.ScrapeTimeout),
)
diff --git a/internal/gitaly/config/prometheus/config.go b/internal/gitaly/config/prometheus/config.go
index 629eca6a5..8649ab560 100644
--- a/internal/gitaly/config/prometheus/config.go
+++ b/internal/gitaly/config/prometheus/config.go
@@ -16,6 +16,8 @@ type Config struct {
// GRPCLatencyBuckets configures the histogram buckets used for gRPC
// latency measurements.
GRPCLatencyBuckets []float64 `toml:"grpc_latency_buckets"`
+ // MonitorMetadata when true, will register collectors that query the praefect database
+ MonitorMetadata bool `toml:"monitor_metadata"`
}
// DefaultConfig returns a new config with default values set.