Skip to content

Commit f519db1

Browse files
authored
Fix suppressGoMetrics, rename it to suppressDefaultMetrics (#967)
Fixes #944
1 parent c73b7ad commit f519db1

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ A sample is the following:
876876
877877
```
878878
metricsSettings:
879-
suppressGoMetrics: true
879+
suppressDefaultMetrics: true
880880
prefix: flp_operational_
881881
port: 9102
882882
@@ -887,7 +887,7 @@ In addition, there are default metrics reported by `Go`, which are also directed
887887
The port to which these metrics are made available is specified in the `port` configuration parameter.
888888
If a `prefix` is specified, then the specified prefix is prepended to each of the operational metrics generated by FLP.
889889
A different `prefix` may be specified on an `encode prom` stage to be prepended to the prometheus metrics defined in that stage.
890-
The `suppressGoMetrics` parameter may be set to `true` in order to suppress the reporting of the `Go` and process metrics in the prometheus client interface.
890+
The `suppressDefaultMetrics` parameter may be set to `true` in order to suppress the reporting of the default Prometheus metrics, such as `Go` and process metrics.
891891
892892
# Development
893893

hack/examples/docker-ipfix-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
log-level: info
22
health:
33
port: 8080
4+
metricsSettings:
5+
suppressDefaultMetrics: true
6+
prefix: flp_
47
pipeline:
58
- name: ingest
69
- name: conntrack

pkg/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ type MetricsSettings struct {
7575
DisableGlobalServer bool `yaml:"disableGlobalServer,omitempty" json:"disableGlobalServer,omitempty" doc:"disabling the global metrics server makes operational metrics unavailable. If prometheus-encoding stages are defined, they need to contain their own metrics server parameters."`
7676
Prefix string `yaml:"prefix,omitempty" json:"prefix,omitempty" doc:"prefix for names of the operational metrics"`
7777
NoPanic bool `yaml:"noPanic,omitempty" json:"noPanic,omitempty"`
78-
SuppressGoMetrics bool `yaml:"suppressGoMetrics,omitempty" json:"suppressGoMetrics,omitempty" doc:"filter out Go and process metrics"`
78+
SuppressDefaultMetrics bool `yaml:"suppressDefaultMetrics,omitempty" json:"suppressDefaultMetrics,omitempty" doc:"filter out default Prometheus metrics such as Go and process metrics"`
7979
}
8080

8181
// PerfSettings allows setting some internal configuration parameters

pkg/prometheus/prom_server.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,12 @@ func InitializePrometheus(settings *config.MetricsSettings) *PromServer {
7373
return nil
7474
}
7575
r := prom.DefaultGatherer
76-
if settings.SuppressGoMetrics {
76+
if settings.SuppressDefaultMetrics {
7777
// set up private prometheus registry
78-
r = prom.NewRegistry()
78+
nr := prom.NewRegistry()
79+
prom.DefaultRegisterer = nr
80+
prom.DefaultGatherer = nr
81+
r = nr
7982
}
8083
SharedServer = StartServerAsync(&settings.PromConnectionInfo, "", r)
8184
return SharedServer

0 commit comments

Comments
 (0)