From 8f5761ee1315f496f4182559746d0da1287333e6 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sun, 24 Jan 2021 09:16:23 -0700 Subject: [PATCH] Disable prometheus metrics by default The HTTP server should only be enabled if a user explicitly sets a port for it. --- README.md | 12 ++++++++++++ cmd/litestream/main.go | 9 +-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a6230e9..9c7847b 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,17 @@ dbs: - path: /path/to/replica ``` +### Monitoring replication + +You can also enable a Prometheus metrics endpoint to monitor replication by +specifying a bind address with the `addr` field: + +```yml +addr: ":9090" +``` + +This will make metrics available at: http://localhost:9090/metrics + ### Other configuration options @@ -119,6 +130,7 @@ These replica options are only available for S3 replicas: - `sync-interval`—Replication sync frequency. + ## Usage ### Replication diff --git a/cmd/litestream/main.go b/cmd/litestream/main.go index 469ba9e..c95c5f3 100644 --- a/cmd/litestream/main.go +++ b/cmd/litestream/main.go @@ -97,11 +97,6 @@ The commands are: `[1:]) } -// Default configuration settings. -const ( - DefaultAddr = ":9090" -) - // Config represents a configuration file for the litestream daemon. type Config struct { // Bind address for serving metrics. @@ -129,9 +124,7 @@ func (c *Config) Normalize() error { // DefaultConfig returns a new instance of Config with defaults set. func DefaultConfig() Config { - return Config{ - Addr: DefaultAddr, - } + return Config{} } // DBConfig returns database configuration by path.