diff --git a/NOTICE-fips.txt b/NOTICE-fips.txt index 3a530e6e7..52ef1c813 100644 --- a/NOTICE-fips.txt +++ b/NOTICE-fips.txt @@ -872,11 +872,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l -------------------------------------------------------------------------------- Dependency : github.com/elastic/elastic-agent-system-metrics -Version: v0.11.18 +Version: v0.13.2 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.11.18/LICENSE.txt: +Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.13.2/LICENSE.txt: Apache License Version 2.0, January 2004 diff --git a/NOTICE.txt b/NOTICE.txt index 3b11fb1dc..9930deaeb 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -872,11 +872,11 @@ Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-l -------------------------------------------------------------------------------- Dependency : github.com/elastic/elastic-agent-system-metrics -Version: v0.11.18 +Version: v0.13.2 Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.11.18/LICENSE.txt: +Contents of probable licence file $GOMODCACHE/github.com/elastic/elastic-agent-system-metrics@v0.13.2/LICENSE.txt: Apache License Version 2.0, January 2004 diff --git a/go.mod b/go.mod index 42d81ff51..16ff6fa70 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/docker/go-units v0.5.0 github.com/elastic/elastic-agent-client/v7 v7.17.2 github.com/elastic/elastic-agent-libs v0.24.0 - github.com/elastic/elastic-agent-system-metrics v0.11.18 + github.com/elastic/elastic-agent-system-metrics v0.13.2 github.com/elastic/go-elasticsearch/v8 v8.19.0 github.com/elastic/go-ucfg v0.8.8 github.com/fxamacker/cbor/v2 v2.9.0 diff --git a/go.sum b/go.sum index ffaec3530..d7d23ac11 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +37,8 @@ github.com/elastic/elastic-agent-client/v7 v7.17.2 h1:Cl2TeABqWZgW40t5fchGWT/sRk github.com/elastic/elastic-agent-client/v7 v7.17.2/go.mod h1:5irRFqp6HLqtu1S+OeY0jg8x7K6PLL+DW+PwVk1vJnk= github.com/elastic/elastic-agent-libs v0.24.0 h1:8skd0le8Y/zAGVaj4m44ljiJMAp0xuJz07ngDTL/1kM= github.com/elastic/elastic-agent-libs v0.24.0/go.mod h1:xSeIP3NtOIT4N2pPS4EyURmS1Q8mK0lWZ8Wd1Du6q3w= -github.com/elastic/elastic-agent-system-metrics v0.11.18 h1:MuFLvHc3kQN/59+3KmRWhOUoXkL5PDzxEbdYbARGexA= -github.com/elastic/elastic-agent-system-metrics v0.11.18/go.mod h1:qiZC5p1hd8te4XVnhh7FkXdcYhxFnl5i9GJpROtf6zo= +github.com/elastic/elastic-agent-system-metrics v0.13.2 h1:R4ogKHESuWhWTtopnw/aHnBxxSZbxd7KHV4GefdwT2M= +github.com/elastic/elastic-agent-system-metrics v0.13.2/go.mod h1:ezM1kzDUT+vWXFh5oK8QXB/AEB0UoLWqWA8rkRicFFo= github.com/elastic/elastic-transport-go/v8 v8.7.0 h1:OgTneVuXP2uip4BA658Xi6Hfw+PeIOod2rY3GVMGoVE= github.com/elastic/elastic-transport-go/v8 v8.7.0/go.mod h1:YLHer5cj0csTzNFXoNQ8qhtGY1GTvSqPnKWKaqQE3Hk= github.com/elastic/go-elasticsearch/v8 v8.19.0 h1:VmfBLNRORY7RZL+9hTxBD97ehl9H8Nxf2QigDh6HuMU= diff --git a/internal/pkg/api/metrics.go b/internal/pkg/api/metrics.go index d8fc091ce..1f3fb3799 100644 --- a/internal/pkg/api/metrics.go +++ b/internal/pkg/api/metrics.go @@ -74,7 +74,13 @@ func init() { cntGetPGP.Register(routesRegistry.newRegistry("getPGPKey")) cntAuditUnenroll.Register(routesRegistry.newRegistry("auditUnenroll")) - err := report.SetupMetrics(zap.NewStub("instance-metrics"), build.ServiceName, version.DefaultVersion, monitoring.NewRegistry(), registry.registry) + err := report.SetupMetricsOptions(report.MetricOptions{ + Logger: zap.NewStub("instance-metrics"), + Name: build.ServiceName, + Version: version.DefaultVersion, + SystemMetrics: monitoring.NewRegistry(), + ProcessMetrics: registry.registry, + }) if err != nil { zerolog.Ctx(context.TODO()).Error().Err(err).Msg("unable to initialize metrics") // TODO is used because this may logged during the package load } @@ -91,7 +97,7 @@ func newMetricsRegistry(name string) *metricsRegistry { reg := monitoring.Default return &metricsRegistry{ fullName: name, - registry: reg.NewRegistry(name), + registry: reg.GetOrCreateRegistry(name), promReg: prometheus.NewRegistry(), } } @@ -103,7 +109,7 @@ func (r *metricsRegistry) newRegistry(name string) *metricsRegistry { } return &metricsRegistry{ fullName: fullName, - registry: r.registry.NewRegistry(name), + registry: r.registry.GetOrCreateRegistry(name), promReg: r.promReg, } }