From ec591e0b75bb654c18bff787dca7f9fd6440641b Mon Sep 17 00:00:00 2001 From: Arseny Neustroev Date: Tue, 2 Apr 2024 10:25:39 +0000 Subject: [PATCH] fix: add OTEL resource info to metrics --- example/README.md | 2 +- state/state.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/example/README.md b/example/README.md index 9d87f69..5346ab3 100644 --- a/example/README.md +++ b/example/README.md @@ -6,7 +6,7 @@ In the `docker_compose` folder there is the environment to run the observability ``` make image -cd docker-compose && make up +cd docker_compose && make up ``` ## Run local krakend instances and other services in docker compose diff --git a/state/state.go b/state/state.go index e3a5458..5d51748 100644 --- a/state/state.go +++ b/state/state.go @@ -83,6 +83,7 @@ func NewWithVersion(serviceName string, cfg *OTELStateConfig, version string, var meterProvider metric.MeterProvider = noopmetric.NewMeterProvider() var sdkMeterProvider *sdkmetric.MeterProvider if len(metricOpts) > 0 { + metricOpts = append(metricOpts, sdkmetric.WithResource(res)) sdkMeterProvider = sdkmetric.NewMeterProvider(metricOpts...) meterProvider = sdkMeterProvider }