Skip to content

Commit 7f109d9

Browse files
mergify[bot]dependabot[bot]rubenruizdegauna
authored
[9.0](backport #5700) build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.13.2 to 0.13.3 (#5702)
* build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.13.2 to 0.13.3 (#5700) * build(deps): bump github.com/elastic/elastic-agent-system-metrics Bumps [github.com/elastic/elastic-agent-system-metrics](https://github.com/elastic/elastic-agent-system-metrics) from 0.13.2 to 0.13.3. - [Release notes](https://github.com/elastic/elastic-agent-system-metrics/releases) - [Commits](elastic/elastic-agent-system-metrics@v0.13.2...v0.13.3) --- updated-dependencies: - dependency-name: github.com/elastic/elastic-agent-system-metrics dependency-version: 0.13.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Post dependabot file modifications --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com> (cherry picked from commit 690544e) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum * fix conflicts * fix deprecated SetupMetricsOptions --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ruben Ruiz de Gauna <[email protected]>
1 parent d09044c commit 7f109d9

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

NOTICE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,11 +872,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l
872872

873873
--------------------------------------------------------------------------------
874874
Dependency : github.com/elastic/elastic-agent-system-metrics
875-
Version: v0.11.15
875+
Version: v0.13.3
876876
Licence type (autodetected): Apache-2.0
877877
--------------------------------------------------------------------------------
878878

879-
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.11.15/LICENSE.txt:
879+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.13.3/LICENSE.txt:
880880

881881
Apache License
882882
Version 2.0, January 2004

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/docker/go-units v0.5.0
1010
github.com/elastic/elastic-agent-client/v7 v7.17.2
1111
github.com/elastic/elastic-agent-libs v0.24.1
12-
github.com/elastic/elastic-agent-system-metrics v0.11.15
12+
github.com/elastic/elastic-agent-system-metrics v0.13.3
1313
github.com/elastic/go-elasticsearch/v8 v8.18.1
1414
github.com/elastic/go-ucfg v0.8.8
1515
github.com/fxamacker/cbor/v2 v2.8.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ github.com/elastic/elastic-agent-client/v7 v7.17.2 h1:Cl2TeABqWZgW40t5fchGWT/sRk
3737
github.com/elastic/elastic-agent-client/v7 v7.17.2/go.mod h1:5irRFqp6HLqtu1S+OeY0jg8x7K6PLL+DW+PwVk1vJnk=
3838
github.com/elastic/elastic-agent-libs v0.24.1 h1:kFPpOG5mbdaGRRNXPb2KfEaR65Uoi8nsMbDOKA02/Go=
3939
github.com/elastic/elastic-agent-libs v0.24.1/go.mod h1:o/iXtbHYaojpG4BOY7Z3hFMQAgEoqq2owO17JPGpf3A=
40-
github.com/elastic/elastic-agent-system-metrics v0.11.15 h1:RWX0n6LakadsqB6YB2I7AIXyMlEO4qBUGWn4A+aGeKA=
41-
github.com/elastic/elastic-agent-system-metrics v0.11.15/go.mod h1:qiZC5p1hd8te4XVnhh7FkXdcYhxFnl5i9GJpROtf6zo=
40+
github.com/elastic/elastic-agent-system-metrics v0.13.3 h1:VlY3Ezuwi5bPZRsAM97WaJEW78XkXgqmPHcTl1WGMRw=
41+
github.com/elastic/elastic-agent-system-metrics v0.13.3/go.mod h1:lB8veYWYBlA9eF6TahmPN87G1IEgWlbep7QSqLSW90U=
4242
github.com/elastic/elastic-transport-go/v8 v8.7.0 h1:OgTneVuXP2uip4BA658Xi6Hfw+PeIOod2rY3GVMGoVE=
4343
github.com/elastic/elastic-transport-go/v8 v8.7.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk=
4444
github.com/elastic/go-elasticsearch/v8 v8.18.1 h1:lPsN2Wk6+QqBeD4ckmOax7G/Y8tAZgroDYG8j6/5Ce0=

internal/pkg/api/metrics.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ var (
5555
// metrics must be explicitly exposed with a call to InitMetrics
5656
// FIXME we have global metrics but an internal and external API; this may lead to some confusion.
5757
func init() {
58-
err := report.SetupMetrics(logger.NewZapStub("instance-metrics"), build.ServiceName, version.DefaultVersion)
59-
if err != nil {
60-
zerolog.Ctx(context.TODO()).Error().Err(err).Msg("unable to initialize metrics") // TODO is used because this may logged during the package load
61-
}
6258

6359
registry = newMetricsRegistry("http_server")
6460
cntHTTPNew = newCounter(registry, "tcp_open")
@@ -78,6 +74,17 @@ func init() {
7874
cntFileDeliv.Register(routesRegistry.newRegistry("deliverFile"))
7975
cntGetPGP.Register(routesRegistry.newRegistry("getPGPKey"))
8076
cntAuditUnenroll.Register(routesRegistry.newRegistry("auditUnenroll"))
77+
78+
err := report.SetupMetricsOptions(report.MetricOptions{
79+
Logger: logger.NewZapStub("instance-metrics"),
80+
Name: build.ServiceName,
81+
Version: version.DefaultVersion,
82+
SystemMetrics: monitoring.NewRegistry(),
83+
ProcessMetrics: registry.registry,
84+
})
85+
if err != nil {
86+
zerolog.Ctx(context.TODO()).Error().Err(err).Msg("unable to initialize metrics") // TODO is used because this may logged during the package load
87+
}
8188
}
8289

8390
// metricsRegistry wraps libbeat and prometheus registries
@@ -91,7 +98,7 @@ func newMetricsRegistry(name string) *metricsRegistry {
9198
reg := monitoring.Default
9299
return &metricsRegistry{
93100
fullName: name,
94-
registry: reg.NewRegistry(name),
101+
registry: reg.GetOrCreateRegistry(name),
95102
promReg: prometheus.NewRegistry(),
96103
}
97104
}
@@ -103,7 +110,7 @@ func (r *metricsRegistry) newRegistry(name string) *metricsRegistry {
103110
}
104111
return &metricsRegistry{
105112
fullName: fullName,
106-
registry: r.registry.NewRegistry(name),
113+
registry: r.registry.GetOrCreateRegistry(name),
107114
promReg: r.promReg,
108115
}
109116
}

0 commit comments

Comments
 (0)