From 8a3e7097a09bb4f1b62c0606c2aafe2b11fda4a9 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Thu, 10 Mar 2022 18:17:46 +0000 Subject: [PATCH 01/10] net/http --- instrumentation/net/http/otelhttp/config.go | 2 +- instrumentation/net/http/otelhttp/go.mod | 6 ++-- instrumentation/net/http/otelhttp/go.sum | 20 +++++------ instrumentation/net/http/otelhttp/handler.go | 16 +++++---- instrumentation/net/http/otelhttp/test/go.mod | 9 ++--- instrumentation/net/http/otelhttp/test/go.sum | 27 +++++++------- .../net/http/otelhttp/test/handler_test.go | 36 ++++++++++--------- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/instrumentation/net/http/otelhttp/config.go b/instrumentation/net/http/otelhttp/config.go index 0c18c111048..46d5c1b6379 100644 --- a/instrumentation/net/http/otelhttp/config.go +++ b/instrumentation/net/http/otelhttp/config.go @@ -62,7 +62,7 @@ func (o optionFunc) apply(c *config) { func newConfig(opts ...Option) *config { c := &config{ Propagators: otel.GetTextMapPropagator(), - MeterProvider: global.GetMeterProvider(), + MeterProvider: global.MeterProvider(), } for _, opt := range opts { opt.apply(c) diff --git a/instrumentation/net/http/otelhttp/go.mod b/instrumentation/net/http/otelhttp/go.mod index 3427c7c36ff..572894de050 100644 --- a/instrumentation/net/http/otelhttp/go.mod +++ b/instrumentation/net/http/otelhttp/go.mod @@ -7,7 +7,7 @@ replace go.opentelemetry.io/contrib => ../../../.. require ( github.com/felixge/httpsnoop v1.0.2 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/net/http/otelhttp/go.sum b/instrumentation/net/http/otelhttp/go.sum index 15609e48138..5953526f39f 100644 --- a/instrumentation/net/http/otelhttp/go.sum +++ b/instrumentation/net/http/otelhttp/go.sum @@ -2,8 +2,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -11,19 +12,14 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/instrumentation/net/http/otelhttp/handler.go b/instrumentation/net/http/otelhttp/handler.go index dbba925dfa5..2f26ae8597c 100644 --- a/instrumentation/net/http/otelhttp/handler.go +++ b/instrumentation/net/http/otelhttp/handler.go @@ -24,6 +24,8 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument/syncfloat64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/propagation" semconv "go.opentelemetry.io/otel/semconv/v1.7.0" "go.opentelemetry.io/otel/trace" @@ -47,8 +49,8 @@ type Handler struct { writeEvent bool filters []Filter spanNameFormatter func(string, *http.Request) string - counters map[string]metric.Int64Counter - valueRecorders map[string]metric.Float64Histogram + counters map[string]syncint64.Counter + valueRecorders map[string]syncfloat64.Histogram } func defaultHandlerFormatter(operation string, _ *http.Request) string { @@ -93,16 +95,16 @@ func handleErr(err error) { } func (h *Handler) createMeasures() { - h.counters = make(map[string]metric.Int64Counter) - h.valueRecorders = make(map[string]metric.Float64Histogram) + h.counters = make(map[string]syncint64.Counter) + h.valueRecorders = make(map[string]syncfloat64.Histogram) - requestBytesCounter, err := h.meter.NewInt64Counter(RequestContentLength) + requestBytesCounter, err := h.meter.SyncInt64().Counter(RequestContentLength) handleErr(err) - responseBytesCounter, err := h.meter.NewInt64Counter(ResponseContentLength) + responseBytesCounter, err := h.meter.SyncInt64().Counter(ResponseContentLength) handleErr(err) - serverLatencyMeasure, err := h.meter.NewFloat64Histogram(ServerLatency) + serverLatencyMeasure, err := h.meter.SyncFloat64().Histogram(ServerLatency) handleErr(err) h.counters[RequestContentLength] = requestBytesCounter diff --git a/instrumentation/net/http/otelhttp/test/go.mod b/instrumentation/net/http/otelhttp/test/go.mod index 461fb9a5d21..8f95ee75f00 100644 --- a/instrumentation/net/http/otelhttp/test/go.mod +++ b/instrumentation/net/http/otelhttp/test/go.mod @@ -5,10 +5,11 @@ go 1.16 require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace ( diff --git a/instrumentation/net/http/otelhttp/test/go.sum b/instrumentation/net/http/otelhttp/test/go.sum index 2fca63edc59..c3aa1140861 100644 --- a/instrumentation/net/http/otelhttp/test/go.sum +++ b/instrumentation/net/http/otelhttp/test/go.sum @@ -1,9 +1,11 @@ +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -11,21 +13,18 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= -go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= +go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/instrumentation/net/http/otelhttp/test/handler_test.go b/instrumentation/net/http/otelhttp/test/handler_test.go index e0a6e968e95..270dbf2f13f 100644 --- a/instrumentation/net/http/otelhttp/test/handler_test.go +++ b/instrumentation/net/http/otelhttp/test/handler_test.go @@ -16,7 +16,6 @@ package test import ( "context" - "fmt" "io" "io/ioutil" "net/http" @@ -29,11 +28,11 @@ import ( "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/metrictest" + "go.opentelemetry.io/otel/metric/nonrecording" "go.opentelemetry.io/otel/propagation" + "go.opentelemetry.io/otel/sdk/metric/metrictest" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" - semconv "go.opentelemetry.io/otel/semconv/v1.7.0" ) func assertMetricAttributes(t *testing.T, expectedAttributes []attribute.KeyValue, measurementBatches []metrictest.Batch) { @@ -48,7 +47,8 @@ func TestHandlerBasics(t *testing.T) { spanRecorder := tracetest.NewSpanRecorder() provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(spanRecorder)) - meterProvider := metrictest.NewMeterProvider() + // TODO: Replace with in memory recorder + meterProvider := nonrecording.NewNoopMeterProvider() operation := "test_handler" @@ -72,19 +72,21 @@ func TestHandlerBasics(t *testing.T) { } h.ServeHTTP(rr, r) - if len(meterProvider.MeasurementBatches) == 0 { - t.Fatalf("got 0 recorded measurements, expected 1 or more") - } - - attributesToVerify := []attribute.KeyValue{ - semconv.HTTPServerNameKey.String(operation), - semconv.HTTPSchemeHTTP, - semconv.HTTPHostKey.String(r.Host), - semconv.HTTPFlavorKey.String(fmt.Sprintf("1.%d", r.ProtoMinor)), - attribute.String("test", "attribute"), - } - - assertMetricAttributes(t, attributesToVerify, meterProvider.MeasurementBatches) + // TODO: Verify meter recorded >0 batches + // if len(meterProvider.MeasurementBatches) == 0 { + // t.Fatalf("got 0 recorded measurements, expected 1 or more") + // } + + // TODO: Verify that batches had appropriate attributes + // attributesToVerify := []attribute.KeyValue{ + // semconv.HTTPServerNameKey.String(operation), + // semconv.HTTPSchemeHTTP, + // semconv.HTTPHostKey.String(r.Host), + // semconv.HTTPFlavorKey.String(fmt.Sprintf("1.%d", r.ProtoMinor)), + // attribute.String("test", "attribute"), + // } + + // assertMetricAttributes(t, attributesToVerify, meterProvider.MeasurementBatches) if got, expected := rr.Result().StatusCode, http.StatusOK; got != expected { t.Fatalf("got %d, expected %d", got, expected) From 3ad978b5f2f88ebaa2e572ec187bdba7b73420c5 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Thu, 10 Mar 2022 18:16:54 +0000 Subject: [PATCH 02/10] beego --- .../astaxie/beego/otelbeego/beego_test.go | 6 ++--- .../astaxie/beego/otelbeego/config.go | 2 +- .../github.com/astaxie/beego/otelbeego/go.mod | 6 ++--- .../github.com/astaxie/beego/otelbeego/go.sum | 20 ++++++-------- .../beego/otelbeego/test/beego_test.go | 27 ++++++++++--------- .../astaxie/beego/otelbeego/test/go.mod | 4 +-- .../astaxie/beego/otelbeego/test/go.sum | 17 ++++++------ 7 files changed, 40 insertions(+), 42 deletions(-) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go index 62049ebd6e4..b3b103ee946 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/beego_test.go @@ -22,7 +22,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric/global" - "go.opentelemetry.io/otel/metric/metrictest" + "go.opentelemetry.io/otel/metric/nonrecording" "go.opentelemetry.io/otel/trace" "github.com/astaxie/beego" @@ -58,7 +58,7 @@ func ctxTest() (context.Context, func(*testing.T, context.Context)) { func TestSpanFromContextDefaultProvider(t *testing.T) { defer replaceBeego() - provider := metrictest.NewMeterProvider() + provider := nonrecording.NewNoopMeterProvider() global.SetMeterProvider(provider) otel.SetTracerProvider(trace.NewNoopTracerProvider()) @@ -82,7 +82,7 @@ func TestSpanFromContextDefaultProvider(t *testing.T) { func TestSpanFromContextCustomProvider(t *testing.T) { defer replaceBeego() - provider := metrictest.NewMeterProvider() + provider := nonrecording.NewNoopMeterProvider() ctx, eval := ctxTest() router := beego.NewControllerRegister() router.Get("/hello-with-span", func(ctx *beegoCtx.Context) { diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/config.go b/instrumentation/github.com/astaxie/beego/otelbeego/config.go index 582dbd61c3f..364526102b4 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/config.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/config.go @@ -99,7 +99,7 @@ func WithSpanNameFormatter(f SpanNameFormatter) Option { func newConfig(options ...Option) *config { config := &config{ tracerProvider: otel.GetTracerProvider(), - meterProvider: global.GetMeterProvider(), + meterProvider: global.MeterProvider(), propagators: otel.GetTextMapPropagator(), filters: []Filter{}, formatter: defaultSpanNameFormatter, diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod index f07ff271e3c..7161c83f49c 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod @@ -12,9 +12,9 @@ require ( github.com/astaxie/beego v1.12.3 github.com/stretchr/testify v1.7.1 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/trace v1.6.0 golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect golang.org/x/text v0.3.3 // indirect diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum index 4f0e1372d9e..e75bc8981ab 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum @@ -43,8 +43,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -139,7 +140,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= @@ -147,16 +147,12 @@ github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2K github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go index e12e2b6ab3c..eb8fb629f95 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go @@ -29,7 +29,7 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego/internal" "go.opentelemetry.io/contrib/propagators/b3" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/metrictest" + "go.opentelemetry.io/otel/metric/nonrecording" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" @@ -189,7 +189,7 @@ func TestStatic(t *testing.T) { defer replaceBeego() sr := tracetest.NewSpanRecorder() tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - meterProvider := metrictest.NewMeterProvider() + meterProvider := nonrecording.NewNoopMeterProvider() file, err := ioutil.TempFile("", "static-*.html") require.NoError(t, err) defer os.Remove(file.Name()) @@ -220,7 +220,8 @@ func TestStatic(t *testing.T) { spans := sr.Ended() require.Len(t, spans, 1) assertSpan(t, spans[0], tc) - assertMetrics(t, meterProvider.MeasurementBatches, tc) + // TODO: recreate metrictest + // assertMetrics(t, meterProvider.MeasurementBatches, tc) } func TestRender(t *testing.T) { @@ -287,7 +288,7 @@ func TestRender(t *testing.T) { func runTest(t *testing.T, tc *testCase, url string) { sr := tracetest.NewSpanRecorder() tracerProvider := trace.NewTracerProvider(trace.WithSpanProcessor(sr)) - meterProvider := metrictest.NewMeterProvider() + meterProvider := nonrecording.NewNoopMeterProvider() addTestRoutes(t) defer replaceBeego() @@ -326,7 +327,8 @@ func runTest(t *testing.T, tc *testCase, url string) { } else { require.Len(t, spans, 0) } - assertMetrics(t, meterProvider.MeasurementBatches, tc) + // TODO: recreate metrictest + // assertMetrics(t, meterProvider.MeasurementBatches, tc) } func defaultAttributes() []attribute.KeyValue { @@ -345,13 +347,14 @@ func assertSpan(t *testing.T, span trace.ReadOnlySpan, tc *testCase) { } } -func assertMetrics(t *testing.T, batches []metrictest.Batch, tc *testCase) { - for _, batch := range batches { - for _, att := range tc.expectedAttributes { - require.Contains(t, batch.Labels, att) - } - } -} +// TODO: recreate metrictest +// func assertMetrics(t *testing.T, batches []metrictest.Batch, tc *testCase) { +// for _, batch := range batches { +// for _, att := range tc.expectedAttributes { +// require.Contains(t, batch.Labels, att) +// } +// } +// } // ------------------------------------------ Test Cases diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod index 3fb9f9e8eed..0de714f07f1 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod @@ -7,8 +7,8 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego v0.30.0 go.opentelemetry.io/contrib/propagators/b3 v1.5.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk v1.5.0 ) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum index 820fde7314a..3ba8aed3477 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum @@ -43,8 +43,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -147,18 +148,16 @@ github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2K github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= From 5eae6e3cb5672d15e453168ee51ed4a46df11576 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Thu, 10 Mar 2022 18:19:31 +0000 Subject: [PATCH 03/10] gocql --- .../gocql/gocql/otelgocql/config.go | 2 +- .../github.com/gocql/gocql/otelgocql/go.mod | 6 ++-- .../github.com/gocql/gocql/otelgocql/go.sum | 20 +++++------ .../gocql/gocql/otelgocql/instrument.go | 34 ++++++++++--------- .../gocql/gocql/otelgocql/test/go.mod | 8 ++--- .../gocql/gocql/otelgocql/test/go.sum | 27 +++++++-------- .../gocql/gocql/otelgocql/test/gocql_test.go | 4 +-- 7 files changed, 49 insertions(+), 52 deletions(-) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/config.go b/instrumentation/github.com/gocql/gocql/otelgocql/config.go index b3c70bf96a1..944edfbf7e7 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/config.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/config.go @@ -120,7 +120,7 @@ func WithConnectInstrumentation(enabled bool) Option { func newConfig(options ...Option) *config { cfg := &config{ tracerProvider: otel.GetTracerProvider(), - meterProvider: global.GetMeterProvider(), + meterProvider: global.MeterProvider(), instrumentQuery: true, instrumentBatch: true, instrumentConnect: true, diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod index b4b303bb642..010f1c38660 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod @@ -8,7 +8,7 @@ require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e github.com/golang/snappy v0.0.1 // indirect github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum index 15446f84017..c48a0c4b086 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum @@ -4,8 +4,9 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e h1:SroDcndcOU9BVAduPf/PXihXoR2ZYTQYLXbupbqxAyQ= @@ -26,19 +27,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go index bc309302968..5c0bd311ffe 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go @@ -19,25 +19,27 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/metric/unit" ) type instruments struct { // queryCount is the number of queries executed. - queryCount metric.Int64Counter + queryCount syncint64.Counter // queryRows is the number of rows returned by a query. - queryRows metric.Int64Histogram + queryRows syncint64.Histogram // batchCount is the number of batch queries executed. - batchCount metric.Int64Counter + batchCount syncint64.Counter // connectionCount is the number of connections made // with the traced session. - connectionCount metric.Int64Counter + connectionCount syncint64.Counter // latency is the sum of attempt latencies. - latency metric.Int64Histogram + latency syncint64.Histogram } // newInstruments will create instruments using a meter @@ -50,38 +52,38 @@ func newInstruments(p metric.MeterProvider) *instruments { instruments := &instruments{} var err error - if instruments.queryCount, err = meter.NewInt64Counter( + if instruments.queryCount, err = meter.SyncInt64().Counter( "db.cassandra.queries", - metric.WithDescription("Number queries executed"), + instrument.WithDescription("Number queries executed"), ); err != nil { log.Printf("failed to create iQueryCount instrument, %v", err) } - if instruments.queryRows, err = meter.NewInt64Histogram( + if instruments.queryRows, err = meter.SyncInt64().Histogram( "db.cassandra.rows", - metric.WithDescription("Number of rows returned from query"), + instrument.WithDescription("Number of rows returned from query"), ); err != nil { log.Printf("failed to create iQueryRows instrument, %v", err) } - if instruments.batchCount, err = meter.NewInt64Counter( + if instruments.batchCount, err = meter.SyncInt64().Counter( "db.cassandra.batch.queries", - metric.WithDescription("Number of batch queries executed"), + instrument.WithDescription("Number of batch queries executed"), ); err != nil { log.Printf("failed to create iBatchCount instrument, %v", err) } - if instruments.connectionCount, err = meter.NewInt64Counter( + if instruments.connectionCount, err = meter.SyncInt64().Counter( "db.cassandra.connections", - metric.WithDescription("Number of connections created"), + instrument.WithDescription("Number of connections created"), ); err != nil { log.Printf("failed to create iConnectionCount instrument, %v", err) } - if instruments.latency, err = meter.NewInt64Histogram( + if instruments.latency, err = meter.SyncInt64().Histogram( "db.cassandra.latency", - metric.WithDescription("Sum of latency to host in milliseconds"), - metric.WithUnit(unit.Milliseconds), + instrument.WithDescription("Sum of latency to host in milliseconds"), + instrument.WithUnit(unit.Milliseconds), ); err != nil { log.Printf("failed to create iLatency instrument, %v", err) } diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod index 2b03ce700b4..cd54b6d2f61 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod @@ -7,10 +7,10 @@ require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/contrib v1.5.0 go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 + go.opentelemetry.io/otel/trace v1.6.0 ) replace go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql => ../ diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum index 72225539d51..944205aa9bc 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum @@ -1,11 +1,13 @@ +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= @@ -28,21 +30,18 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= -go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= +go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go index a000e2009aa..f6fdbc6c6a1 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go @@ -30,8 +30,8 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" "go.opentelemetry.io/contrib/internal/util" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/metrictest" - "go.opentelemetry.io/otel/metric/number" + "go.opentelemetry.io/otel/sdk/metric/metrictest" + "go.opentelemetry.io/otel/sdk/metric/number" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" semconv "go.opentelemetry.io/otel/semconv/v1.7.0" From 04ecdb11bfaf1df62992c04d6054fde634f9d35b Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 14:37:19 +0000 Subject: [PATCH 04/10] host --- instrumentation/host/go.mod | 4 +- instrumentation/host/go.sum | 19 +- instrumentation/host/host.go | 229 ++++++++++---------- instrumentation/host/host_test.go | 343 +++++++++++++++--------------- 4 files changed, 294 insertions(+), 301 deletions(-) diff --git a/instrumentation/host/go.mod b/instrumentation/host/go.mod index 59f8bee6197..441cac71751 100644 --- a/instrumentation/host/go.mod +++ b/instrumentation/host/go.mod @@ -5,7 +5,7 @@ go 1.16 require ( github.com/shirou/gopsutil/v3 v3.22.2 github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect ) diff --git a/instrumentation/host/go.sum b/instrumentation/host/go.sum index ab03ff4b332..021387363f3 100644 --- a/instrumentation/host/go.sum +++ b/instrumentation/host/go.sum @@ -1,7 +1,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -27,16 +28,12 @@ github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2bi github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/instrumentation/host/host.go b/instrumentation/host/host.go index f36ebcaa457..6084b228614 100644 --- a/instrumentation/host/host.go +++ b/instrumentation/host/host.go @@ -29,6 +29,9 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncfloat64" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" "go.opentelemetry.io/otel/metric/unit" ) @@ -88,7 +91,7 @@ var ( // newConfig computes a config from a list of Options. func newConfig(opts ...Option) config { c := config{ - MeterProvider: global.GetMeterProvider(), + MeterProvider: global.MeterProvider(), } for _, opt := range opts { opt.apply(&c) @@ -100,7 +103,7 @@ func newConfig(opts ...Option) config { func Start(opts ...Option) error { c := newConfig(opts...) if c.MeterProvider == nil { - c.MeterProvider = global.GetMeterProvider() + c.MeterProvider = global.MeterProvider() } h := &host{ meter: c.MeterProvider.Meter( @@ -116,13 +119,13 @@ func (h *host) register() error { var ( err error - processCPUTime metric.Float64CounterObserver - hostCPUTime metric.Float64CounterObserver + processCPUTime asyncfloat64.Counter + hostCPUTime asyncfloat64.Counter - hostMemoryUsage metric.Int64GaugeObserver - hostMemoryUtilization metric.Float64GaugeObserver + hostMemoryUsage asyncint64.Gauge + hostMemoryUtilization asyncfloat64.Gauge - networkIOUsage metric.Int64CounterObserver + networkIOUsage asyncint64.Counter // lock prevents a race between batch observer and instrument registration. lock sync.Mutex @@ -136,147 +139,151 @@ func (h *host) register() error { lock.Lock() defer lock.Unlock() - batchObserver := h.meter.NewBatchObserver(func(ctx context.Context, result metric.BatchObserverResult) { - lock.Lock() - defer lock.Unlock() - - // This follows the OpenTelemetry Collector's "hostmetrics" - // receiver/hostmetricsreceiver/internal/scraper/processscraper - // measures User and System IOwait time. - // TODO: the Collector has per-OS compilation modules to support - // specific metrics that are not universal. - processTimes, err := proc.TimesWithContext(ctx) - if err != nil { - otel.Handle(err) - return - } - - hostTimeSlice, err := cpu.TimesWithContext(ctx, false) - if err != nil { - otel.Handle(err) - return - } - if len(hostTimeSlice) != 1 { - otel.Handle(fmt.Errorf("host CPU usage: incorrect summary count")) - return - } - - vmStats, err := mem.VirtualMemoryWithContext(ctx) - if err != nil { - otel.Handle(err) - return - } - - ioStats, err := net.IOCountersWithContext(ctx, false) - if err != nil { - otel.Handle(err) - return - } - if len(ioStats) != 1 { - otel.Handle(fmt.Errorf("host network usage: incorrect summary count")) - return - } - - // Process CPU time - result.Observe(AttributeCPUTimeUser, processCPUTime.Observation(processTimes.User)) - result.Observe(AttributeCPUTimeSystem, processCPUTime.Observation(processTimes.System)) - - // Host CPU time - hostTime := hostTimeSlice[0] - result.Observe(AttributeCPUTimeUser, hostCPUTime.Observation(hostTime.User)) - result.Observe(AttributeCPUTimeSystem, hostCPUTime.Observation(hostTime.System)) - - // TODO(#244): "other" is a placeholder for actually dealing - // with these states. Do users actually want this - // (unconditionally)? How should we handle "iowait" - // if not all systems expose it? Should we break - // these down by CPU? If so, are users going to want - // to aggregate in-process? See: - // https://github.com/open-telemetry/opentelemetry-go-contrib/issues/244 - other := hostTime.Nice + - hostTime.Iowait + - hostTime.Irq + - hostTime.Softirq + - hostTime.Steal + - hostTime.Guest + - hostTime.GuestNice - - result.Observe(AttributeCPUTimeOther, hostCPUTime.Observation(other)) - result.Observe(AttributeCPUTimeIdle, hostCPUTime.Observation(hostTime.Idle)) - - // Host memory usage - result.Observe(AttributeMemoryUsed, hostMemoryUsage.Observation(int64(vmStats.Used))) - result.Observe(AttributeMemoryAvailable, hostMemoryUsage.Observation(int64(vmStats.Available))) - - // Host memory utilization - result.Observe(AttributeMemoryUsed, - hostMemoryUtilization.Observation(float64(vmStats.Used)/float64(vmStats.Total)), - ) - result.Observe(AttributeMemoryAvailable, - hostMemoryUtilization.Observation(float64(vmStats.Available)/float64(vmStats.Total)), - ) - - // Host network usage - // - // TODO: These can be broken down by network - // interface, with similar questions to those posed - // about per-CPU measurements above. - result.Observe(AttributeNetworkTransmit, networkIOUsage.Observation(int64(ioStats[0].BytesSent))) - result.Observe(AttributeNetworkReceive, networkIOUsage.Observation(int64(ioStats[0].BytesRecv))) - }) - // TODO: .time units are in seconds, but "unit" package does // not include this string. // https://github.com/open-telemetry/opentelemetry-specification/issues/705 - if processCPUTime, err = batchObserver.NewFloat64CounterObserver( + if processCPUTime, err = h.meter.AsyncFloat64().Counter( "process.cpu.time", - metric.WithUnit("s"), - metric.WithDescription( + instrument.WithUnit("s"), + instrument.WithDescription( "Accumulated CPU time spent by this process attributeed by state (User, System, ...)", ), ); err != nil { return err } - if hostCPUTime, err = batchObserver.NewFloat64CounterObserver( + if hostCPUTime, err = h.meter.AsyncFloat64().Counter( "system.cpu.time", - metric.WithUnit("s"), - metric.WithDescription( + instrument.WithUnit("s"), + instrument.WithDescription( "Accumulated CPU time spent by this host attributeed by state (User, System, Other, Idle)", ), ); err != nil { return err } - if hostMemoryUsage, err = batchObserver.NewInt64GaugeObserver( + if hostMemoryUsage, err = h.meter.AsyncInt64().Gauge( "system.memory.usage", - metric.WithUnit(unit.Bytes), - metric.WithDescription( + instrument.WithUnit(unit.Bytes), + instrument.WithDescription( "Memory usage of this process attributed by memory state (Used, Available)", ), ); err != nil { return err } - if hostMemoryUtilization, err = batchObserver.NewFloat64GaugeObserver( + if hostMemoryUtilization, err = h.meter.AsyncFloat64().Gauge( "system.memory.utilization", - metric.WithUnit(unit.Dimensionless), - metric.WithDescription( + instrument.WithUnit(unit.Dimensionless), + instrument.WithDescription( "Memory utilization of this process attributeed by memory state (Used, Available)", ), ); err != nil { return err } - if networkIOUsage, err = batchObserver.NewInt64CounterObserver( + if networkIOUsage, err = h.meter.AsyncInt64().Counter( "system.network.io", - metric.WithUnit(unit.Bytes), - metric.WithDescription( + instrument.WithUnit(unit.Bytes), + instrument.WithDescription( "Bytes transferred attributeed by direction (Transmit, Receive)", ), ); err != nil { return err } + err = h.meter.RegisterCallback( + []instrument.Asynchronous{ + processCPUTime, + hostCPUTime, + hostMemoryUsage, + hostMemoryUtilization, + networkIOUsage, + }, + func(ctx context.Context) { + lock.Lock() + defer lock.Unlock() + + // This follows the OpenTelemetry Collector's "hostmetrics" + // receiver/hostmetricsreceiver/internal/scraper/processscraper + // measures User and System IOwait time. + // TODO: the Collector has per-OS compilation modules to support + // specific metrics that are not universal. + processTimes, err := proc.TimesWithContext(ctx) + if err != nil { + otel.Handle(err) + return + } + + hostTimeSlice, err := cpu.TimesWithContext(ctx, false) + if err != nil { + otel.Handle(err) + return + } + if len(hostTimeSlice) != 1 { + otel.Handle(fmt.Errorf("host CPU usage: incorrect summary count")) + return + } + + vmStats, err := mem.VirtualMemoryWithContext(ctx) + if err != nil { + otel.Handle(err) + return + } + + ioStats, err := net.IOCountersWithContext(ctx, false) + if err != nil { + otel.Handle(err) + return + } + if len(ioStats) != 1 { + otel.Handle(fmt.Errorf("host network usage: incorrect summary count")) + return + } + + // Process CPU time + processCPUTime.Observe(ctx, processTimes.User, AttributeCPUTimeUser...) + processCPUTime.Observe(ctx, processTimes.System, AttributeCPUTimeSystem...) + + // Host CPU time + hostTime := hostTimeSlice[0] + hostCPUTime.Observe(ctx, hostTime.User, AttributeCPUTimeUser...) + hostCPUTime.Observe(ctx, hostTime.System, AttributeCPUTimeSystem...) + + // TODO(#244): "other" is a placeholder for actually dealing + // with these states. Do users actually want this + // (unconditionally)? How should we handle "iowait" + // if not all systems expose it? Should we break + // these down by CPU? If so, are users going to want + // to aggregate in-process? See: + // https://github.com/open-telemetry/opentelemetry-go-contrib/issues/244 + other := hostTime.Nice + + hostTime.Iowait + + hostTime.Irq + + hostTime.Softirq + + hostTime.Steal + + hostTime.Guest + + hostTime.GuestNice + + hostCPUTime.Observe(ctx, other, AttributeCPUTimeOther...) + hostCPUTime.Observe(ctx, hostTime.Idle, AttributeCPUTimeIdle...) + + // Host memory usage + hostMemoryUsage.Observe(ctx, int64(vmStats.Used), AttributeMemoryUsed...) + hostMemoryUsage.Observe(ctx, int64(vmStats.Available), AttributeMemoryAvailable...) + + // Host memory utilization + hostMemoryUtilization.Observe(ctx, float64(vmStats.Used)/float64(vmStats.Total), AttributeMemoryUsed...) + hostMemoryUtilization.Observe(ctx, float64(vmStats.Available)/float64(vmStats.Total), AttributeMemoryAvailable...) + + // Host network usage + // + // TODO: These can be broken down by network + // interface, with similar questions to those posed + // about per-CPU measurements above. + networkIOUsage.Observe(ctx, int64(ioStats[0].BytesSent), AttributeNetworkTransmit...) + networkIOUsage.Observe(ctx, int64(ioStats[0].BytesRecv), AttributeNetworkReceive...) + }) + return nil } diff --git a/instrumentation/host/host_test.go b/instrumentation/host/host_test.go index 4d85e9adb2e..015428135ed 100644 --- a/instrumentation/host/host_test.go +++ b/instrumentation/host/host_test.go @@ -15,157 +15,145 @@ package host_test import ( - "context" gonet "net" - "os" "testing" - "time" - "github.com/shirou/gopsutil/v3/cpu" - "github.com/shirou/gopsutil/v3/mem" - "github.com/shirou/gopsutil/v3/net" - "github.com/shirou/gopsutil/v3/process" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric/metrictest" - - "go.opentelemetry.io/contrib/instrumentation/host" ) -func getMetric(provider *metrictest.MeterProvider, name string, lbl attribute.KeyValue) float64 { - for _, b := range provider.MeasurementBatches { - foundAttribute := false - for _, haveLabel := range b.Labels { - if haveLabel != lbl { - continue - } - foundAttribute = true - break - } - if !foundAttribute { - continue - } - - for _, m := range b.Measurements { - if m.Instrument.Descriptor().Name() != name { - continue - } - - return m.Number.CoerceToFloat64(m.Instrument.Descriptor().NumberKind()) - } - } - panic("Could not locate a metric in test output") -} - -func TestHostCPU(t *testing.T) { - provider := metrictest.NewMeterProvider() - err := host.Start( - host.WithMeterProvider(provider), - ) - assert.NoError(t, err) - - proc, err := process.NewProcess(int32(os.Getpid())) - require.NoError(t, err) - - ctx := context.Background() - processBefore, err := proc.TimesWithContext(ctx) - require.NoError(t, err) - - hostBefore, err := cpu.TimesWithContext(ctx, false) - require.NoError(t, err) - - start := time.Now() - for time.Since(start) < time.Second { - // This has a mix of user and system time, so serves - // the purpose of advancing both process and host, - // user and system CPU usage. - _, err = proc.TimesWithContext(ctx) - require.NoError(t, err) - } - - provider.RunAsyncInstruments() - - processUser := getMetric(provider, "process.cpu.time", host.AttributeCPUTimeUser[0]) - processSystem := getMetric(provider, "process.cpu.time", host.AttributeCPUTimeSystem[0]) - - hostUser := getMetric(provider, "system.cpu.time", host.AttributeCPUTimeUser[0]) - hostSystem := getMetric(provider, "system.cpu.time", host.AttributeCPUTimeSystem[0]) - - processAfter, err := proc.TimesWithContext(ctx) - require.NoError(t, err) - - hostAfter, err := cpu.TimesWithContext(ctx, false) - require.NoError(t, err) - - // Validate process times: - // User times are in range - require.LessOrEqual(t, processBefore.User, processUser) - require.GreaterOrEqual(t, processAfter.User, processUser) - // System times are in range - require.LessOrEqual(t, processBefore.System, processSystem) - require.GreaterOrEqual(t, processAfter.System, processSystem) - // Ranges are not empty - require.NotEqual(t, processAfter.System, processBefore.System) - require.NotEqual(t, processAfter.User, processBefore.User) - - // Validate host times: - // Correct assumptions: - require.Equal(t, 1, len(hostBefore)) - require.Equal(t, 1, len(hostAfter)) - // User times are in range - require.LessOrEqual(t, hostBefore[0].User, hostUser) - require.GreaterOrEqual(t, hostAfter[0].User, hostUser) - // System times are in range - require.LessOrEqual(t, hostBefore[0].System, hostSystem) - require.GreaterOrEqual(t, hostAfter[0].System, hostSystem) - // Ranges are not empty - require.NotEqual(t, hostAfter[0].System, hostBefore[0].System) - require.NotEqual(t, hostAfter[0].User, hostBefore[0].User) - - // TODO: We are not testing host "Other" nor "Idle" and - // generally the specification hasn't been finalized, so - // there's more to do. Moreover, "Other" is not portable and - // "Idle" may not advance on a fully loaded machine => both - // are difficult to test. -} - -func TestHostMemory(t *testing.T) { - provider := metrictest.NewMeterProvider() - err := host.Start( - host.WithMeterProvider(provider), - ) - assert.NoError(t, err) - - ctx := context.Background() - vMem, err := mem.VirtualMemoryWithContext(ctx) - require.NoError(t, err) - - provider.RunAsyncInstruments() - - hostUsed := getMetric(provider, "system.memory.usage", host.AttributeMemoryUsed[0]) - assert.Greater(t, hostUsed, 0.0) - assert.LessOrEqual(t, hostUsed, float64(vMem.Total)) - - hostAvailable := getMetric(provider, "system.memory.usage", host.AttributeMemoryAvailable[0]) - assert.GreaterOrEqual(t, hostAvailable, 0.0) - assert.Less(t, hostAvailable, float64(vMem.Total)) - - hostUsedUtil := getMetric(provider, "system.memory.utilization", host.AttributeMemoryUsed[0]) - assert.Greater(t, hostUsedUtil, 0.0) - assert.LessOrEqual(t, hostUsedUtil, 1.0) - - hostAvailableUtil := getMetric(provider, "system.memory.utilization", host.AttributeMemoryAvailable[0]) - assert.GreaterOrEqual(t, hostAvailableUtil, 0.0) - assert.Less(t, hostAvailableUtil, 1.0) - - if hostUsed > hostAvailable { - assert.Greater(t, hostUsedUtil, hostAvailableUtil) - } else { - assert.Less(t, hostUsedUtil, hostAvailableUtil) - } -} +// TODO Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 +// func getMetric(provider *metrictest.MeterProvider, name string, lbl attribute.KeyValue) float64 { +// for _, b := range provider.MeasurementBatches { +// foundAttribute := false +// for _, haveLabel := range b.Labels { +// if haveLabel != lbl { +// continue +// } +// foundAttribute = true +// break +// } +// if !foundAttribute { +// continue +// } + +// for _, m := range b.Measurements { +// if m.Instrument.Descriptor().Name() != name { +// continue +// } + +// return m.Number.CoerceToFloat64(m.Instrument.Descriptor().NumberKind()) +// } +// } +// panic("Could not locate a metric in test output") +// } + +// func TestHostCPU(t *testing.T) { +// provider := metrictest.NewMeterProvider() +// err := host.Start( +// host.WithMeterProvider(provider), +// ) +// assert.NoError(t, err) + +// proc, err := process.NewProcess(int32(os.Getpid())) +// require.NoError(t, err) + +// ctx := context.Background() +// processBefore, err := proc.TimesWithContext(ctx) +// require.NoError(t, err) + +// hostBefore, err := cpu.TimesWithContext(ctx, false) +// require.NoError(t, err) + +// start := time.Now() +// for time.Since(start) < time.Second { +// // This has a mix of user and system time, so serves +// // the purpose of advancing both process and host, +// // user and system CPU usage. +// _, err = proc.TimesWithContext(ctx) +// require.NoError(t, err) +// } + +// provider.RunAsyncInstruments() + +// processUser := getMetric(provider, "process.cpu.time", host.AttributeCPUTimeUser[0]) +// processSystem := getMetric(provider, "process.cpu.time", host.AttributeCPUTimeSystem[0]) + +// hostUser := getMetric(provider, "system.cpu.time", host.AttributeCPUTimeUser[0]) +// hostSystem := getMetric(provider, "system.cpu.time", host.AttributeCPUTimeSystem[0]) + +// processAfter, err := proc.TimesWithContext(ctx) +// require.NoError(t, err) + +// hostAfter, err := cpu.TimesWithContext(ctx, false) +// require.NoError(t, err) + +// // Validate process times: +// // User times are in range +// require.LessOrEqual(t, processBefore.User, processUser) +// require.GreaterOrEqual(t, processAfter.User, processUser) +// // System times are in range +// require.LessOrEqual(t, processBefore.System, processSystem) +// require.GreaterOrEqual(t, processAfter.System, processSystem) +// // Ranges are not empty +// require.NotEqual(t, processAfter.System, processBefore.System) +// require.NotEqual(t, processAfter.User, processBefore.User) + +// // Validate host times: +// // Correct assumptions: +// require.Equal(t, 1, len(hostBefore)) +// require.Equal(t, 1, len(hostAfter)) +// // User times are in range +// require.LessOrEqual(t, hostBefore[0].User, hostUser) +// require.GreaterOrEqual(t, hostAfter[0].User, hostUser) +// // System times are in range +// require.LessOrEqual(t, hostBefore[0].System, hostSystem) +// require.GreaterOrEqual(t, hostAfter[0].System, hostSystem) +// // Ranges are not empty +// require.NotEqual(t, hostAfter[0].System, hostBefore[0].System) +// require.NotEqual(t, hostAfter[0].User, hostBefore[0].User) + +// // TODO: We are not testing host "Other" nor "Idle" and +// // generally the specification hasn't been finalized, so +// // there's more to do. Moreover, "Other" is not portable and +// // "Idle" may not advance on a fully loaded machine => both +// // are difficult to test. +// } + +// func TestHostMemory(t *testing.T) { +// provider := metrictest.NewMeterProvider() +// err := host.Start( +// host.WithMeterProvider(provider), +// ) +// assert.NoError(t, err) + +// ctx := context.Background() +// vMem, err := mem.VirtualMemoryWithContext(ctx) +// require.NoError(t, err) + +// provider.RunAsyncInstruments() + +// hostUsed := getMetric(provider, "system.memory.usage", host.AttributeMemoryUsed[0]) +// assert.Greater(t, hostUsed, 0.0) +// assert.LessOrEqual(t, hostUsed, float64(vMem.Total)) + +// hostAvailable := getMetric(provider, "system.memory.usage", host.AttributeMemoryAvailable[0]) +// assert.GreaterOrEqual(t, hostAvailable, 0.0) +// assert.Less(t, hostAvailable, float64(vMem.Total)) + +// hostUsedUtil := getMetric(provider, "system.memory.utilization", host.AttributeMemoryUsed[0]) +// assert.Greater(t, hostUsedUtil, 0.0) +// assert.LessOrEqual(t, hostUsedUtil, 1.0) + +// hostAvailableUtil := getMetric(provider, "system.memory.utilization", host.AttributeMemoryAvailable[0]) +// assert.GreaterOrEqual(t, hostAvailableUtil, 0.0) +// assert.Less(t, hostAvailableUtil, 1.0) + +// if hostUsed > hostAvailable { +// assert.Greater(t, hostUsedUtil, hostAvailableUtil) +// } else { +// assert.Less(t, hostUsedUtil, hostAvailableUtil) +// } +// } func sendBytes(t *testing.T, count int) error { conn1, err := gonet.ListenPacket("udp", "127.0.0.1:0") @@ -203,35 +191,36 @@ func sendBytes(t *testing.T, count int) error { return nil } -func TestHostNetwork(t *testing.T) { - provider := metrictest.NewMeterProvider() - err := host.Start( - host.WithMeterProvider(provider), - ) - assert.NoError(t, err) - - ctx := context.Background() - hostBefore, err := net.IOCountersWithContext(ctx, false) - require.NoError(t, err) - - const howMuch = 10000 - err = sendBytes(t, howMuch) - require.NoError(t, err) - - // As we are going to read the /proc file system for this info, sleep a while: - require.Eventually(t, func() bool { - hostAfter, err := net.IOCountersWithContext(ctx, false) - require.NoError(t, err) - - return uint64(howMuch) <= hostAfter[0].BytesSent-hostBefore[0].BytesSent && - uint64(howMuch) <= hostAfter[0].BytesRecv-hostBefore[0].BytesRecv - }, 30*time.Second, time.Second/2) - - provider.RunAsyncInstruments() - hostTransmit := getMetric(provider, "system.network.io", host.AttributeNetworkTransmit[0]) - hostReceive := getMetric(provider, "system.network.io", host.AttributeNetworkReceive[0]) - - // Check that the recorded measurements reflect the same change: - require.LessOrEqual(t, uint64(howMuch), uint64(hostTransmit)-hostBefore[0].BytesSent) - require.LessOrEqual(t, uint64(howMuch), uint64(hostReceive)-hostBefore[0].BytesRecv) -} +// TODO Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 +// func TestHostNetwork(t *testing.T) { +// provider := metrictest.NewMeterProvider() +// err := host.Start( +// host.WithMeterProvider(provider), +// ) +// assert.NoError(t, err) + +// ctx := context.Background() +// hostBefore, err := net.IOCountersWithContext(ctx, false) +// require.NoError(t, err) + +// const howMuch = 10000 +// err = sendBytes(t, howMuch) +// require.NoError(t, err) + +// // As we are going to read the /proc file system for this info, sleep a while: +// require.Eventually(t, func() bool { +// hostAfter, err := net.IOCountersWithContext(ctx, false) +// require.NoError(t, err) + +// return uint64(howMuch) <= hostAfter[0].BytesSent-hostBefore[0].BytesSent && +// uint64(howMuch) <= hostAfter[0].BytesRecv-hostBefore[0].BytesRecv +// }, 30*time.Second, time.Second/2) + +// provider.RunAsyncInstruments() +// hostTransmit := getMetric(provider, "system.network.io", host.AttributeNetworkTransmit[0]) +// hostReceive := getMetric(provider, "system.network.io", host.AttributeNetworkReceive[0]) + +// // Check that the recorded measurements reflect the same change: +// require.LessOrEqual(t, uint64(howMuch), uint64(hostTransmit)-hostBefore[0].BytesSent) +// require.LessOrEqual(t, uint64(howMuch), uint64(hostReceive)-hostBefore[0].BytesRecv) +// } From 67a75ae49686cae4503e6a4da60e2be6038dc89b Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 15:55:31 +0000 Subject: [PATCH 05/10] runtime --- instrumentation/runtime/go.mod | 3 +- instrumentation/runtime/go.sum | 24 +-- instrumentation/runtime/runtime.go | 200 +++++++++++++----------- instrumentation/runtime/runtime_test.go | 96 ++++++------ 4 files changed, 172 insertions(+), 151 deletions(-) diff --git a/instrumentation/runtime/go.mod b/instrumentation/runtime/go.mod index 2663b401517..0c168192714 100644 --- a/instrumentation/runtime/go.mod +++ b/instrumentation/runtime/go.mod @@ -6,5 +6,6 @@ replace go.opentelemetry.io/contrib => ../.. require ( github.com/stretchr/testify v1.7.1 - go.opentelemetry.io/otel/metric v0.27.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/instrumentation/runtime/go.sum b/instrumentation/runtime/go.sum index 06651042415..18f67fc0a66 100644 --- a/instrumentation/runtime/go.sum +++ b/instrumentation/runtime/go.sum @@ -1,7 +1,9 @@ +github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -9,17 +11,19 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0 h1:7ESuKPq6zpjRaY5nvVDGiuwK7VAJ8MwkKnmNJ9whNZ4= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/trace v1.4.0 h1:4OOUrPZdVFQkbzl/JSdvGCWIdw5ONXXxzHlaLlWppmo= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= +go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= +golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/instrumentation/runtime/runtime.go b/instrumentation/runtime/runtime.go index 667e59b6afb..b29ebabec41 100644 --- a/instrumentation/runtime/runtime.go +++ b/instrumentation/runtime/runtime.go @@ -22,6 +22,9 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" + "go.opentelemetry.io/otel/metric/instrument" + "go.opentelemetry.io/otel/metric/instrument/asyncint64" + "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/metric/unit" ) @@ -87,7 +90,7 @@ func (o metricProviderOption) apply(c *config) { // newConfig computes a config from the supplied Options. func newConfig(opts ...Option) config { c := config{ - MeterProvider: global.GetMeterProvider(), + MeterProvider: global.MeterProvider(), MinimumReadMemStatsInterval: DefaultMinimumReadMemStatsInterval, } for _, opt := range opts { @@ -103,7 +106,7 @@ func Start(opts ...Option) error { c.MinimumReadMemStatsInterval = DefaultMinimumReadMemStatsInterval } if c.MeterProvider == nil { - c.MeterProvider = global.GetMeterProvider() + c.MeterProvider = global.MeterProvider() } r := &runtime{ meter: c.MeterProvider.Meter( @@ -117,36 +120,40 @@ func Start(opts ...Option) error { func (r *runtime) register() error { startTime := time.Now() - if _, err := r.meter.NewInt64CounterObserver( + uptime, err := r.meter.AsyncInt64().UpDownCounter( "runtime.uptime", - func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(time.Since(startTime).Milliseconds()) - }, - metric.WithUnit(unit.Milliseconds), - metric.WithDescription("Milliseconds since application was initialized"), - ); err != nil { + instrument.WithUnit(unit.Milliseconds), + instrument.WithDescription("Milliseconds since application was initialized"), + ) + if err != nil { return err } - if _, err := r.meter.NewInt64UpDownCounterObserver( + goroutines, err := r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.goroutines", - func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(int64(goruntime.NumGoroutine())) - }, - metric.WithDescription("Number of goroutines that currently exist"), - ); err != nil { + instrument.WithDescription("Number of goroutines that currently exist"), + ) + if err != nil { return err } - if _, err := r.meter.NewInt64CounterObserver( + cgoCalls, err := r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.cgo.calls", - func(_ context.Context, result metric.Int64ObserverResult) { - result.Observe(goruntime.NumCgoCall()) + instrument.WithDescription("Number of cgo calls made by the current process"), + ) + + err = r.meter.RegisterCallback( + []instrument.Asynchronous{ + uptime, + goroutines, + cgoCalls, }, - metric.WithDescription("Number of cgo calls made by the current process"), - ); err != nil { - return err - } + func(ctx context.Context) { + uptime.Observe(ctx, time.Since(startTime).Milliseconds()) + goroutines.Observe(ctx, int64(goruntime.NumGoroutine())) + cgoCalls.Observe(ctx, goruntime.NumCgoCall()) + }, + ) return r.registerMemStats() } @@ -155,21 +162,21 @@ func (r *runtime) registerMemStats() error { var ( err error - heapAlloc metric.Int64UpDownCounterObserver - heapIdle metric.Int64UpDownCounterObserver - heapInuse metric.Int64UpDownCounterObserver - heapObjects metric.Int64UpDownCounterObserver - heapReleased metric.Int64UpDownCounterObserver - heapSys metric.Int64UpDownCounterObserver - liveObjects metric.Int64UpDownCounterObserver + heapAlloc asyncint64.UpDownCounter + heapIdle asyncint64.UpDownCounter + heapInuse asyncint64.UpDownCounter + heapObjects asyncint64.UpDownCounter + heapReleased asyncint64.UpDownCounter + heapSys asyncint64.UpDownCounter + liveObjects asyncint64.UpDownCounter // TODO: is ptrLookups useful? I've not seen a value // other than zero. - ptrLookups metric.Int64CounterObserver + ptrLookups asyncint64.Counter - gcCount metric.Int64CounterObserver - pauseTotalNs metric.Int64CounterObserver - gcPauseNs metric.Int64Histogram + gcCount asyncint64.Counter + pauseTotalNs asyncint64.Counter + gcPauseNs syncint64.Histogram lastNumGC uint32 lastMemStats time.Time @@ -182,101 +189,72 @@ func (r *runtime) registerMemStats() error { lock.Lock() defer lock.Unlock() - batchObserver := r.meter.NewBatchObserver(func(ctx context.Context, result metric.BatchObserverResult) { - lock.Lock() - defer lock.Unlock() - - now := time.Now() - if now.Sub(lastMemStats) >= r.config.MinimumReadMemStatsInterval { - goruntime.ReadMemStats(&memStats) - lastMemStats = now - } - - result.Observe( - nil, - heapAlloc.Observation(int64(memStats.HeapAlloc)), - heapIdle.Observation(int64(memStats.HeapIdle)), - heapInuse.Observation(int64(memStats.HeapInuse)), - heapObjects.Observation(int64(memStats.HeapObjects)), - heapReleased.Observation(int64(memStats.HeapReleased)), - heapSys.Observation(int64(memStats.HeapSys)), - liveObjects.Observation(int64(memStats.Mallocs-memStats.Frees)), - ptrLookups.Observation(int64(memStats.Lookups)), - gcCount.Observation(int64(memStats.NumGC)), - pauseTotalNs.Observation(int64(memStats.PauseTotalNs)), - ) - - computeGCPauses(ctx, &gcPauseNs, memStats.PauseNs[:], lastNumGC, memStats.NumGC) - - lastNumGC = memStats.NumGC - }) - - if heapAlloc, err = batchObserver.NewInt64UpDownCounterObserver( + if heapAlloc, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.heap_alloc", - metric.WithUnit(unit.Bytes), - metric.WithDescription("Bytes of allocated heap objects"), + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("Bytes of allocated heap objects"), ); err != nil { return err } - if heapIdle, err = batchObserver.NewInt64UpDownCounterObserver( + if heapIdle, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.heap_idle", - metric.WithUnit(unit.Bytes), - metric.WithDescription("Bytes in idle (unused) spans"), + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("Bytes in idle (unused) spans"), ); err != nil { return err } - if heapInuse, err = batchObserver.NewInt64UpDownCounterObserver( + if heapInuse, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.heap_inuse", - metric.WithUnit(unit.Bytes), - metric.WithDescription("Bytes in in-use spans"), + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("Bytes in in-use spans"), ); err != nil { return err } - if heapObjects, err = batchObserver.NewInt64UpDownCounterObserver( + if heapObjects, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.heap_objects", - metric.WithDescription("Number of allocated heap objects"), + instrument.WithDescription("Number of allocated heap objects"), ); err != nil { return err } // FYI see https://github.com/golang/go/issues/32284 to help // understand the meaning of this value. - if heapReleased, err = batchObserver.NewInt64UpDownCounterObserver( + if heapReleased, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.heap_released", - metric.WithUnit(unit.Bytes), - metric.WithDescription("Bytes of idle spans whose physical memory has been returned to the OS"), + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("Bytes of idle spans whose physical memory has been returned to the OS"), ); err != nil { return err } - if heapSys, err = batchObserver.NewInt64UpDownCounterObserver( + if heapSys, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.heap_sys", - metric.WithUnit(unit.Bytes), - metric.WithDescription("Bytes of heap memory obtained from the OS"), + instrument.WithUnit(unit.Bytes), + instrument.WithDescription("Bytes of heap memory obtained from the OS"), ); err != nil { return err } - if ptrLookups, err = batchObserver.NewInt64CounterObserver( + if ptrLookups, err = r.meter.AsyncInt64().Counter( "process.runtime.go.mem.lookups", - metric.WithDescription("Number of pointer lookups performed by the runtime"), + instrument.WithDescription("Number of pointer lookups performed by the runtime"), ); err != nil { return err } - if liveObjects, err = batchObserver.NewInt64UpDownCounterObserver( + if liveObjects, err = r.meter.AsyncInt64().UpDownCounter( "process.runtime.go.mem.live_objects", - metric.WithDescription("Number of live objects is the number of cumulative Mallocs - Frees"), + instrument.WithDescription("Number of live objects is the number of cumulative Mallocs - Frees"), ); err != nil { return err } - if gcCount, err = batchObserver.NewInt64CounterObserver( + if gcCount, err = r.meter.AsyncInt64().Counter( "process.runtime.go.gc.count", - metric.WithDescription("Number of completed garbage collection cycles"), + instrument.WithDescription("Number of completed garbage collection cycles"), ); err != nil { return err } @@ -284,28 +262,68 @@ func (r *runtime) registerMemStats() error { // Note that the following could be derived as a sum of // individual pauses, but we may lose individual pauses if the // observation interval is too slow. - if pauseTotalNs, err = batchObserver.NewInt64CounterObserver( + if pauseTotalNs, err = r.meter.AsyncInt64().Counter( "process.runtime.go.gc.pause_total_ns", // TODO: nanoseconds units - metric.WithDescription("Cumulative nanoseconds in GC stop-the-world pauses since the program started"), + instrument.WithDescription("Cumulative nanoseconds in GC stop-the-world pauses since the program started"), ); err != nil { return err } - if gcPauseNs, err = r.meter.NewInt64Histogram( + if gcPauseNs, err = r.meter.SyncInt64().Histogram( "process.runtime.go.gc.pause_ns", // TODO: nanoseconds units - metric.WithDescription("Amount of nanoseconds in GC stop-the-world pauses"), + instrument.WithDescription("Amount of nanoseconds in GC stop-the-world pauses"), ); err != nil { return err } + err = r.meter.RegisterCallback( + []instrument.Asynchronous{ + heapAlloc, + heapIdle, + heapInuse, + heapObjects, + heapReleased, + heapSys, + liveObjects, + + ptrLookups, + + gcCount, + pauseTotalNs, + }, func(ctx context.Context) { + lock.Lock() + defer lock.Unlock() + + now := time.Now() + if now.Sub(lastMemStats) >= r.config.MinimumReadMemStatsInterval { + goruntime.ReadMemStats(&memStats) + lastMemStats = now + } + + heapAlloc.Observe(ctx, int64(memStats.HeapAlloc)) + heapIdle.Observe(ctx, int64(memStats.HeapIdle)) + heapInuse.Observe(ctx, int64(memStats.HeapInuse)) + heapObjects.Observe(ctx, int64(memStats.HeapObjects)) + heapReleased.Observe(ctx, int64(memStats.HeapReleased)) + heapSys.Observe(ctx, int64(memStats.HeapSys)) + liveObjects.Observe(ctx, int64(memStats.Mallocs-memStats.Frees)) + ptrLookups.Observe(ctx, int64(memStats.Lookups)) + gcCount.Observe(ctx, int64(memStats.NumGC)) + pauseTotalNs.Observe(ctx, int64(memStats.PauseTotalNs)) + + computeGCPauses(ctx, gcPauseNs, memStats.PauseNs[:], lastNumGC, memStats.NumGC) + + lastNumGC = memStats.NumGC + }) + return nil } func computeGCPauses( ctx context.Context, - recorder *metric.Int64Histogram, + recorder syncint64.Histogram, circular []uint64, lastNumGC, currentNumGC uint32, ) { @@ -337,7 +355,7 @@ func computeGCPauses( func recordGCPauses( ctx context.Context, - recorder *metric.Int64Histogram, + recorder syncint64.Histogram, pauses []uint64, ) { for _, pause := range pauses { diff --git a/instrumentation/runtime/runtime_test.go b/instrumentation/runtime/runtime_test.go index 572303f8341..0f3ede542b6 100644 --- a/instrumentation/runtime/runtime_test.go +++ b/instrumentation/runtime/runtime_test.go @@ -15,15 +15,12 @@ package runtime_test import ( - goruntime "runtime" "testing" "time" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "go.opentelemetry.io/contrib/instrumentation/runtime" - "go.opentelemetry.io/otel/metric/metrictest" ) func TestRuntime(t *testing.T) { @@ -34,64 +31,65 @@ func TestRuntime(t *testing.T) { time.Sleep(time.Second) } -func getGCCount(provider *metrictest.MeterProvider) int { - for _, b := range provider.MeasurementBatches { - for _, m := range b.Measurements { - if m.Instrument.Descriptor().Name() == "process.runtime.go.gc.count" { - return int(m.Number.CoerceToInt64(m.Instrument.Descriptor().NumberKind())) - } - } - } - panic("Could not locate a process.runtime.go.gc.count metric in test output") -} +// TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 +// func getGCCount(provider *metrictest.MeterProvider) int { +// for _, b := range provider.MeasurementBatches { +// for _, m := range b.Measurements { +// if m.Instrument.Descriptor().Name() == "process.runtime.go.gc.count" { +// return int(m.Number.CoerceToInt64(m.Instrument.Descriptor().NumberKind())) +// } +// } +// } +// panic("Could not locate a process.runtime.go.gc.count metric in test output") +// } -func testMinimumInterval(t *testing.T, shouldHappen bool, opts ...runtime.Option) { - goruntime.GC() +// func testMinimumInterval(t *testing.T, shouldHappen bool, opts ...runtime.Option) { +// goruntime.GC() - var mstats0 goruntime.MemStats - goruntime.ReadMemStats(&mstats0) - baseline := int(mstats0.NumGC) +// var mstats0 goruntime.MemStats +// goruntime.ReadMemStats(&mstats0) +// baseline := int(mstats0.NumGC) - provider := metrictest.NewMeterProvider() +// provider := metrictest.NewMeterProvider() - err := runtime.Start( - append( - opts, - runtime.WithMeterProvider(provider), - )..., - ) - assert.NoError(t, err) +// err := runtime.Start( +// append( +// opts, +// runtime.WithMeterProvider(provider), +// )..., +// ) +// assert.NoError(t, err) - goruntime.GC() +// goruntime.GC() - provider.RunAsyncInstruments() +// provider.RunAsyncInstruments() - require.Equal(t, 1, getGCCount(provider)-baseline) +// require.Equal(t, 1, getGCCount(provider)-baseline) - provider.MeasurementBatches = nil +// provider.MeasurementBatches = nil - extra := 0 - if shouldHappen { - extra = 3 - } +// extra := 0 +// if shouldHappen { +// extra = 3 +// } - goruntime.GC() - goruntime.GC() - goruntime.GC() +// goruntime.GC() +// goruntime.GC() +// goruntime.GC() - provider.RunAsyncInstruments() +// provider.RunAsyncInstruments() - require.Equal(t, 1+extra, getGCCount(provider)-baseline) -} +// require.Equal(t, 1+extra, getGCCount(provider)-baseline) +// } -func TestDefaultMinimumInterval(t *testing.T) { - testMinimumInterval(t, false) -} +// func TestDefaultMinimumInterval(t *testing.T) { +// testMinimumInterval(t, false) +// } -func TestNoMinimumInterval(t *testing.T) { - testMinimumInterval(t, true, runtime.WithMinimumReadMemStatsInterval(0)) -} +// func TestNoMinimumInterval(t *testing.T) { +// testMinimumInterval(t, true, runtime.WithMinimumReadMemStatsInterval(0)) +// } -func TestExplicitMinimumInterval(t *testing.T) { - testMinimumInterval(t, false, runtime.WithMinimumReadMemStatsInterval(time.Hour)) -} +// func TestExplicitMinimumInterval(t *testing.T) { +// testMinimumInterval(t, false, runtime.WithMinimumReadMemStatsInterval(time.Hour)) +// } From 51873c95b33b4e17b3e728f1f8045b32338e19f4 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 16:20:26 +0000 Subject: [PATCH 06/10] Upgrade examples to new version of trace api/sdk --- .../astaxie/beego/otelbeego/example/go.mod | 8 ++--- .../astaxie/beego/otelbeego/example/go.sum | 28 +++++++-------- .../aws-lambda-go/otellambda/example/go.mod | 6 ++-- .../aws-lambda-go/otellambda/example/go.sum | 24 ++++++------- .../gocql/gocql/otelgocql/example/go.mod | 12 +++---- .../gocql/gocql/otelgocql/example/go.sum | 36 +++++++++---------- instrumentation/host/example/go.mod | 6 ++-- instrumentation/host/example/go.sum | 31 ++++++++-------- .../httptrace/otelhttptrace/example/go.mod | 8 ++--- .../httptrace/otelhttptrace/example/go.sum | 25 +++++++------ .../net/http/otelhttp/example/go.mod | 8 ++--- .../net/http/otelhttp/example/go.sum | 28 +++++++-------- instrumentation/runtime/example/go.mod | 6 ++-- instrumentation/runtime/example/go.sum | 30 ++++++++-------- instrumentation/runtime/go.mod | 1 - instrumentation/runtime/go.sum | 6 ---- 16 files changed, 119 insertions(+), 144 deletions(-) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod index ac11748e3c4..59020a2a4e0 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod @@ -12,8 +12,8 @@ replace ( require ( github.com/astaxie/beego v1.12.3 go.opentelemetry.io/contrib/instrumentation/github.com/astaxie/beego/otelbeego v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum index 794fd403927..ba35e146017 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum @@ -43,8 +43,9 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -139,7 +140,6 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= @@ -147,20 +147,16 @@ github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2K github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 h1:/Lu2JuL9Mb+B+kSv/RsDMgA/5FaBaxfyfMnICFepiBs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0/go.mod h1:5gUXICq93HyDh8Rij7p8ilJEC1Sqk0u3lSGs62i8hJQ= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= -go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 h1:1idGnMzWHpSp7HwPs+fkyhisQBp+JsLCHa2RIB6P+l8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0/go.mod h1:itLJK+HwfvBpkUm7MYCK6usGbAlk2YRQkJzvFhk8QRc= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod index ecb83830395..30cd217e8c0 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.mod @@ -17,9 +17,9 @@ require ( go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-lambda-go/otellambda v0.30.0 go.opentelemetry.io/contrib/instrumentation/github.com/aws/aws-sdk-go-v2/otelaws v0.30.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect ) diff --git a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum index 993670146e2..85167565328 100644 --- a/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum +++ b/instrumentation/github.com/aws/aws-lambda-go/otellambda/example/go.sum @@ -44,8 +44,9 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -64,20 +65,19 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 h1:/Lu2JuL9Mb+B+kSv/RsDMgA/5FaBaxfyfMnICFepiBs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0/go.mod h1:5gUXICq93HyDh8Rij7p8ilJEC1Sqk0u3lSGs62i8hJQ= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 h1:1idGnMzWHpSp7HwPs+fkyhisQBp+JsLCHa2RIB6P+l8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0/go.mod h1:itLJK+HwfvBpkUm7MYCK6usGbAlk2YRQkJzvFhk8QRc= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod index adb114ec982..60e62008084 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod @@ -10,11 +10,11 @@ replace ( require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/prometheus v0.27.0 - go.opentelemetry.io/otel/exporters/zipkin v1.5.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/prometheus v0.28.0 + go.opentelemetry.io/otel/exporters/zipkin v1.6.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum index 6606a0238f7..b58c916ebfd 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum @@ -90,8 +90,9 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -277,25 +278,20 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/exporters/prometheus v0.27.0 h1:HcGi6HmYRuszR3stcvN2GctJjQtvp44nw/VdfJCo/Ec= -go.opentelemetry.io/otel/exporters/prometheus v0.27.0/go.mod h1:u0vTzijx2B6gGDa8FuIVoESW6z0HdKkXZWZMSTsoJKs= -go.opentelemetry.io/otel/exporters/zipkin v1.5.0 h1:dtRupRULnVF1WTnQh2hVOoOjkpqSH+Qql8c52TaiZ6Y= -go.opentelemetry.io/otel/exporters/zipkin v1.5.0/go.mod h1:Y85jVCuCVDnibnmDaBzRz6ou2vL2dSjUXePIZRZ5mcA= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.4.0/go.mod h1:71GJPNJh4Qju6zJuYl1CrYtXbrgfau/M9UAggqiy1UE= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= -go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/sdk/metric v0.27.0 h1:CDEu96Js5IP7f4bJ8eimxF09V5hKYmE7CeyKSjmAL1s= -go.opentelemetry.io/otel/sdk/metric v0.27.0/go.mod h1:lOgrT5C3ORdbqp2LsDrx+pBj6gbZtQ5Omk27vH3EaW0= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/prometheus v0.28.0 h1:6JY0KEQC1WKOjEFu5QJqz+H0kZ51c/lPiudkxGzwaQg= +go.opentelemetry.io/otel/exporters/prometheus v0.28.0/go.mod h1:nN2uGmk/rLmcbPTaZakIMqYH2Q0T8V1sOnKOHe/HLH0= +go.opentelemetry.io/otel/exporters/zipkin v1.6.0 h1:YJS6mqPm5Xxo4IfZIVFGzE/ad3xGRHUdzsFh4gUKf8k= +go.opentelemetry.io/otel/exporters/zipkin v1.6.0/go.mod h1:Jc+mWZfNCTYkHkFkOtVary++qVrmeJX1EZVj9+4Uwrc= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= +go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/instrumentation/host/example/go.mod b/instrumentation/host/example/go.mod index 7cd48e9eca2..f3b964624f3 100644 --- a/instrumentation/host/example/go.mod +++ b/instrumentation/host/example/go.mod @@ -9,7 +9,7 @@ replace ( require ( go.opentelemetry.io/contrib/instrumentation/host v0.30.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/instrumentation/host/example/go.sum b/instrumentation/host/example/go.sum index c1fa972df93..a87da4f6c45 100644 --- a/instrumentation/host/example/go.sum +++ b/instrumentation/host/example/go.sum @@ -2,8 +2,9 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -29,22 +30,18 @@ github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2bi github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg= github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 h1:GMNns6UpdYhxcBgK1Z4qBvG9knRBGBFoe/alvaaBBeI= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0/go.mod h1:2T1VrynTXNdK4uB/hHqnvjTYL09wJWDGp8sOcJIMqjA= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.4.0 h1:LJE4SW3jd4lQTESnlpQZcBhQ3oci0U2MLR5uhicfTHQ= -go.opentelemetry.io/otel/sdk v1.4.0/go.mod h1:71GJPNJh4Qju6zJuYl1CrYtXbrgfau/M9UAggqiy1UE= -go.opentelemetry.io/otel/sdk/metric v0.27.0 h1:CDEu96Js5IP7f4bJ8eimxF09V5hKYmE7CeyKSjmAL1s= -go.opentelemetry.io/otel/sdk/metric v0.27.0/go.mod h1:lOgrT5C3ORdbqp2LsDrx+pBj6gbZtQ5Omk27vH3EaW0= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 h1:ML6aEhlJAhSkPxVPS/3zkRcQOdYRiul8FDXcwL/KnpI= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0/go.mod h1:8JL8qoBinVMmTsd57ekSmuRf4nDQPttgO6MUKzKaLII= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= +go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod index 335005aa741..95f89b39cc6 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod @@ -11,8 +11,8 @@ replace ( require ( go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.30.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum index 0661111a52a..388952d9a1c 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum @@ -2,8 +2,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -14,20 +15,18 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 h1:/Lu2JuL9Mb+B+kSv/RsDMgA/5FaBaxfyfMnICFepiBs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0/go.mod h1:5gUXICq93HyDh8Rij7p8ilJEC1Sqk0u3lSGs62i8hJQ= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= -go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 h1:1idGnMzWHpSp7HwPs+fkyhisQBp+JsLCHa2RIB6P+l8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0/go.mod h1:itLJK+HwfvBpkUm7MYCK6usGbAlk2YRQkJzvFhk8QRc= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/instrumentation/net/http/otelhttp/example/go.mod b/instrumentation/net/http/otelhttp/example/go.mod index 8ebcd1c3176..239396a9319 100644 --- a/instrumentation/net/http/otelhttp/example/go.mod +++ b/instrumentation/net/http/otelhttp/example/go.mod @@ -9,8 +9,8 @@ replace ( require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.30.0 - go.opentelemetry.io/otel v1.5.0 - go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 - go.opentelemetry.io/otel/sdk v1.5.0 - go.opentelemetry.io/otel/trace v1.5.0 + go.opentelemetry.io/otel v1.6.0 + go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 + go.opentelemetry.io/otel/sdk v1.6.0 + go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/net/http/otelhttp/example/go.sum b/instrumentation/net/http/otelhttp/example/go.sum index 0661111a52a..5121ab2c3b5 100644 --- a/instrumentation/net/http/otelhttp/example/go.sum +++ b/instrumentation/net/http/otelhttp/example/go.sum @@ -2,8 +2,9 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -11,23 +12,18 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel v1.5.0 h1:DhCU8oR2sJH9rfnwPdoV/+BJ7UIN5kXHL8DuSGrPU8E= -go.opentelemetry.io/otel v1.5.0/go.mod h1:Jm/m+rNp/z0eqJc74H7LPwQ3G87qkU/AnnAydAjSAHk= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0 h1:/Lu2JuL9Mb+B+kSv/RsDMgA/5FaBaxfyfMnICFepiBs= -go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.5.0/go.mod h1:5gUXICq93HyDh8Rij7p8ilJEC1Sqk0u3lSGs62i8hJQ= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.5.0 h1:QKhWBbcOC9fDCZKCfPFjWTWpfIlJR+i9xiUDYrLVmZs= -go.opentelemetry.io/otel/sdk v1.5.0/go.mod h1:CU4J1v+7iEljnm1G14QjdFWOXUyYLHVh0Lh+/BTYyFg= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= -go.opentelemetry.io/otel/trace v1.5.0 h1:AKQZ9zJsBRFAp7zLdyGNkqG2rToCDIt3i5tcLzQlbmU= -go.opentelemetry.io/otel/trace v1.5.0/go.mod h1:sq55kfhjXYr1zVSyexg0w1mpa03AYXR5eyTkB9NPPdE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0 h1:1idGnMzWHpSp7HwPs+fkyhisQBp+JsLCHa2RIB6P+l8= +go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.6.0/go.mod h1:itLJK+HwfvBpkUm7MYCK6usGbAlk2YRQkJzvFhk8QRc= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/instrumentation/runtime/example/go.mod b/instrumentation/runtime/example/go.mod index 89ea583c996..611ad9d2cbf 100644 --- a/instrumentation/runtime/example/go.mod +++ b/instrumentation/runtime/example/go.mod @@ -9,8 +9,8 @@ replace ( require ( go.opentelemetry.io/contrib/instrumentation/runtime v0.30.0 - go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 - go.opentelemetry.io/otel/metric v0.27.0 - go.opentelemetry.io/otel/sdk/metric v0.27.0 + go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 + go.opentelemetry.io/otel/metric v0.28.0 + go.opentelemetry.io/otel/sdk/metric v0.28.0 golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect ) diff --git a/instrumentation/runtime/example/go.sum b/instrumentation/runtime/example/go.sum index 0f4b80f65d7..c838f4be572 100644 --- a/instrumentation/runtime/example/go.sum +++ b/instrumentation/runtime/example/go.sum @@ -2,8 +2,9 @@ github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= @@ -11,23 +12,20 @@ github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -go.opentelemetry.io/otel v1.4.0 h1:7ESuKPq6zpjRaY5nvVDGiuwK7VAJ8MwkKnmNJ9whNZ4= -go.opentelemetry.io/otel v1.4.0/go.mod h1:jeAqMFKy2uLIxCtKxoFj0FAL5zAPKQagc3+GtBWakzk= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0 h1:GMNns6UpdYhxcBgK1Z4qBvG9knRBGBFoe/alvaaBBeI= -go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.27.0/go.mod h1:2T1VrynTXNdK4uB/hHqnvjTYL09wJWDGp8sOcJIMqjA= -go.opentelemetry.io/otel/internal/metric v0.27.0 h1:9dAVGAfFiiEq5NVB9FUJ5et+btbDQAUIJehJ+ikyryk= -go.opentelemetry.io/otel/internal/metric v0.27.0/go.mod h1:n1CVxRqKqYZtqyTh9U/onvKapPGv7y/rpyOTI+LFNzw= -go.opentelemetry.io/otel/metric v0.27.0 h1:HhJPsGhJoKRSegPQILFbODU56NS/L1UE4fS1sC5kIwQ= -go.opentelemetry.io/otel/metric v0.27.0/go.mod h1:raXDJ7uP2/Jc0nVZWQjJtzoyssOYWu/+pjZqRzfvZ7g= -go.opentelemetry.io/otel/sdk v1.4.0 h1:LJE4SW3jd4lQTESnlpQZcBhQ3oci0U2MLR5uhicfTHQ= -go.opentelemetry.io/otel/sdk v1.4.0/go.mod h1:71GJPNJh4Qju6zJuYl1CrYtXbrgfau/M9UAggqiy1UE= -go.opentelemetry.io/otel/sdk/metric v0.27.0 h1:CDEu96Js5IP7f4bJ8eimxF09V5hKYmE7CeyKSjmAL1s= -go.opentelemetry.io/otel/sdk/metric v0.27.0/go.mod h1:lOgrT5C3ORdbqp2LsDrx+pBj6gbZtQ5Omk27vH3EaW0= -go.opentelemetry.io/otel/trace v1.4.0 h1:4OOUrPZdVFQkbzl/JSdvGCWIdw5ONXXxzHlaLlWppmo= -go.opentelemetry.io/otel/trace v1.4.0/go.mod h1:uc3eRsqDfWs9R7b92xbQbU42/eTNz4N+gLP8qJCi4aE= +go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= +go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0 h1:ML6aEhlJAhSkPxVPS/3zkRcQOdYRiul8FDXcwL/KnpI= +go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.28.0/go.mod h1:8JL8qoBinVMmTsd57ekSmuRf4nDQPttgO6MUKzKaLII= +go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= +go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= +go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= +go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= +go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= +go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= +go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= +go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/instrumentation/runtime/go.mod b/instrumentation/runtime/go.mod index 0c168192714..b04f11e36b7 100644 --- a/instrumentation/runtime/go.mod +++ b/instrumentation/runtime/go.mod @@ -7,5 +7,4 @@ replace go.opentelemetry.io/contrib => ../.. require ( github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel/metric v0.28.0 - go.opentelemetry.io/otel/sdk/metric v0.28.0 ) diff --git a/instrumentation/runtime/go.sum b/instrumentation/runtime/go.sum index 18f67fc0a66..c5c392f36a3 100644 --- a/instrumentation/runtime/go.sum +++ b/instrumentation/runtime/go.sum @@ -1,4 +1,3 @@ -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -17,13 +16,8 @@ go.opentelemetry.io/otel v1.6.0 h1:YV6GkGe/Ag2PKsm4rjlqdSNs0w0A5ZzxeGkxhx1T+t4= go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ= go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs2etWAQ= go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= -go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= -go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= -go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= -go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From f0a8a7d54a1df772febc33a8744e2fbccaa00031 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 16:39:59 +0000 Subject: [PATCH 07/10] fix linting errors --- .../gocql/gocql/otelgocql/test/go.mod | 1 - .../gocql/gocql/otelgocql/test/go.sum | 3 - .../gocql/gocql/otelgocql/test/gocql_test.go | 376 +++++++++--------- instrumentation/host/go.mod | 1 - instrumentation/host/go.sum | 1 - instrumentation/host/host.go | 4 + instrumentation/host/host_test.go | 77 ++-- instrumentation/net/http/otelhttp/test/go.mod | 1 - instrumentation/net/http/otelhttp/test/go.sum | 3 - .../net/http/otelhttp/test/handler_test.go | 11 +- instrumentation/runtime/runtime.go | 10 +- 11 files changed, 240 insertions(+), 248 deletions(-) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod index cd54b6d2f61..6fab4a80bbf 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod @@ -9,7 +9,6 @@ require ( go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.30.0 go.opentelemetry.io/otel v1.6.0 go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum index 944205aa9bc..425f89d1419 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum @@ -1,4 +1,3 @@ -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932 h1:mXoPYz/Ul5HYEDvkta6I8/rnYM5gSdSV2tJ6XbZuEtY= github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= @@ -38,8 +37,6 @@ go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= -go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= -go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go index f6fdbc6c6a1..ddd53f85418 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go @@ -30,8 +30,6 @@ import ( "go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql/internal" "go.opentelemetry.io/contrib/internal/util" "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/sdk/metric/metrictest" - "go.opentelemetry.io/otel/sdk/metric/number" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" semconv "go.opentelemetry.io/otel/semconv/v1.7.0" @@ -51,20 +49,20 @@ func (m *mockConnectObserver) ObserveConnect(observedConnect gocql.ObservedConne m.callCount++ } -type testRecord struct { - name string - meterName string - attributes []attribute.KeyValue - number number.Number - numberKind number.Kind -} +// type testRecord struct { +// name string +// meterName string +// attributes []attribute.KeyValue +// number number.Number +// numberKind number.Kind +// } func TestQuery(t *testing.T) { defer afterEach() cluster := getCluster() sr := tracetest.NewSpanRecorder() tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - meterProvider := metrictest.NewMeterProvider() + // meterProvider := metrictest.NewMeterProvider() ctx, parentSpan := tracerProvider.Tracer(internal.InstrumentationName).Start(context.Background(), "gocql-test") @@ -72,7 +70,7 @@ func TestQuery(t *testing.T) { ctx, cluster, otelgocql.WithTracerProvider(tracerProvider), - otelgocql.WithMeterProvider(meterProvider), + // otelgocql.WithMeterProvider(meterProvider), otelgocql.WithConnectInstrumentation(false), ) require.NoError(t, err) @@ -110,70 +108,70 @@ func TestQuery(t *testing.T) { assertConnectionLevelAttributes(t, span) } - // Check metrics - actual := obtainTestRecords(meterProvider.MeasurementBatches) - require.Len(t, actual, 3) - expected := []testRecord{ - { - name: "db.cassandra.queries", - meterName: internal.InstrumentationName, - attributes: []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - internal.CassStatement(insertStmt), - }, - number: 1, - }, - { - name: "db.cassandra.rows", - meterName: internal.InstrumentationName, - attributes: []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, - number: 0, - }, - { - name: "db.cassandra.latency", - meterName: internal.InstrumentationName, - attributes: []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, - }, - } - - for _, record := range actual { - switch record.name { - case "db.cassandra.queries": - recordEqual(t, expected[0], record) - assert.Equal(t, expected[0].number, record.number) - case "db.cassandra.rows": - recordEqual(t, expected[1], record) - assert.Equal(t, expected[1].number, record.number) - case "db.cassandra.latency": - recordEqual(t, expected[2], record) - // The latency will vary, so just check that it exists - assert.True(t, !record.number.IsZero(record.numberKind)) - default: - t.Fatalf("wrong metric %s", record.name) - } - } + // // Check metrics + // actual := obtainTestRecords(meterProvider.MeasurementBatches) + // require.Len(t, actual, 3) + // expected := []testRecord{ + // { + // name: "db.cassandra.queries", + // meterName: internal.InstrumentationName, + // attributes: []attribute.KeyValue{ + // internal.CassDBSystem(), + // internal.CassPeerIP("127.0.0.1"), + // internal.CassPeerPort(9042), + // internal.CassVersion("3"), + // internal.CassHostID("test-id"), + // internal.CassHostState("UP"), + // internal.CassKeyspace(keyspace), + // internal.CassStatement(insertStmt), + // }, + // number: 1, + // }, + // { + // name: "db.cassandra.rows", + // meterName: internal.InstrumentationName, + // attributes: []attribute.KeyValue{ + // internal.CassDBSystem(), + // internal.CassPeerIP("127.0.0.1"), + // internal.CassPeerPort(9042), + // internal.CassVersion("3"), + // internal.CassHostID("test-id"), + // internal.CassHostState("UP"), + // internal.CassKeyspace(keyspace), + // }, + // number: 0, + // }, + // { + // name: "db.cassandra.latency", + // meterName: internal.InstrumentationName, + // attributes: []attribute.KeyValue{ + // internal.CassDBSystem(), + // internal.CassPeerIP("127.0.0.1"), + // internal.CassPeerPort(9042), + // internal.CassVersion("3"), + // internal.CassHostID("test-id"), + // internal.CassHostState("UP"), + // internal.CassKeyspace(keyspace), + // }, + // }, + // } + + // for _, record := range actual { + // switch record.name { + // case "db.cassandra.queries": + // recordEqual(t, expected[0], record) + // assert.Equal(t, expected[0].number, record.number) + // case "db.cassandra.rows": + // recordEqual(t, expected[1], record) + // assert.Equal(t, expected[1].number, record.number) + // case "db.cassandra.latency": + // recordEqual(t, expected[2], record) + // // The latency will vary, so just check that it exists + // assert.True(t, !record.number.IsZero(record.numberKind)) + // default: + // t.Fatalf("wrong metric %s", record.name) + // } + // } } @@ -182,7 +180,7 @@ func TestBatch(t *testing.T) { cluster := getCluster() sr := tracetest.NewSpanRecorder() tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - meterProvider := metrictest.NewMeterProvider() + // meterProvider := metrictest.NewMeterProvider() ctx, parentSpan := tracerProvider.Tracer(internal.InstrumentationName).Start(context.Background(), "gocql-test") @@ -190,7 +188,7 @@ func TestBatch(t *testing.T) { ctx, cluster, otelgocql.WithTracerProvider(tracerProvider), - otelgocql.WithMeterProvider(meterProvider), + // otelgocql.WithMeterProvider(meterProvider), otelgocql.WithConnectInstrumentation(false), ) require.NoError(t, err) @@ -221,51 +219,51 @@ func TestBatch(t *testing.T) { assertConnectionLevelAttributes(t, span) } - // Check metrics - actual := obtainTestRecords(meterProvider.MeasurementBatches) - require.Len(t, actual, 2) - expected := []testRecord{ - { - name: "db.cassandra.batch.queries", - meterName: internal.InstrumentationName, - attributes: []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, - number: 1, - }, - { - name: "db.cassandra.latency", - meterName: internal.InstrumentationName, - attributes: []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - internal.CassKeyspace(keyspace), - }, - }, - } - - for _, record := range actual { - switch record.name { - case "db.cassandra.batch.queries": - recordEqual(t, expected[0], record) - assert.Equal(t, expected[0].number, record.number) - case "db.cassandra.latency": - recordEqual(t, expected[1], record) - assert.True(t, !record.number.IsZero(record.numberKind)) - default: - t.Fatalf("wrong metric %s", record.name) - } - } + // // Check metrics + // actual := obtainTestRecords(meterProvider.MeasurementBatches) + // require.Len(t, actual, 2) + // expected := []testRecord{ + // { + // name: "db.cassandra.batch.queries", + // meterName: internal.InstrumentationName, + // attributes: []attribute.KeyValue{ + // internal.CassDBSystem(), + // internal.CassPeerIP("127.0.0.1"), + // internal.CassPeerPort(9042), + // internal.CassVersion("3"), + // internal.CassHostID("test-id"), + // internal.CassHostState("UP"), + // internal.CassKeyspace(keyspace), + // }, + // number: 1, + // }, + // { + // name: "db.cassandra.latency", + // meterName: internal.InstrumentationName, + // attributes: []attribute.KeyValue{ + // internal.CassDBSystem(), + // internal.CassPeerIP("127.0.0.1"), + // internal.CassPeerPort(9042), + // internal.CassVersion("3"), + // internal.CassHostID("test-id"), + // internal.CassHostState("UP"), + // internal.CassKeyspace(keyspace), + // }, + // }, + // } + + // for _, record := range actual { + // switch record.name { + // case "db.cassandra.batch.queries": + // recordEqual(t, expected[0], record) + // assert.Equal(t, expected[0].number, record.number) + // case "db.cassandra.latency": + // recordEqual(t, expected[1], record) + // assert.True(t, !record.number.IsZero(record.numberKind)) + // default: + // t.Fatalf("wrong metric %s", record.name) + // } + // } } @@ -274,7 +272,7 @@ func TestConnection(t *testing.T) { cluster := getCluster() sr := tracetest.NewSpanRecorder() tracerProvider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(sr)) - meterProvider := metrictest.NewMeterProvider() + // meterProvider := metrictest.NewMeterProvider() connectObserver := &mockConnectObserver{0} ctx := context.Background() @@ -282,7 +280,7 @@ func TestConnection(t *testing.T) { ctx, cluster, otelgocql.WithTracerProvider(tracerProvider), - otelgocql.WithMeterProvider(meterProvider), + // otelgocql.WithMeterProvider(meterProvider), otelgocql.WithConnectObserver(connectObserver), ) require.NoError(t, err) @@ -300,31 +298,31 @@ func TestConnection(t *testing.T) { assertConnectionLevelAttributes(t, span) } - // Verify the metrics - actual := obtainTestRecords(meterProvider.MeasurementBatches) - expected := []testRecord{ - { - name: "db.cassandra.connections", - meterName: internal.InstrumentationName, - attributes: []attribute.KeyValue{ - internal.CassDBSystem(), - internal.CassPeerIP("127.0.0.1"), - internal.CassPeerPort(9042), - internal.CassVersion("3"), - internal.CassHostID("test-id"), - internal.CassHostState("UP"), - }, - }, - } - - for _, record := range actual { - switch record.name { - case "db.cassandra.connections": - recordEqual(t, expected[0], record) - default: - t.Fatalf("wrong metric %s", record.name) - } - } + // // Verify the metrics + // actual := obtainTestRecords(meterProvider.MeasurementBatches) + // expected := []testRecord{ + // { + // name: "db.cassandra.connections", + // meterName: internal.InstrumentationName, + // attributes: []attribute.KeyValue{ + // internal.CassDBSystem(), + // internal.CassPeerIP("127.0.0.1"), + // internal.CassPeerPort(9042), + // internal.CassVersion("3"), + // internal.CassHostID("test-id"), + // internal.CassHostState("UP"), + // }, + // }, + // } + + // for _, record := range actual { + // switch record.name { + // case "db.cassandra.connections": + // recordEqual(t, expected[0], record) + // default: + // t.Fatalf("wrong metric %s", record.name) + // } + // } } func TestHostOrIP(t *testing.T) { @@ -369,46 +367,46 @@ func getCluster() *gocql.ClusterConfig { return cluster } -// obtainTestRecords creates a slice of testRecord with values -// obtained from measurements -func obtainTestRecords(mbs []metrictest.Batch) []testRecord { - var records []testRecord - for _, mb := range mbs { - for _, m := range mb.Measurements { - records = append( - records, - testRecord{ - name: m.Instrument.Descriptor().Name(), - meterName: mb.Library.InstrumentationName, - attributes: mb.Labels, - number: m.Number, - numberKind: m.Instrument.Descriptor().NumberKind(), - }, - ) - } - } - - return records -} - -// recordEqual checks that the given metric name and instrumentation names are equal. -func recordEqual(t *testing.T, expected testRecord, actual testRecord) { - assert.Equal(t, expected.name, actual.name) - assert.Equal(t, expected.meterName, actual.meterName) - require.Len(t, actual.attributes, len(expected.attributes)) - actualSet := attribute.NewSet(actual.attributes...) - for _, attribute := range expected.attributes { - actualValue, ok := actualSet.Value(attribute.Key) - assert.True(t, ok) - assert.NotNil(t, actualValue) - // Can't test equality of host id - if attribute.Key != internal.CassHostIDKey && attribute.Key != internal.CassVersionKey { - assert.Equal(t, attribute.Value, actualValue) - } else { - assert.NotEmpty(t, actualValue) - } - } -} +// // obtainTestRecords creates a slice of testRecord with values +// // obtained from measurements +// func obtainTestRecords(mbs []metrictest.Batch) []testRecord { +// var records []testRecord +// for _, mb := range mbs { +// for _, m := range mb.Measurements { +// records = append( +// records, +// testRecord{ +// name: m.Instrument.Descriptor().Name(), +// meterName: mb.Library.InstrumentationName, +// attributes: mb.Labels, +// number: m.Number, +// numberKind: m.Instrument.Descriptor().NumberKind(), +// }, +// ) +// } +// } + +// return records +// } + +// // recordEqual checks that the given metric name and instrumentation names are equal. +// func recordEqual(t *testing.T, expected testRecord, actual testRecord) { +// assert.Equal(t, expected.name, actual.name) +// assert.Equal(t, expected.meterName, actual.meterName) +// require.Len(t, actual.attributes, len(expected.attributes)) +// actualSet := attribute.NewSet(actual.attributes...) +// for _, attribute := range expected.attributes { +// actualValue, ok := actualSet.Value(attribute.Key) +// assert.True(t, ok) +// assert.NotNil(t, actualValue) +// // Can't test equality of host id +// if attribute.Key != internal.CassHostIDKey && attribute.Key != internal.CassVersionKey { +// assert.Equal(t, attribute.Value, actualValue) +// } else { +// assert.NotEmpty(t, actualValue) +// } +// } +// } // beforeAll creates the testing keyspace and table if they do not already exist. func beforeAll() { diff --git a/instrumentation/host/go.mod b/instrumentation/host/go.mod index 441cac71751..a99934f1f65 100644 --- a/instrumentation/host/go.mod +++ b/instrumentation/host/go.mod @@ -4,7 +4,6 @@ go 1.16 require ( github.com/shirou/gopsutil/v3 v3.22.2 - github.com/stretchr/testify v1.7.1 go.opentelemetry.io/otel v1.6.0 go.opentelemetry.io/otel/metric v0.28.0 golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect diff --git a/instrumentation/host/go.sum b/instrumentation/host/go.sum index 021387363f3..2a1f6df624d 100644 --- a/instrumentation/host/go.sum +++ b/instrumentation/host/go.sum @@ -42,7 +42,6 @@ golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxF golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/instrumentation/host/host.go b/instrumentation/host/host.go index 6084b228614..5255ce1b460 100644 --- a/instrumentation/host/host.go +++ b/instrumentation/host/host.go @@ -285,5 +285,9 @@ func (h *host) register() error { networkIOUsage.Observe(ctx, int64(ioStats[0].BytesRecv), AttributeNetworkReceive...) }) + if err != nil { + return err + } + return nil } diff --git a/instrumentation/host/host_test.go b/instrumentation/host/host_test.go index 015428135ed..1dbb6d8e81c 100644 --- a/instrumentation/host/host_test.go +++ b/instrumentation/host/host_test.go @@ -14,13 +14,6 @@ package host_test -import ( - gonet "net" - "testing" - - "github.com/stretchr/testify/require" -) - // TODO Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // func getMetric(provider *metrictest.MeterProvider, name string, lbl attribute.KeyValue) float64 { // for _, b := range provider.MeasurementBatches { @@ -155,41 +148,41 @@ import ( // } // } -func sendBytes(t *testing.T, count int) error { - conn1, err := gonet.ListenPacket("udp", "127.0.0.1:0") - if err != nil { - return err - } - defer conn1.Close() - - conn2, err := gonet.ListenPacket("udp", "127.0.0.1:0") - if err != nil { - return err - } - defer conn2.Close() - - data1 := make([]byte, 1000) - data2 := make([]byte, 1000) - for i := range data1 { - data1[i] = byte(i) - } - - for ; count > 0; count -= len(data1) { - _, err = conn1.WriteTo(data1, conn2.LocalAddr()) - if err != nil { - return err - } - _, readAddr, err := conn2.ReadFrom(data2) - if err != nil { - return err - } - - require.Equal(t, "udp", readAddr.Network()) - require.Equal(t, conn1.LocalAddr().String(), readAddr.String()) - } - - return nil -} +// func sendBytes(t *testing.T, count int) error { +// conn1, err := gonet.ListenPacket("udp", "127.0.0.1:0") +// if err != nil { +// return err +// } +// defer conn1.Close() + +// conn2, err := gonet.ListenPacket("udp", "127.0.0.1:0") +// if err != nil { +// return err +// } +// defer conn2.Close() + +// data1 := make([]byte, 1000) +// data2 := make([]byte, 1000) +// for i := range data1 { +// data1[i] = byte(i) +// } + +// for ; count > 0; count -= len(data1) { +// _, err = conn1.WriteTo(data1, conn2.LocalAddr()) +// if err != nil { +// return err +// } +// _, readAddr, err := conn2.ReadFrom(data2) +// if err != nil { +// return err +// } + +// require.Equal(t, "udp", readAddr.Network()) +// require.Equal(t, conn1.LocalAddr().String(), readAddr.String()) +// } + +// return nil +// } // TODO Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // func TestHostNetwork(t *testing.T) { diff --git a/instrumentation/net/http/otelhttp/test/go.mod b/instrumentation/net/http/otelhttp/test/go.mod index 8f95ee75f00..4e4a86ff3b3 100644 --- a/instrumentation/net/http/otelhttp/test/go.mod +++ b/instrumentation/net/http/otelhttp/test/go.mod @@ -8,7 +8,6 @@ require ( go.opentelemetry.io/otel v1.6.0 go.opentelemetry.io/otel/metric v0.28.0 go.opentelemetry.io/otel/sdk v1.6.0 - go.opentelemetry.io/otel/sdk/metric v0.28.0 go.opentelemetry.io/otel/trace v1.6.0 ) diff --git a/instrumentation/net/http/otelhttp/test/go.sum b/instrumentation/net/http/otelhttp/test/go.sum index c3aa1140861..c41655beb60 100644 --- a/instrumentation/net/http/otelhttp/test/go.sum +++ b/instrumentation/net/http/otelhttp/test/go.sum @@ -1,4 +1,3 @@ -github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= @@ -21,8 +20,6 @@ go.opentelemetry.io/otel/metric v0.28.0 h1:o5YNh+jxACMODoAo1bI7OES0RUW4jAMae0Vgs go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw= go.opentelemetry.io/otel/sdk v1.6.0 h1:JoriAoiNENuxxIQApR1O0k2h1Md5QegZhbentcRJpWk= go.opentelemetry.io/otel/sdk v1.6.0/go.mod h1:PjLRUfDsoPy0zl7yrDGSUqjj43tL7rEtFdCEiGlxXRM= -go.opentelemetry.io/otel/sdk/metric v0.28.0 h1:+1ndwHSiknwZtC8VmXM3xtMsd6kbFxtqti4qevn2J+o= -go.opentelemetry.io/otel/sdk/metric v0.28.0/go.mod h1:DqJmT0ovBgoW6TJ8CAQyTnwxZPIp3KWtCiDDZ1uHAzU= go.opentelemetry.io/otel/trace v1.6.0 h1:NDzPermp9ISkhxIaJXjBTi2O60xOSHDHP/EezjOL2wo= go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7 h1:iGu644GcxtEcrInvDsQRCwJjtCIOlT2V7IRt6ah2Whw= diff --git a/instrumentation/net/http/otelhttp/test/handler_test.go b/instrumentation/net/http/otelhttp/test/handler_test.go index 270dbf2f13f..959959b33a6 100644 --- a/instrumentation/net/http/otelhttp/test/handler_test.go +++ b/instrumentation/net/http/otelhttp/test/handler_test.go @@ -30,16 +30,15 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric/nonrecording" "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/sdk/metric/metrictest" sdktrace "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/sdk/trace/tracetest" ) -func assertMetricAttributes(t *testing.T, expectedAttributes []attribute.KeyValue, measurementBatches []metrictest.Batch) { - for _, batch := range measurementBatches { - assert.ElementsMatch(t, expectedAttributes, batch.Labels) - } -} +// func assertMetricAttributes(t *testing.T, expectedAttributes []attribute.KeyValue, measurementBatches []metrictest.Batch) { +// for _, batch := range measurementBatches { +// assert.ElementsMatch(t, expectedAttributes, batch.Labels) +// } +// } func TestHandlerBasics(t *testing.T) { rr := httptest.NewRecorder() diff --git a/instrumentation/runtime/runtime.go b/instrumentation/runtime/runtime.go index b29ebabec41..12cdaee1dd8 100644 --- a/instrumentation/runtime/runtime.go +++ b/instrumentation/runtime/runtime.go @@ -141,6 +141,9 @@ func (r *runtime) register() error { "process.runtime.go.cgo.calls", instrument.WithDescription("Number of cgo calls made by the current process"), ) + if err != nil { + return err + } err = r.meter.RegisterCallback( []instrument.Asynchronous{ @@ -154,6 +157,9 @@ func (r *runtime) register() error { cgoCalls.Observe(ctx, goruntime.NumCgoCall()) }, ) + if err != nil { + return err + } return r.registerMemStats() } @@ -317,7 +323,9 @@ func (r *runtime) registerMemStats() error { lastNumGC = memStats.NumGC }) - + if err != nil { + return err + } return nil } From 75bf090d9fe809e9bf6d3e276de410ffd0b94922 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 16:41:47 +0000 Subject: [PATCH 08/10] Changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcf4f359815..12b4e555036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Changed + +- Upgraded packages using otel/metrics v0.27.0 to v0.28.0 (#1977) + ## [1.5.0/0.30.0/0.1.0] - 2022-03-16 ### Added From 10c774c262fe5c5929dfbf849129f55f3f1d0472 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 16:59:59 -0500 Subject: [PATCH 09/10] Apply suggestions from code review Co-authored-by: Tyler Yahn Co-authored-by: David Ashpole --- CHANGELOG.md | 2 +- .../github.com/astaxie/beego/otelbeego/test/beego_test.go | 4 ++-- .../github.com/gocql/gocql/otelgocql/test/gocql_test.go | 2 ++ instrumentation/net/http/otelhttp/test/handler_test.go | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12b4e555036..a351c0bcfe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed -- Upgraded packages using otel/metrics v0.27.0 to v0.28.0 (#1977) +- Upgraded packages using otel/metrics v0.27.0 to v0.28.0. (#1977) ## [1.5.0/0.30.0/0.1.0] - 2022-03-16 diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go index eb8fb629f95..dbbd6a10699 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go @@ -220,7 +220,7 @@ func TestStatic(t *testing.T) { spans := sr.Ended() require.Len(t, spans, 1) assertSpan(t, spans[0], tc) - // TODO: recreate metrictest + // TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // assertMetrics(t, meterProvider.MeasurementBatches, tc) } @@ -327,7 +327,7 @@ func runTest(t *testing.T, tc *testCase, url string) { } else { require.Len(t, spans, 0) } - // TODO: recreate metrictest + // TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // assertMetrics(t, meterProvider.MeasurementBatches, tc) } diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go index ddd53f85418..30679af50ea 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/gocql_test.go @@ -49,6 +49,7 @@ func (m *mockConnectObserver) ObserveConnect(observedConnect gocql.ObservedConne m.callCount++ } +// TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // type testRecord struct { // name string // meterName string @@ -108,6 +109,7 @@ func TestQuery(t *testing.T) { assertConnectionLevelAttributes(t, span) } + // TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // // Check metrics // actual := obtainTestRecords(meterProvider.MeasurementBatches) // require.Len(t, actual, 3) diff --git a/instrumentation/net/http/otelhttp/test/handler_test.go b/instrumentation/net/http/otelhttp/test/handler_test.go index 959959b33a6..846da724d51 100644 --- a/instrumentation/net/http/otelhttp/test/handler_test.go +++ b/instrumentation/net/http/otelhttp/test/handler_test.go @@ -34,6 +34,7 @@ import ( "go.opentelemetry.io/otel/sdk/trace/tracetest" ) +// TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // func assertMetricAttributes(t *testing.T, expectedAttributes []attribute.KeyValue, measurementBatches []metrictest.Batch) { // for _, batch := range measurementBatches { // assert.ElementsMatch(t, expectedAttributes, batch.Labels) @@ -46,7 +47,7 @@ func TestHandlerBasics(t *testing.T) { spanRecorder := tracetest.NewSpanRecorder() provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(spanRecorder)) - // TODO: Replace with in memory recorder + // TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 meterProvider := nonrecording.NewNoopMeterProvider() operation := "test_handler" From cd160a11fd4b1de9a21f151e36d1fcc3e0298241 Mon Sep 17 00:00:00 2001 From: Aaron Clawson <3766680+MadVikingGod@users.noreply.github.com> Date: Thu, 24 Mar 2022 17:00:57 -0500 Subject: [PATCH 10/10] Apply suggestions from code review --- .../github.com/astaxie/beego/otelbeego/test/beego_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go index dbbd6a10699..92616953d78 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/beego_test.go @@ -347,7 +347,7 @@ func assertSpan(t *testing.T, span trace.ReadOnlySpan, tc *testCase) { } } -// TODO: recreate metrictest +// TODO: Replace with in memory exporter https://github.com/open-telemetry/opentelemetry-go/issues/2722 // func assertMetrics(t *testing.T, batches []metrictest.Batch, tc *testCase) { // for _, batch := range batches { // for _, att := range tc.expectedAttributes {