Skip to content

Commit d2ec68d

Browse files
authored
feat(metrics): replace metrics port with address (breaking change) (#2382)
1 parent e826702 commit d2ec68d

File tree

23 files changed

+101
-100
lines changed

23 files changed

+101
-100
lines changed

Dockerfile.staging

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ RUN go get ./...
2323
RUN go build github.com/ChainSafe/gossamer/cmd/gossamer
2424

2525
RUN ["sh", "-c", "gossamer init --chain=${chain}"]
26-
ENTRYPOINT ["sh", "-c", "service datadog-agent restart && gossamer --chain=${chain} --basepath=${basepath}/${chain} --publish-metrics --pprofserver --pprofaddress=\":6060\""]
26+
ENTRYPOINT ["sh", "-c", "service datadog-agent restart && gossamer --chain=${chain} --basepath=${basepath}/${chain} --publish-metrics --metrics-address=\":9876\" --pprofserver --pprofaddress=\":6060\""]
2727
EXPOSE 7001 8546 8540 9876 6060

chain/dev/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[global]
22
basepath = "~/.gossamer/dev"
33
log = "info"
4-
metrics-port = 9876
4+
metrics-address = ":9876"
55

66
[log]
77
core = ""

chain/dev/defaults.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var (
2121
// DefaultBasePath is the node base directory path
2222
DefaultBasePath = string("~/.gossamer/dev")
2323

24-
// DefaultMetricsPort is the metrics server port
25-
DefaultMetricsPort = uint32(9876)
24+
// DefaultMetricsAddress is the default metrics server listening address.
25+
DefaultMetricsAddress = ":9876"
2626

2727
// DefaultLvl is the default log level
2828
DefaultLvl = log.Info

chain/gssmr/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[global]
22
basepath = "~/.gossamer/gssmr"
33
log = "info"
4-
metrics-port = 9876
4+
metrics-address = "localhost:9876"
55

66
[log]
77
core = ""

chain/gssmr/defaults.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ var (
2323
// DefaultBasePath Default node base directory path
2424
DefaultBasePath = string("~/.gossamer/gssmr")
2525

26-
// DefaultMetricsPort is the metrics server port
27-
DefaultMetricsPort = uint32(9876)
26+
// DefaultMetricsAddress is the default metrics server listening address.
27+
DefaultMetricsAddress = "localhost:9876"
2828

2929
// DefaultLvl is the default log level
3030
DefaultLvl = log.Info

chain/kusama/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[global]
22
basepath = "~/.gossamer/kusama"
33
log = "info"
4-
metrics-port = 9876
4+
metrics-address = "localhost:9876"
55

66
[log]
77
core = ""

chain/kusama/defaults.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var (
2121
// DefaultBasePath Default node base directory path
2222
DefaultBasePath = string("~/.gossamer/kusama")
2323

24-
// DefaultMetricsPort is the metrics server port
25-
DefaultMetricsPort = uint32(9876)
24+
// DefaultMetricsAddress is the default metrics server listening address.
25+
DefaultMetricsAddress = "localhost:9876"
2626

2727
// DefaultLvl is the default log level
2828
DefaultLvl = log.Info

chain/polkadot/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[global]
22
basepath = "~/.gossamer/polkadot"
33
log = "info"
4-
metrics-port = 9876
4+
metrics-address = "localhost:9876"
55

66
[log]
77
core = ""

cmd/gossamer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ defined in [lib/runtime/wasmer/exports.go](../../lib/runtime/wasmer/exports.go).
188188
Gossamer publishes telemetry data and also includes an embedded Prometheus server that reports metrics. The metrics
189189
capabilities are defined in the [dot/metrics](../../dot/metrics) package and build on
190190
[the metrics library that is included with Go Ethereum](https://github.com/ethereum/go-ethereum/blob/master/metrics/README.md).
191-
The default port for Prometheus metrics is 9090, and Gossamer allows the user to configure this parameter with the
192-
`--metrics-port` command-line parameter. The Gossamer telemetry server publishes telemetry data that is compatible with
191+
The default listening address for Prometheus metrics is `localhost:9090`, and Gossamer allows the user to configure this parameter with the
192+
`--metrics-address` command-line parameter. The Gossamer telemetry server publishes telemetry data that is compatible with
193193
[Polkadot Telemetry](https://github.com/paritytech/substrate-telemetry) and
194194
[its helpful UI](https://telemetry.polkadot.io/).

cmd/gossamer/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ func setDotGlobalConfigFromToml(tomlCfg *ctoml.Config, cfg *dot.GlobalConfig) {
458458
}
459459
}
460460

461-
cfg.MetricsPort = tomlCfg.Global.MetricsPort
461+
cfg.MetricsAddress = tomlCfg.Global.MetricsAddress
462462

463463
cfg.RetainBlocks = tomlCfg.Global.RetainBlocks
464464
cfg.Pruning = pruner.Mode(tomlCfg.Global.Pruning)
@@ -485,9 +485,9 @@ func setDotGlobalConfigFromFlags(ctx *cli.Context, cfg *dot.GlobalConfig) error
485485

486486
cfg.PublishMetrics = ctx.Bool("publish-metrics")
487487

488-
// check --metrics-port flag and update node configuration
489-
if metricsPort := ctx.GlobalUint(MetricsPortFlag.Name); metricsPort != 0 {
490-
cfg.MetricsPort = uint32(metricsPort)
488+
// check --metrics-address flag and update node configuration
489+
if metricsAddress := ctx.GlobalString(MetricsAddressFlag.Name); metricsAddress != "" {
490+
cfg.MetricsAddress = metricsAddress
491491
}
492492

493493
cfg.RetainBlocks = ctx.Int64(RetainBlockNumberFlag.Name)

0 commit comments

Comments
 (0)