diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af648b9011..a34eaf45919 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ### Changed +- Updated to the new metric API. (#3170) - `otelgrpc`: Remove expensive calculation of uncompressed message size attribute. (#3168) ## [1.12.0/0.37.0/0.6.0] diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod index 7f8c3946a81..c2e6091df52 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.mod @@ -32,7 +32,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect golang.org/x/net v0.5.0 // indirect golang.org/x/sys v0.4.0 // indirect diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum index 90dbbc2b57a..f15ee5cb4fe 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/example/go.sum @@ -264,8 +264,8 @@ go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod index a0d7d69a36e..cf5d4dcbfee 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.mod @@ -9,7 +9,7 @@ require ( github.com/stretchr/testify v1.8.1 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0 go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum index 06166c802bc..10e6b7c0c39 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/go.sum @@ -267,8 +267,8 @@ 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.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod index 1432c57182f..2cdbd2e22e2 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.mod @@ -28,7 +28,7 @@ require ( github.com/prometheus/procfs v0.8.0 // indirect github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect golang.org/x/net v0.5.0 // indirect diff --git a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum index da9d39cd279..7ad5548505b 100644 --- a/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum +++ b/instrumentation/github.com/astaxie/beego/otelbeego/test/go.sum @@ -267,8 +267,8 @@ 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.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= 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 38dc6106d45..e9779d1b9a7 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 @@ -46,7 +46,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // 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 714fe1c28a1..1fca97e587a 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 @@ -65,8 +65,8 @@ go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod index 0b7aee64373..73baa893514 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.mod @@ -8,12 +8,12 @@ require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e github.com/prometheus/client_golang v1.14.0 go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/exporters/prometheus v0.34.0 go.opentelemetry.io/otel/exporters/zipkin v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 ) require ( diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum index 2c9acead978..ee9ce0514a0 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/example/go.sum @@ -221,18 +221,18 @@ 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.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/prometheus v0.34.0 h1:L5D+HxdaC/ORB47ribbTBbkXRZs9JzPjq0EoIOMWncM= go.opentelemetry.io/otel/exporters/prometheus v0.34.0/go.mod h1:6gUoJyfhoWqF0tOLaY0ZmKgkQRcvEQx6p5rVlKHp3s4= go.opentelemetry.io/otel/exporters/zipkin v1.11.2 h1:wGdWn04d1sEnxfO4TUF/UcQfEIu80IvqUXU1lENKyFg= go.opentelemetry.io/otel/exporters/zipkin v1.11.2/go.mod h1:I60/FdYilVKkuDOzenyp8LqJLryRC/Mr918G5hchvkM= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod index 52db3380f67..4fdf5812dec 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.mod +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.mod @@ -6,7 +6,7 @@ require ( github.com/gocql/gocql v0.0.0-20200624222514-34081eda590e github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum index 9390d7384c5..78b1f2fdbcb 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/go.sum @@ -35,8 +35,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go index 24f41aaa986..cae09066bf1 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go +++ b/instrumentation/github.com/gocql/gocql/otelgocql/instrument.go @@ -20,26 +20,25 @@ 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 syncint64.Counter + queryCount instrument.Int64Counter // queryRows is the number of rows returned by a query. - queryRows syncint64.Histogram + queryRows instrument.Int64Histogram // batchCount is the number of batch queries executed. - batchCount syncint64.Counter + batchCount instrument.Int64Counter // connectionCount is the number of connections made // with the traced session. - connectionCount syncint64.Counter + connectionCount instrument.Int64Counter // latency is the sum of attempt latencies. - latency syncint64.Histogram + latency instrument.Int64Histogram } // newInstruments will create instruments using a meter @@ -52,35 +51,35 @@ func newInstruments(p metric.MeterProvider) *instruments { instruments := &instruments{} var err error - if instruments.queryCount, err = meter.SyncInt64().Counter( + if instruments.queryCount, err = meter.Int64Counter( "db.cassandra.queries", instrument.WithDescription("Number queries executed"), ); err != nil { log.Printf("failed to create iQueryCount instrument, %v", err) } - if instruments.queryRows, err = meter.SyncInt64().Histogram( + if instruments.queryRows, err = meter.Int64Histogram( "db.cassandra.rows", instrument.WithDescription("Number of rows returned from query"), ); err != nil { log.Printf("failed to create iQueryRows instrument, %v", err) } - if instruments.batchCount, err = meter.SyncInt64().Counter( + if instruments.batchCount, err = meter.Int64Counter( "db.cassandra.batch.queries", instrument.WithDescription("Number of batch queries executed"), ); err != nil { log.Printf("failed to create iBatchCount instrument, %v", err) } - if instruments.connectionCount, err = meter.SyncInt64().Counter( + if instruments.connectionCount, err = meter.Int64Counter( "db.cassandra.connections", instrument.WithDescription("Number of connections created"), ); err != nil { log.Printf("failed to create iConnectionCount instrument, %v", err) } - if instruments.latency, err = meter.SyncInt64().Histogram( + if instruments.latency, err = meter.Int64Histogram( "db.cassandra.latency", instrument.WithDescription("Sum of latency to host in milliseconds"), instrument.WithUnit(unit.Milliseconds), diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.mod index 3ba67f4c3b1..3915753a0fb 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.8.1 go.opentelemetry.io/contrib v1.12.0 go.opentelemetry.io/contrib/instrumentation/github.com/gocql/gocql/otelgocql v0.37.0 - go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum index 24f237899a8..a61374fbad4 100644 --- a/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum +++ b/instrumentation/github.com/gocql/gocql/otelgocql/test/go.sum @@ -32,14 +32,14 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/instrumentation/google.golang.org/grpc/otelgrpc/config.go index 369ebae24a5..dcebcb34ab1 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/config.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -20,7 +20,6 @@ import ( "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" - "go.opentelemetry.io/otel/metric/instrument/syncint64" "go.opentelemetry.io/otel/metric/unit" "go.opentelemetry.io/otel/propagation" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" @@ -47,7 +46,7 @@ type config struct { MeterProvider metric.MeterProvider meter metric.Meter - rpcServerDuration syncint64.Histogram + rpcServerDuration instrument.Int64Histogram } // Option applies an option value for a config. @@ -72,7 +71,7 @@ func newConfig(opts []Option) *config { metric.WithSchemaURL(semconv.SchemaURL), ) var err error - if c.rpcServerDuration, err = c.meter.SyncInt64().Histogram("rpc.server.duration", instrument.WithUnit(unit.Milliseconds)); err != nil { + if c.rpcServerDuration, err = c.meter.Int64Histogram("rpc.server.duration", instrument.WithUnit(unit.Milliseconds)); err != nil { otel.Handle(err) } diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod index 348dd737cb3..f1be72dd204 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect golang.org/x/sys v0.4.0 // indirect golang.org/x/text v0.6.0 // indirect google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum index ed3ee5f44b2..80f99c0ce66 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/example/go.sum @@ -18,8 +18,8 @@ go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod index 777862bb14f..8a8545cef7f 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 google.golang.org/grpc v1.52.0 google.golang.org/protobuf v1.28.1 diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum index e2375ee5fe6..2202ab446fd 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/go.sum @@ -27,8 +27,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod index 6b37b82948f..08b18ed51f1 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.uber.org/goleak v1.2.0 google.golang.org/grpc v1.52.0 ) @@ -21,7 +21,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/net v0.5.0 // indirect golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum index 2bc2225a24c..0dee4a6fb25 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/go.sum @@ -29,14 +29,14 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= diff --git a/instrumentation/host/example/go.mod b/instrumentation/host/example/go.mod index a0d86614d6c..6415506ab16 100644 --- a/instrumentation/host/example/go.mod +++ b/instrumentation/host/example/go.mod @@ -6,10 +6,10 @@ replace go.opentelemetry.io/contrib/instrumentation/host => ../ require ( go.opentelemetry.io/contrib/instrumentation/host v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 ) require ( @@ -22,7 +22,7 @@ require ( github.com/tklauser/go-sysconf v0.3.11 // indirect github.com/tklauser/numcpus v0.6.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/sys v0.3.0 // indirect ) diff --git a/instrumentation/host/example/go.sum b/instrumentation/host/example/go.sum index 227a081d4fd..afbe9fd965b 100644 --- a/instrumentation/host/example/go.sum +++ b/instrumentation/host/example/go.sum @@ -32,16 +32,16 @@ github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYm github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= 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.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 h1:O1E9/qhspQSz3O6/dSGLNBND2TO9mUaSvlhcKJMv278= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0/go.mod h1:Id0oYi2ARij/um3gFV+t5rH1MTFdJpfTimsFsqKS7pE= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/instrumentation/host/go.mod b/instrumentation/host/go.mod index 7680985845b..a8ddb26a772 100644 --- a/instrumentation/host/go.mod +++ b/instrumentation/host/go.mod @@ -5,7 +5,7 @@ go 1.18 require ( github.com/shirou/gopsutil/v3 v3.22.12 go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 ) require ( diff --git a/instrumentation/host/go.sum b/instrumentation/host/go.sum index 4695668e978..c96f7149f54 100644 --- a/instrumentation/host/go.sum +++ b/instrumentation/host/go.sum @@ -34,8 +34,8 @@ github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPR github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/instrumentation/host/host.go b/instrumentation/host/host.go index 910df1fdb5c..73fedf5fff2 100644 --- a/instrumentation/host/host.go +++ b/instrumentation/host/host.go @@ -25,13 +25,10 @@ import ( "github.com/shirou/gopsutil/v3/net" "github.com/shirou/gopsutil/v3/process" - "go.opentelemetry.io/otel" "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" ) @@ -119,13 +116,13 @@ func (h *host) register() error { var ( err error - processCPUTime asyncfloat64.Counter - hostCPUTime asyncfloat64.Counter + processCPUTime instrument.Float64ObservableCounter + hostCPUTime instrument.Float64ObservableCounter - hostMemoryUsage asyncint64.Gauge - hostMemoryUtilization asyncfloat64.Gauge + hostMemoryUsage instrument.Int64ObservableGauge + hostMemoryUtilization instrument.Float64ObservableGauge - networkIOUsage asyncint64.Counter + networkIOUsage instrument.Int64ObservableCounter // lock prevents a race between batch observer and instrument registration. lock sync.Mutex @@ -142,7 +139,7 @@ func (h *host) register() error { // 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 = h.meter.AsyncFloat64().Counter( + if processCPUTime, err = h.meter.Float64ObservableCounter( "process.cpu.time", instrument.WithUnit("s"), instrument.WithDescription( @@ -152,7 +149,7 @@ func (h *host) register() error { return err } - if hostCPUTime, err = h.meter.AsyncFloat64().Counter( + if hostCPUTime, err = h.meter.Float64ObservableCounter( "system.cpu.time", instrument.WithUnit("s"), instrument.WithDescription( @@ -162,7 +159,7 @@ func (h *host) register() error { return err } - if hostMemoryUsage, err = h.meter.AsyncInt64().Gauge( + if hostMemoryUsage, err = h.meter.Int64ObservableGauge( "system.memory.usage", instrument.WithUnit(unit.Bytes), instrument.WithDescription( @@ -172,7 +169,7 @@ func (h *host) register() error { return err } - if hostMemoryUtilization, err = h.meter.AsyncFloat64().Gauge( + if hostMemoryUtilization, err = h.meter.Float64ObservableGauge( "system.memory.utilization", instrument.WithUnit(unit.Dimensionless), instrument.WithDescription( @@ -182,7 +179,7 @@ func (h *host) register() error { return err } - if networkIOUsage, err = h.meter.AsyncInt64().Counter( + if networkIOUsage, err = h.meter.Int64ObservableCounter( "system.network.io", instrument.WithUnit(unit.Bytes), instrument.WithDescription( @@ -192,15 +189,8 @@ func (h *host) register() error { return err } - err = h.meter.RegisterCallback( - []instrument.Asynchronous{ - processCPUTime, - hostCPUTime, - hostMemoryUsage, - hostMemoryUtilization, - networkIOUsage, - }, - func(ctx context.Context) { + _, err = h.meter.RegisterCallback( + func(ctx context.Context, o metric.Observer) error { lock.Lock() defer lock.Unlock() @@ -211,44 +201,38 @@ func (h *host) register() error { // specific metrics that are not universal. processTimes, err := proc.TimesWithContext(ctx) if err != nil { - otel.Handle(err) - return + return err } hostTimeSlice, err := cpu.TimesWithContext(ctx, false) if err != nil { - otel.Handle(err) - return + return err } if len(hostTimeSlice) != 1 { - otel.Handle(fmt.Errorf("host CPU usage: incorrect summary count")) - return + return fmt.Errorf("host CPU usage: incorrect summary count") } vmStats, err := mem.VirtualMemoryWithContext(ctx) if err != nil { - otel.Handle(err) - return + return err } ioStats, err := net.IOCountersWithContext(ctx, false) if err != nil { - otel.Handle(err) - return + return err } if len(ioStats) != 1 { - otel.Handle(fmt.Errorf("host network usage: incorrect summary count")) - return + return fmt.Errorf("host network usage: incorrect summary count") } // Process CPU time - processCPUTime.Observe(ctx, processTimes.User, AttributeCPUTimeUser...) - processCPUTime.Observe(ctx, processTimes.System, AttributeCPUTimeSystem...) + o.ObserveFloat64(processCPUTime, processTimes.User, AttributeCPUTimeUser...) + o.ObserveFloat64(processCPUTime, processTimes.System, AttributeCPUTimeSystem...) // Host CPU time hostTime := hostTimeSlice[0] - hostCPUTime.Observe(ctx, hostTime.User, AttributeCPUTimeUser...) - hostCPUTime.Observe(ctx, hostTime.System, AttributeCPUTimeSystem...) + o.ObserveFloat64(hostCPUTime, hostTime.User, AttributeCPUTimeUser...) + o.ObserveFloat64(hostCPUTime, hostTime.System, AttributeCPUTimeSystem...) // TODO(#244): "other" is a placeholder for actually dealing // with these states. Do users actually want this @@ -265,25 +249,33 @@ func (h *host) register() error { hostTime.Guest + hostTime.GuestNice - hostCPUTime.Observe(ctx, other, AttributeCPUTimeOther...) - hostCPUTime.Observe(ctx, hostTime.Idle, AttributeCPUTimeIdle...) + o.ObserveFloat64(hostCPUTime, other, AttributeCPUTimeOther...) + o.ObserveFloat64(hostCPUTime, hostTime.Idle, AttributeCPUTimeIdle...) // Host memory usage - hostMemoryUsage.Observe(ctx, int64(vmStats.Used), AttributeMemoryUsed...) - hostMemoryUsage.Observe(ctx, int64(vmStats.Available), AttributeMemoryAvailable...) + o.ObserveInt64(hostMemoryUsage, int64(vmStats.Used), AttributeMemoryUsed...) + o.ObserveInt64(hostMemoryUsage, 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...) + o.ObserveFloat64(hostMemoryUtilization, float64(vmStats.Used)/float64(vmStats.Total), AttributeMemoryUsed...) + o.ObserveFloat64(hostMemoryUtilization, 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...) - }) + o.ObserveInt64(networkIOUsage, int64(ioStats[0].BytesSent), AttributeNetworkTransmit...) + o.ObserveInt64(networkIOUsage, int64(ioStats[0].BytesRecv), AttributeNetworkReceive...) + + return nil + }, + processCPUTime, + hostCPUTime, + hostMemoryUsage, + hostMemoryUtilization, + networkIOUsage, + ) if err != nil { return err diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod index 7e8e44837e5..52c3040997d 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.mod @@ -20,6 +20,6 @@ require ( github.com/felixge/httpsnoop v1.0.3 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect ) diff --git a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum index 70f5b6624b6..04b6094e243 100644 --- a/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum +++ b/instrumentation/net/http/httptrace/otelhttptrace/example/go.sum @@ -13,8 +13,8 @@ go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= diff --git a/instrumentation/net/http/otelhttp/example/go.mod b/instrumentation/net/http/otelhttp/example/go.mod index 6b730b7f627..2cfc93bb2cc 100644 --- a/instrumentation/net/http/otelhttp/example/go.mod +++ b/instrumentation/net/http/otelhttp/example/go.mod @@ -6,12 +6,12 @@ replace go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp => ../ require ( go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/instrumentation/net/http/otelhttp/example/go.sum b/instrumentation/net/http/otelhttp/example/go.sum index 57f809c51ea..0cbdd18bffc 100644 --- a/instrumentation/net/http/otelhttp/example/go.sum +++ b/instrumentation/net/http/otelhttp/example/go.sum @@ -9,18 +9,18 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 h1:O1E9/qhspQSz3O6/dSGLNBND2TO9mUaSvlhcKJMv278= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0/go.mod h1:Id0oYi2ARij/um3gFV+t5rH1MTFdJpfTimsFsqKS7pE= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= diff --git a/instrumentation/net/http/otelhttp/go.mod b/instrumentation/net/http/otelhttp/go.mod index 2cc7015428b..e60da9aea20 100644 --- a/instrumentation/net/http/otelhttp/go.mod +++ b/instrumentation/net/http/otelhttp/go.mod @@ -6,7 +6,7 @@ require ( github.com/felixge/httpsnoop v1.0.3 github.com/stretchr/testify v1.8.1 go.opentelemetry.io/otel v1.11.2 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 ) diff --git a/instrumentation/net/http/otelhttp/go.sum b/instrumentation/net/http/otelhttp/go.sum index 2c3cda20fbb..9bcecc3947b 100644 --- a/instrumentation/net/http/otelhttp/go.sum +++ b/instrumentation/net/http/otelhttp/go.sum @@ -20,8 +20,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/instrumentation/net/http/otelhttp/handler.go b/instrumentation/net/http/otelhttp/handler.go index fd91e4162da..a52be4e9bb8 100644 --- a/instrumentation/net/http/otelhttp/handler.go +++ b/instrumentation/net/http/otelhttp/handler.go @@ -24,8 +24,7 @@ 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/metric/instrument" "go.opentelemetry.io/otel/propagation" semconv "go.opentelemetry.io/otel/semconv/v1.12.0" "go.opentelemetry.io/otel/trace" @@ -49,8 +48,8 @@ type Handler struct { writeEvent bool filters []Filter spanNameFormatter func(string, *http.Request) string - counters map[string]syncint64.Counter - valueRecorders map[string]syncfloat64.Histogram + counters map[string]instrument.Int64Counter + valueRecorders map[string]instrument.Float64Histogram publicEndpoint bool publicEndpointFn func(*http.Request) bool } @@ -99,16 +98,16 @@ func handleErr(err error) { } func (h *Handler) createMeasures() { - h.counters = make(map[string]syncint64.Counter) - h.valueRecorders = make(map[string]syncfloat64.Histogram) + h.counters = make(map[string]instrument.Int64Counter) + h.valueRecorders = make(map[string]instrument.Float64Histogram) - requestBytesCounter, err := h.meter.SyncInt64().Counter(RequestContentLength) + requestBytesCounter, err := h.meter.Int64Counter(RequestContentLength) handleErr(err) - responseBytesCounter, err := h.meter.SyncInt64().Counter(ResponseContentLength) + responseBytesCounter, err := h.meter.Int64Counter(ResponseContentLength) handleErr(err) - serverLatencyMeasure, err := h.meter.SyncFloat64().Histogram(ServerLatency) + serverLatencyMeasure, err := h.meter.Float64Histogram(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 7b9c77df54d..01fea35a6cd 100644 --- a/instrumentation/net/http/otelhttp/test/go.mod +++ b/instrumentation/net/http/otelhttp/test/go.mod @@ -5,9 +5,9 @@ go 1.18 require ( github.com/stretchr/testify v1.8.1 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/trace v1.11.2 ) @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/instrumentation/net/http/otelhttp/test/go.sum b/instrumentation/net/http/otelhttp/test/go.sum index 82805b86976..83ac237975e 100644 --- a/instrumentation/net/http/otelhttp/test/go.sum +++ b/instrumentation/net/http/otelhttp/test/go.sum @@ -18,14 +18,14 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= diff --git a/instrumentation/runtime/example/go.mod b/instrumentation/runtime/example/go.mod index 7ec26aa684a..e6f31252f0d 100644 --- a/instrumentation/runtime/example/go.mod +++ b/instrumentation/runtime/example/go.mod @@ -6,11 +6,11 @@ replace go.opentelemetry.io/contrib/instrumentation/runtime => ../ require ( go.opentelemetry.io/contrib/instrumentation/runtime v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 - go.opentelemetry.io/otel/metric v0.34.0 + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/sdk v1.11.2 - go.opentelemetry.io/otel/sdk/metric v0.34.0 + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 ) require ( diff --git a/instrumentation/runtime/example/go.sum b/instrumentation/runtime/example/go.sum index d7579223c26..a928e955c8d 100644 --- a/instrumentation/runtime/example/go.sum +++ b/instrumentation/runtime/example/go.sum @@ -7,16 +7,16 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0 h1:O1E9/qhspQSz3O6/dSGLNBND2TO9mUaSvlhcKJMv278= go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.34.0/go.mod h1:Id0oYi2ARij/um3gFV+t5rH1MTFdJpfTimsFsqKS7pE= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/sys v0.0.0-20220919091848-fb04ddd9f9c8 h1:h+EGohizhe9XlX18rfpa8k8RAc5XyaeamM+0VHRd4lc= diff --git a/instrumentation/runtime/go.mod b/instrumentation/runtime/go.mod index 8e47f2f6e7b..f7ad90dd99d 100644 --- a/instrumentation/runtime/go.mod +++ b/instrumentation/runtime/go.mod @@ -2,7 +2,7 @@ module go.opentelemetry.io/contrib/instrumentation/runtime go 1.18 -require go.opentelemetry.io/otel/metric v0.34.0 +require go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 require ( github.com/go-logr/logr v1.2.3 // indirect diff --git a/instrumentation/runtime/go.sum b/instrumentation/runtime/go.sum index 93fb2f0611f..1e5cfe9c234 100644 --- a/instrumentation/runtime/go.sum +++ b/instrumentation/runtime/go.sum @@ -9,8 +9,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/instrumentation/runtime/runtime.go b/instrumentation/runtime/runtime.go index 5f70a5880ff..35fc16484a1 100644 --- a/instrumentation/runtime/runtime.go +++ b/instrumentation/runtime/runtime.go @@ -23,8 +23,6 @@ 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" ) @@ -120,7 +118,7 @@ func Start(opts ...Option) error { func (r *runtime) register() error { startTime := time.Now() - uptime, err := r.meter.AsyncInt64().UpDownCounter( + uptime, err := r.meter.Int64ObservableUpDownCounter( "runtime.uptime", instrument.WithUnit(unit.Milliseconds), instrument.WithDescription("Milliseconds since application was initialized"), @@ -129,7 +127,7 @@ func (r *runtime) register() error { return err } - goroutines, err := r.meter.AsyncInt64().UpDownCounter( + goroutines, err := r.meter.Int64ObservableUpDownCounter( "process.runtime.go.goroutines", instrument.WithDescription("Number of goroutines that currently exist"), ) @@ -137,7 +135,7 @@ func (r *runtime) register() error { return err } - cgoCalls, err := r.meter.AsyncInt64().UpDownCounter( + cgoCalls, err := r.meter.Int64ObservableUpDownCounter( "process.runtime.go.cgo.calls", instrument.WithDescription("Number of cgo calls made by the current process"), ) @@ -145,17 +143,16 @@ func (r *runtime) register() error { return err } - err = r.meter.RegisterCallback( - []instrument.Asynchronous{ - uptime, - goroutines, - cgoCalls, - }, - func(ctx context.Context) { - uptime.Observe(ctx, time.Since(startTime).Milliseconds()) - goroutines.Observe(ctx, int64(goruntime.NumGoroutine())) - cgoCalls.Observe(ctx, goruntime.NumCgoCall()) + _, err = r.meter.RegisterCallback( + func(ctx context.Context, o metric.Observer) error { + o.ObserveInt64(uptime, time.Since(startTime).Milliseconds()) + o.ObserveInt64(goroutines, int64(goruntime.NumGoroutine())) + o.ObserveInt64(cgoCalls, goruntime.NumCgoCall()) + return nil }, + uptime, + goroutines, + cgoCalls, ) if err != nil { return err @@ -168,21 +165,21 @@ func (r *runtime) registerMemStats() error { var ( err error - heapAlloc asyncint64.UpDownCounter - heapIdle asyncint64.UpDownCounter - heapInuse asyncint64.UpDownCounter - heapObjects asyncint64.UpDownCounter - heapReleased asyncint64.UpDownCounter - heapSys asyncint64.UpDownCounter - liveObjects asyncint64.UpDownCounter + heapAlloc instrument.Int64ObservableUpDownCounter + heapIdle instrument.Int64ObservableUpDownCounter + heapInuse instrument.Int64ObservableUpDownCounter + heapObjects instrument.Int64ObservableUpDownCounter + heapReleased instrument.Int64ObservableUpDownCounter + heapSys instrument.Int64ObservableUpDownCounter + liveObjects instrument.Int64ObservableUpDownCounter // TODO: is ptrLookups useful? I've not seen a value // other than zero. - ptrLookups asyncint64.Counter + ptrLookups instrument.Int64ObservableCounter - gcCount asyncint64.Counter - pauseTotalNs asyncint64.Counter - gcPauseNs syncint64.Histogram + gcCount instrument.Int64ObservableCounter + pauseTotalNs instrument.Int64ObservableCounter + gcPauseNs instrument.Int64Histogram lastNumGC uint32 lastMemStats time.Time @@ -195,7 +192,7 @@ func (r *runtime) registerMemStats() error { lock.Lock() defer lock.Unlock() - if heapAlloc, err = r.meter.AsyncInt64().UpDownCounter( + if heapAlloc, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.heap_alloc", instrument.WithUnit(unit.Bytes), instrument.WithDescription("Bytes of allocated heap objects"), @@ -203,7 +200,7 @@ func (r *runtime) registerMemStats() error { return err } - if heapIdle, err = r.meter.AsyncInt64().UpDownCounter( + if heapIdle, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.heap_idle", instrument.WithUnit(unit.Bytes), instrument.WithDescription("Bytes in idle (unused) spans"), @@ -211,7 +208,7 @@ func (r *runtime) registerMemStats() error { return err } - if heapInuse, err = r.meter.AsyncInt64().UpDownCounter( + if heapInuse, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.heap_inuse", instrument.WithUnit(unit.Bytes), instrument.WithDescription("Bytes in in-use spans"), @@ -219,7 +216,7 @@ func (r *runtime) registerMemStats() error { return err } - if heapObjects, err = r.meter.AsyncInt64().UpDownCounter( + if heapObjects, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.heap_objects", instrument.WithDescription("Number of allocated heap objects"), ); err != nil { @@ -228,7 +225,7 @@ func (r *runtime) registerMemStats() error { // FYI see https://github.com/golang/go/issues/32284 to help // understand the meaning of this value. - if heapReleased, err = r.meter.AsyncInt64().UpDownCounter( + if heapReleased, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.heap_released", instrument.WithUnit(unit.Bytes), instrument.WithDescription("Bytes of idle spans whose physical memory has been returned to the OS"), @@ -236,7 +233,7 @@ func (r *runtime) registerMemStats() error { return err } - if heapSys, err = r.meter.AsyncInt64().UpDownCounter( + if heapSys, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.heap_sys", instrument.WithUnit(unit.Bytes), instrument.WithDescription("Bytes of heap memory obtained from the OS"), @@ -244,21 +241,21 @@ func (r *runtime) registerMemStats() error { return err } - if ptrLookups, err = r.meter.AsyncInt64().Counter( + if ptrLookups, err = r.meter.Int64ObservableCounter( "process.runtime.go.mem.lookups", instrument.WithDescription("Number of pointer lookups performed by the runtime"), ); err != nil { return err } - if liveObjects, err = r.meter.AsyncInt64().UpDownCounter( + if liveObjects, err = r.meter.Int64ObservableUpDownCounter( "process.runtime.go.mem.live_objects", instrument.WithDescription("Number of live objects is the number of cumulative Mallocs - Frees"), ); err != nil { return err } - if gcCount, err = r.meter.AsyncInt64().Counter( + if gcCount, err = r.meter.Int64ObservableCounter( "process.runtime.go.gc.count", instrument.WithDescription("Number of completed garbage collection cycles"), ); err != nil { @@ -268,7 +265,7 @@ 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 = r.meter.AsyncInt64().Counter( + if pauseTotalNs, err = r.meter.Int64ObservableCounter( "process.runtime.go.gc.pause_total_ns", // TODO: nanoseconds units instrument.WithDescription("Cumulative nanoseconds in GC stop-the-world pauses since the program started"), @@ -276,7 +273,7 @@ func (r *runtime) registerMemStats() error { return err } - if gcPauseNs, err = r.meter.SyncInt64().Histogram( + if gcPauseNs, err = r.meter.Int64Histogram( "process.runtime.go.gc.pause_ns", // TODO: nanoseconds units instrument.WithDescription("Amount of nanoseconds in GC stop-the-world pauses"), @@ -284,21 +281,8 @@ func (r *runtime) registerMemStats() error { return err } - err = r.meter.RegisterCallback( - []instrument.Asynchronous{ - heapAlloc, - heapIdle, - heapInuse, - heapObjects, - heapReleased, - heapSys, - liveObjects, - - ptrLookups, - - gcCount, - pauseTotalNs, - }, func(ctx context.Context) { + _, err = r.meter.RegisterCallback( + func(ctx context.Context, o metric.Observer) error { lock.Lock() defer lock.Unlock() @@ -308,21 +292,36 @@ func (r *runtime) registerMemStats() error { 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)) + o.ObserveInt64(heapAlloc, int64(memStats.HeapAlloc)) + o.ObserveInt64(heapIdle, int64(memStats.HeapIdle)) + o.ObserveInt64(heapInuse, int64(memStats.HeapInuse)) + o.ObserveInt64(heapObjects, int64(memStats.HeapObjects)) + o.ObserveInt64(heapReleased, int64(memStats.HeapReleased)) + o.ObserveInt64(heapSys, int64(memStats.HeapSys)) + o.ObserveInt64(liveObjects, int64(memStats.Mallocs-memStats.Frees)) + o.ObserveInt64(ptrLookups, int64(memStats.Lookups)) + o.ObserveInt64(gcCount, int64(memStats.NumGC)) + o.ObserveInt64(pauseTotalNs, int64(memStats.PauseTotalNs)) computeGCPauses(ctx, gcPauseNs, memStats.PauseNs[:], lastNumGC, memStats.NumGC) lastNumGC = memStats.NumGC - }) + + return nil + }, + heapAlloc, + heapIdle, + heapInuse, + heapObjects, + heapReleased, + heapSys, + liveObjects, + + ptrLookups, + + gcCount, + pauseTotalNs, + ) if err != nil { return err } @@ -331,7 +330,7 @@ func (r *runtime) registerMemStats() error { func computeGCPauses( ctx context.Context, - recorder syncint64.Histogram, + recorder instrument.Int64Histogram, circular []uint64, lastNumGC, currentNumGC uint32, ) { @@ -363,7 +362,7 @@ func computeGCPauses( func recordGCPauses( ctx context.Context, - recorder syncint64.Histogram, + recorder instrument.Int64Histogram, pauses []uint64, ) { for _, pause := range pauses { diff --git a/propagators/opencensus/examples/go.mod b/propagators/opencensus/examples/go.mod index 285f50d498f..fafcb4c3536 100644 --- a/propagators/opencensus/examples/go.mod +++ b/propagators/opencensus/examples/go.mod @@ -6,7 +6,7 @@ require ( go.opencensus.io v0.24.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0 go.opentelemetry.io/contrib/propagators/opencensus v0.37.0 - go.opentelemetry.io/otel v1.11.2 + go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 go.opentelemetry.io/otel/sdk v1.11.2 google.golang.org/grpc v1.52.0 @@ -18,8 +18,8 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/golang/protobuf v1.5.2 // indirect go.opentelemetry.io/otel/bridge/opencensus v0.34.0 // indirect - go.opentelemetry.io/otel/metric v0.34.0 // indirect - go.opentelemetry.io/otel/sdk/metric v0.34.0 // indirect + go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect + go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 // indirect go.opentelemetry.io/otel/trace v1.11.2 // indirect golang.org/x/net v0.5.0 // indirect golang.org/x/sys v0.4.0 // indirect diff --git a/propagators/opencensus/examples/go.sum b/propagators/opencensus/examples/go.sum index d6deb5f2311..134d2f44a7d 100644 --- a/propagators/opencensus/examples/go.sum +++ b/propagators/opencensus/examples/go.sum @@ -55,18 +55,18 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/otel v1.11.2 h1:YBZcQlsVekzFsFbjygXMOXSs6pialIZxcjfO/mBDmR0= -go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5 h1:noFrde4cmjaYGfLO6FitAi79aeq/AAiS6lLdrss4MRA= +go.opentelemetry.io/otel v1.11.3-0.20230119184437-b1a8002c4cf5/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI= go.opentelemetry.io/otel/bridge/opencensus v0.34.0 h1:yH5TrP1GRsWuZwOPsOguSjOLC2AO9WDhl+jNoaA7WHQ= go.opentelemetry.io/otel/bridge/opencensus v0.34.0/go.mod h1:HnenK8nxUmQSgv3v7jGsr6KHxr3Yg1t/TJB6GzL5bFs= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2 h1:BhEVgvuE1NWLLuMLvC6sif791F45KFHi5GhOs1KunZU= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.11.2/go.mod h1:bx//lU66dPzNT+Y0hHA12ciKoMOH9iixEwCqC1OeQWQ= -go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= -go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:C0lkl0F56ubmE90lqBz5xvu+WcH3t/jn8YNqlOeNkZA= +go.opentelemetry.io/otel/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8= go.opentelemetry.io/otel/sdk v1.11.2 h1:GF4JoaEx7iihdMFu30sOyRx52HDHOkl9xQ8SMqNXUiU= go.opentelemetry.io/otel/sdk v1.11.2/go.mod h1:wZ1WxImwpq+lVRo4vsmSOxdd+xwoUJ6rqyLc3SyX9aU= -go.opentelemetry.io/otel/sdk/metric v0.34.0 h1:7ElxfQpXCFZlRTvVRTkcUvK8Gt5DC8QzmzsLsO2gdzo= -go.opentelemetry.io/otel/sdk/metric v0.34.0/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5 h1:yEFI+4RJiOtJ1HjkcEkRixGV+lePEZYuSRVJo3E0Wgc= +go.opentelemetry.io/otel/sdk/metric v0.34.1-0.20230119184437-b1a8002c4cf5/go.mod h1:l4r16BIqiqPy5rd14kkxllPy/fOI4tWo1jkpD9Z3ffQ= go.opentelemetry.io/otel/trace v1.11.2 h1:Xf7hWSF2Glv0DE3MH7fBHvtpSBsjcBUe5MYAmZM/+y0= go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=