diff --git a/go.mod b/go.mod index 3437b5e..a1ee430 100644 --- a/go.mod +++ b/go.mod @@ -33,6 +33,7 @@ require ( github.com/streadway/amqp v1.1.0 github.com/stretchr/testify v1.8.4 github.com/tidwall/gjson v1.16.0 + github.com/ugorji/go v1.2.7 // indirect github.com/urfave/cli/v2 v2.25.7 github.com/zserge/lorca v0.1.10 go.mongodb.org/mongo-driver v1.12.1 diff --git a/go.sum b/go.sum index e3f2c6a..eef0ad9 100644 --- a/go.sum +++ b/go.sum @@ -1567,9 +1567,11 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= diff --git a/lib/prometheus/prometheus.go b/lib/prometheus/prometheus.go index 2234e84..f07e789 100644 --- a/lib/prometheus/prometheus.go +++ b/lib/prometheus/prometheus.go @@ -122,6 +122,7 @@ type PrometheusPushGateway struct { // NewPrometheus generates a new set of metrics with a certain subsystem name func NewPrometheus(subsystem string, customMetricsList ...[]*Metric) *Prometheus { + subsystem = "app" var metricsList []*Metric diff --git a/utils/metadata.go b/utils/metadata.go index b6232b9..5884baf 100644 --- a/utils/metadata.go +++ b/utils/metadata.go @@ -8,7 +8,7 @@ import ( func GetMetaData(ctx context.Context, key string) string { if md, b := metadata.FromIncomingContext(ctx); b { - vals := md[key] + vals := md.Get(key) if len(vals) > 0 { return vals[0] } @@ -21,7 +21,7 @@ func SetMetaData(ctx context.Context, key string, val string) context.Context { if !b { md = metadata.MD{} } - md[key] = []string{val} + md.Set(key, val) return metadata.NewIncomingContext(ctx, md) } @@ -31,7 +31,7 @@ func SetMetaDataMulti(ctx context.Context, kvs map[string]string) context.Contex md = metadata.MD{} } for k, v := range kvs { - md[k] = []string{v} + md.Set(k, v) } return metadata.NewIncomingContext(ctx, md) } @@ -43,7 +43,7 @@ func GetMetaDataMulti(ctx context.Context, keys []string) map[string]string { } res := make(map[string]string) for _, k := range keys { - vals := md[k] + vals := md.Get(k) if len(vals) > 0 { res[k] = vals[0] } else {