Skip to content

Commit ec71bca

Browse files
authoredMar 19, 2025··
Merge pull request #1667 from kaleido-io/metrics-config-fix
Make new monitoring config to be disabled by default
2 parents 88a4c15 + ab2a544 commit ec71bca

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed
 

‎doc-site/docs/reference/config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ title: Configuration Reference
450450
|Key|Description|Type|Default Value|
451451
|---|-----------|----|-------------|
452452
|address|The IP address on which the metrics HTTP API should listen|`int`|`127.0.0.1`
453-
|enabled|Enables the metrics API|`boolean`|`true`
453+
|enabled|Enables the metrics API|`boolean`|`false`
454454
|metricsPath|The path from which to serve the Prometheus metrics|`string`|`/metrics`
455455
|port|The port on which the metrics HTTP API should listen|`int`|`6000`
456456
|publicURL|The fully qualified public URL for the metrics API. This is used for building URLs in HTTP responses and in OpenAPI Spec generation|URL `string`|`<nil>`

‎internal/apiserver/metrics_server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ func initDeprecatedMetricsConfig(config config.Section) {
3232
}
3333

3434
func initMonitoringConfig(config config.Section) {
35-
config.AddKnownKey(Enabled, true)
35+
config.AddKnownKey(Enabled, false)
3636
config.AddKnownKey(MetricsPath, "/metrics")
3737
}

‎internal/apiserver/server.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,18 @@ func (as *apiServer) Serve(ctx context.Context, mgr namespace.Manager) (err erro
115115
} else if config.GetBool(coreconfig.LegacyAdminEnabled) {
116116
log.L(ctx).Warnf("Your config includes an 'admin' section, which should be renamed to 'spi' - SPI server will not be enabled until this is corrected")
117117
}
118-
serverName := "metrics"
119-
mConfig := deprecatedMetricsConfig
120-
if as.monitoringEnabled {
121-
serverName = "monitoring"
122-
mConfig = monitoringConfig
123-
}
124-
125118
if as.deprecatedMetricsEnabled || as.monitoringEnabled {
126-
monitoringServer, err := httpserver.NewHTTPServer(ctx, serverName, as.createMonitoringMuxRouter(), metricsErrChan, mConfig, corsConfig, &httpserver.ServerOptions{
127-
MaximumRequestTimeout: as.apiMaxTimeout,
128-
})
119+
var monitoringServer httpserver.HTTPServer
120+
var err error
121+
if as.monitoringEnabled {
122+
monitoringServer, err = httpserver.NewHTTPServer(ctx, "monitoring", as.createMonitoringMuxRouter(), metricsErrChan, monitoringConfig, corsConfig, &httpserver.ServerOptions{
123+
MaximumRequestTimeout: as.apiMaxTimeout,
124+
})
125+
} else {
126+
monitoringServer, err = httpserver.NewHTTPServer(ctx, "metrics", as.createMonitoringMuxRouter(), metricsErrChan, deprecatedMetricsConfig, corsConfig, &httpserver.ServerOptions{
127+
MaximumRequestTimeout: as.apiMaxTimeout,
128+
})
129+
}
129130
if err != nil {
130131
return err
131132
}

0 commit comments

Comments
 (0)
Please sign in to comment.