Skip to content

Commit 1ccccd2

Browse files
mergify[bot]dependabot[bot]Kaan Yaltirubenruizdegauna
authored
[9.1](backport #5273) build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.11.18 to 0.12.0 (#5514)
* build(deps): bump github.com/elastic/elastic-agent-system-metrics from 0.11.18 to 0.12.0 (#5273) * 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.11.18 to 0.12.0. - [Release notes](https://github.com/elastic/elastic-agent-system-metrics/releases) - [Commits](elastic/elastic-agent-system-metrics@v0.11.18...v0.12.0) --- updated-dependencies: - dependency-name: github.com/elastic/elastic-agent-system-metrics dependency-version: 0.12.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Post dependabot file modifications * fix: resolve breaking API changes * fix: replace deprecated calls to NewRegistry with GetOrCreateRegistry --------- 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> Co-authored-by: Panos Koutsovasilis <[email protected]> (cherry picked from commit 898abd5) # Conflicts: # NOTICE-fips.txt # NOTICE.txt # go.mod # go.sum # internal/pkg/api/metrics.go * resolved conflicts * fix: resolve breaking API changes --------- Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kaan Yalti <[email protected]> Co-authored-by: Ruben Ruiz de Gauna <[email protected]>
1 parent 442d125 commit 1ccccd2

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

NOTICE-fips.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.16
875+
Version: v0.13.2
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.16/LICENSE.txt:
879+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.13.2/LICENSE.txt:
880880

881881
Apache License
882882
Version 2.0, January 2004

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.16
875+
Version: v0.13.2
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.16/LICENSE.txt:
879+
Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.13.2/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.0
12-
github.com/elastic/elastic-agent-system-metrics v0.11.16
12+
github.com/elastic/elastic-agent-system-metrics v0.13.2
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.0 h1:8skd0le8Y/zAGVaj4m44ljiJMAp0xuJz07ngDTL/1kM=
3939
github.com/elastic/elastic-agent-libs v0.24.0/go.mod h1:xSeIP3NtOIT4N2pPS4EyURmS1Q8mK0lWZ8Wd1Du6q3w=
40-
github.com/elastic/elastic-agent-system-metrics v0.11.16 h1:cLjuO8pE5cUwPGWUHmy1VOERmJVDaep8gY+U4YRQ5vs=
41-
github.com/elastic/elastic-agent-system-metrics v0.11.16/go.mod h1:qiZC5p1hd8te4XVnhh7FkXdcYhxFnl5i9GJpROtf6zo=
40+
github.com/elastic/elastic-agent-system-metrics v0.13.2 h1:R4ogKHESuWhWTtopnw/aHnBxxSZbxd7KHV4GefdwT2M=
41+
github.com/elastic/elastic-agent-system-metrics v0.13.2/go.mod h1:ezM1kzDUT+vWXFh5oK8QXB/AEB0UoLWqWA8rkRicFFo=
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: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"fmt"
1111
"sync"
1212

13+
"github.com/gofrs/uuid/v5"
1314
"github.com/prometheus/client_golang/prometheus"
1415
"github.com/prometheus/client_golang/prometheus/promhttp"
1516
"github.com/rs/zerolog"
@@ -55,7 +56,17 @@ var (
5556
// metrics must be explicitly exposed with a call to InitMetrics
5657
// FIXME we have global metrics but an internal and external API; this may lead to some confusion.
5758
func init() {
58-
err := report.SetupMetrics(logger.NewZapStub("instance-metrics"), build.ServiceName, version.DefaultVersion)
59+
// maintain original behaviour from deprecated report.SetupMetrics
60+
ephemeralID, _ := uuid.NewV4()
61+
err := report.SetupMetricsOptions(report.MetricOptions{
62+
Name: build.ServiceName,
63+
Version: version.DefaultVersion,
64+
EphemeralID: ephemeralID.String(),
65+
Logger: logger.NewZapStub("instance-metrics"),
66+
SystemMetrics: monitoring.Default.GetOrCreateRegistry("system"),
67+
ProcessMetrics: monitoring.Default.GetOrCreateRegistry("beat"),
68+
})
69+
5970
if err != nil {
6071
zerolog.Ctx(context.TODO()).Error().Err(err).Msg("unable to initialize metrics") // TODO is used because this may logged during the package load
6172
}
@@ -91,7 +102,7 @@ func newMetricsRegistry(name string) *metricsRegistry {
91102
reg := monitoring.Default
92103
return &metricsRegistry{
93104
fullName: name,
94-
registry: reg.NewRegistry(name),
105+
registry: reg.GetOrCreateRegistry(name),
95106
promReg: prometheus.NewRegistry(),
96107
}
97108
}
@@ -103,7 +114,7 @@ func (r *metricsRegistry) newRegistry(name string) *metricsRegistry {
103114
}
104115
return &metricsRegistry{
105116
fullName: fullName,
106-
registry: r.registry.NewRegistry(name),
117+
registry: r.registry.GetOrCreateRegistry(name),
107118
promReg: r.promReg,
108119
}
109120
}

0 commit comments

Comments
 (0)