From 2d968c454a55c5909efb1e9e4de115de193d942a Mon Sep 17 00:00:00 2001 From: OpenTelemetry Bot <107717825+opentelemetrybot@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:34:44 +0100 Subject: [PATCH 01/15] dependabot updates Sun Mar 10 09:28:42 UTC 2024 (#5047) build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 in /exporters/otlp/otlpmetric/otlpmetricgrpc build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /exporters/otlp/otlpmetric/otlpmetricgrpc build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /exporters/prometheus build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 in /exporters/otlp/otlptrace/otlptracegrpc build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /exporters/otlp/otlptrace/otlptracegrpc build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 in /bridge/opentracing/test build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /exporters/otlp/otlptrace/otlptracehttp build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 in /exporters/otlp/otlptrace/otlptracehttp build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /exporters/otlp/otlptrace build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 in /exporters/otlp/otlpmetric/otlpmetrichttp build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 in /exporters/otlp/otlpmetric/otlpmetrichttp build(deps): bump google.golang.org/grpc from 1.62.0 to 1.62.1 in /example/otel-collector build(deps): bump golang.org/x/sys from 0.17.0 to 0.18.0 in /sdk build(deps): bump golang.org/x/tools from 0.18.0 to 0.19.0 in /internal/tools --- bridge/opencensus/go.mod | 2 +- bridge/opencensus/go.sum | 4 +-- bridge/opencensus/test/go.mod | 2 +- bridge/opencensus/test/go.sum | 4 +-- bridge/opentracing/test/go.mod | 6 ++-- bridge/opentracing/test/go.sum | 12 ++++---- example/dice/go.mod | 2 +- example/dice/go.sum | 4 +-- example/namedtracer/go.mod | 2 +- example/namedtracer/go.sum | 4 +-- example/opencensus/go.mod | 2 +- example/opencensus/go.sum | 4 +-- example/otel-collector/go.mod | 6 ++-- example/otel-collector/go.sum | 12 ++++---- example/passthrough/go.mod | 2 +- example/passthrough/go.sum | 4 +-- example/prometheus/go.mod | 4 +-- example/prometheus/go.sum | 8 +++--- example/zipkin/go.mod | 2 +- example/zipkin/go.sum | 4 +-- .../otlp/otlpmetric/otlpmetricgrpc/go.mod | 6 ++-- .../otlp/otlpmetric/otlpmetricgrpc/go.sum | 12 ++++---- .../otlp/otlpmetric/otlpmetrichttp/go.mod | 6 ++-- .../otlp/otlpmetric/otlpmetrichttp/go.sum | 12 ++++---- exporters/otlp/otlptrace/go.mod | 4 +-- exporters/otlp/otlptrace/go.sum | 8 +++--- exporters/otlp/otlptrace/otlptracegrpc/go.mod | 6 ++-- exporters/otlp/otlptrace/otlptracegrpc/go.sum | 12 ++++---- exporters/otlp/otlptrace/otlptracehttp/go.mod | 6 ++-- exporters/otlp/otlptrace/otlptracehttp/go.sum | 12 ++++---- exporters/prometheus/go.mod | 4 +-- exporters/prometheus/go.sum | 8 +++--- exporters/stdout/stdoutmetric/go.mod | 2 +- exporters/stdout/stdoutmetric/go.sum | 4 +-- exporters/stdout/stdouttrace/go.mod | 2 +- exporters/stdout/stdouttrace/go.sum | 4 +-- exporters/zipkin/go.mod | 2 +- exporters/zipkin/go.sum | 4 +-- internal/tools/go.mod | 12 ++++---- internal/tools/go.sum | 28 +++++++++---------- sdk/go.mod | 2 +- sdk/go.sum | 4 +-- sdk/metric/go.mod | 2 +- sdk/metric/go.sum | 4 +-- 44 files changed, 128 insertions(+), 128 deletions(-) diff --git a/bridge/opencensus/go.mod b/bridge/opencensus/go.mod index c8af4880735..3505f9b9646 100644 --- a/bridge/opencensus/go.mod +++ b/bridge/opencensus/go.mod @@ -19,7 +19,7 @@ require ( github.com/kr/pretty v0.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opencensus/go.sum b/bridge/opencensus/go.sum index dec7ae2920f..3acdc7d1784 100644 --- a/bridge/opencensus/go.sum +++ b/bridge/opencensus/go.sum @@ -75,8 +75,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opencensus/test/go.mod b/bridge/opencensus/test/go.mod index cbbbcc2b4fe..5ef6c5bc7e3 100644 --- a/bridge/opencensus/test/go.mod +++ b/bridge/opencensus/test/go.mod @@ -16,7 +16,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect ) replace go.opentelemetry.io/otel => ../../.. diff --git a/bridge/opencensus/test/go.sum b/bridge/opencensus/test/go.sum index feb0121ae90..b40d4f99521 100644 --- a/bridge/opencensus/test/go.sum +++ b/bridge/opencensus/test/go.sum @@ -70,8 +70,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/bridge/opentracing/test/go.mod b/bridge/opentracing/test/go.mod index 073a2b63afa..5133c333f69 100644 --- a/bridge/opentracing/test/go.mod +++ b/bridge/opentracing/test/go.mod @@ -14,7 +14,7 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.24.0 go.opentelemetry.io/otel/bridge/opentracing v1.24.0 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 ) require ( @@ -26,10 +26,10 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.16.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/bridge/opentracing/test/go.sum b/bridge/opentracing/test/go.sum index 7c4c40e063a..66f894d869f 100644 --- a/bridge/opentracing/test/go.sum +++ b/bridge/opentracing/test/go.sum @@ -42,8 +42,8 @@ golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= @@ -55,12 +55,12 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= 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.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/example/dice/go.mod b/example/dice/go.mod index d41967a8188..f48e452e296 100644 --- a/example/dice/go.mod +++ b/example/dice/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect ) replace go.opentelemetry.io/otel/exporters/stdout/stdouttrace => ../../exporters/stdout/stdouttrace diff --git a/example/dice/go.sum b/example/dice/go.sum index 58f8f850e4b..8e3fbc4d947 100644 --- a/example/dice/go.sum +++ b/example/dice/go.sum @@ -15,7 +15,7 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/namedtracer/go.mod b/example/namedtracer/go.mod index efa0a993db0..c8426e43b1c 100644 --- a/example/namedtracer/go.mod +++ b/example/namedtracer/go.mod @@ -18,7 +18,7 @@ require ( require ( github.com/go-logr/logr v1.4.1 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/namedtracer/go.sum b/example/namedtracer/go.sum index 6a60a259fce..bd9fd851e52 100644 --- a/example/namedtracer/go.sum +++ b/example/namedtracer/go.sum @@ -11,7 +11,7 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/opencensus/go.mod b/example/opencensus/go.mod index 38f2961d585..85e7c55a53d 100644 --- a/example/opencensus/go.mod +++ b/example/opencensus/go.mod @@ -24,7 +24,7 @@ require ( github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/example/opencensus/go.sum b/example/opencensus/go.sum index feb0121ae90..b40d4f99521 100644 --- a/example/opencensus/go.sum +++ b/example/opencensus/go.sum @@ -70,8 +70,8 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/example/otel-collector/go.mod b/example/otel-collector/go.mod index 7c357fc2cf9..734bf3feb04 100644 --- a/example/otel-collector/go.mod +++ b/example/otel-collector/go.mod @@ -12,7 +12,7 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 - google.golang.org/grpc v1.62.0 + google.golang.org/grpc v1.62.1 ) require ( @@ -25,11 +25,11 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/proto/otlp v1.1.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/otel-collector/go.sum b/example/otel-collector/go.sum index 795272f643c..d55df377732 100644 --- a/example/otel-collector/go.sum +++ b/example/otel-collector/go.sum @@ -25,8 +25,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -36,11 +36,11 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/passthrough/go.mod b/example/passthrough/go.mod index fc2e9a1e438..740671b3525 100644 --- a/example/passthrough/go.mod +++ b/example/passthrough/go.mod @@ -13,7 +13,7 @@ require ( github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect ) replace ( diff --git a/example/passthrough/go.sum b/example/passthrough/go.sum index 6a60a259fce..bd9fd851e52 100644 --- a/example/passthrough/go.sum +++ b/example/passthrough/go.sum @@ -11,7 +11,7 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/prometheus/go.mod b/example/prometheus/go.mod index 2043fec5d4a..e35b108c33e 100644 --- a/example/prometheus/go.mod +++ b/example/prometheus/go.mod @@ -20,8 +20,8 @@ require ( github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/sdk v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + golang.org/x/sys v0.18.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect ) replace go.opentelemetry.io/otel => ../.. diff --git a/example/prometheus/go.sum b/example/prometheus/go.sum index 45020259491..13d60cbc8ff 100644 --- a/example/prometheus/go.sum +++ b/example/prometheus/go.sum @@ -23,9 +23,9 @@ github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/example/zipkin/go.mod b/example/zipkin/go.mod index 12cdb8b2c01..43d438190c0 100644 --- a/example/zipkin/go.mod +++ b/example/zipkin/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/openzipkin/zipkin-go v0.4.2 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect ) replace go.opentelemetry.io/otel/trace => ../../trace diff --git a/example/zipkin/go.sum b/example/zipkin/go.sum index 06ab880657c..20b8b39c027 100644 --- a/example/zipkin/go.sum +++ b/example/zipkin/go.sum @@ -13,7 +13,7 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod index 42706a3f7be..47d752d9355 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.mod @@ -13,8 +13,8 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -29,7 +29,7 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum index ee4a05c318b..3282f6f0ccf 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -41,12 +41,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod index 44a9e3c4773..1d35f3b54b7 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.mod @@ -12,8 +12,8 @@ require ( go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/sdk/metric v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -28,7 +28,7 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum index ee4a05c318b..3282f6f0ccf 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -41,12 +41,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/otlp/otlptrace/go.mod b/exporters/otlp/otlptrace/go.mod index f4da96602a5..4ded78c82ae 100644 --- a/exporters/otlp/otlptrace/go.mod +++ b/exporters/otlp/otlptrace/go.mod @@ -9,7 +9,7 @@ require ( go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.33.0 ) require ( @@ -20,7 +20,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/otlp/otlptrace/go.sum b/exporters/otlp/otlptrace/go.sum index 32b7e498168..991b649f4d8 100644 --- a/exporters/otlp/otlptrace/go.sum +++ b/exporters/otlp/otlptrace/go.sum @@ -25,10 +25,10 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxikMeI= go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.mod b/exporters/otlp/otlptrace/otlptracegrpc/go.mod index 8a8599f0870..3ee7bae8e60 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.mod +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.mod @@ -12,8 +12,8 @@ require ( go.opentelemetry.io/proto/otlp v1.1.0 go.uber.org/goleak v1.3.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -26,7 +26,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/exporters/otlp/otlptrace/otlptracegrpc/go.sum b/exporters/otlp/otlptrace/otlptracegrpc/go.sum index 96cffd31b9f..0a51e7e9a60 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/go.sum +++ b/exporters/otlp/otlptrace/otlptracegrpc/go.sum @@ -32,8 +32,8 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -43,12 +43,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.mod b/exporters/otlp/otlptrace/otlptracehttp/go.mod index d079b79718f..a3d6a6084d0 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.mod +++ b/exporters/otlp/otlptrace/otlptracehttp/go.mod @@ -10,8 +10,8 @@ require ( go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 go.opentelemetry.io/proto/otlp v1.1.0 - google.golang.org/grpc v1.62.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/grpc v1.62.1 + google.golang.org/protobuf v1.33.0 ) require ( @@ -24,7 +24,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/net v0.20.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect diff --git a/exporters/otlp/otlptrace/otlptracehttp/go.sum b/exporters/otlp/otlptrace/otlptracehttp/go.sum index de2668d0b61..04a357bd0a9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/go.sum +++ b/exporters/otlp/otlptrace/otlptracehttp/go.sum @@ -30,8 +30,8 @@ go.opentelemetry.io/proto/otlp v1.1.0 h1:2Di21piLrCqJ3U3eXGCTPHE9R8Nh+0uglSnOyxi go.opentelemetry.io/proto/otlp v1.1.0/go.mod h1:GpBHCBWiqvVLDqmHZsoMM3C5ySeKTC7ej/RNTae6MdY= golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -41,12 +41,12 @@ google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1: google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.0 h1:HQKZ/fa1bXkX1oFOvSjmZEUL8wLSaZTjCcLAlmZRtdk= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= +google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/prometheus/go.mod b/exporters/prometheus/go.mod index 9806a7d6e8f..51c44b2ade1 100644 --- a/exporters/prometheus/go.mod +++ b/exporters/prometheus/go.mod @@ -10,7 +10,7 @@ require ( go.opentelemetry.io/otel/metric v1.24.0 go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/sdk/metric v1.24.0 - google.golang.org/protobuf v1.32.0 + google.golang.org/protobuf v1.33.0 ) require ( @@ -24,7 +24,7 @@ require ( github.com/prometheus/common v0.48.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/prometheus/go.sum b/exporters/prometheus/go.sum index 571f2b58ceb..b08cfb3eb83 100644 --- a/exporters/prometheus/go.sum +++ b/exporters/prometheus/go.sum @@ -30,10 +30,10 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/exporters/stdout/stdoutmetric/go.mod b/exporters/stdout/stdoutmetric/go.mod index bd111a6423e..c750983c847 100644 --- a/exporters/stdout/stdoutmetric/go.mod +++ b/exporters/stdout/stdoutmetric/go.mod @@ -16,7 +16,7 @@ require ( github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdoutmetric/go.sum b/exporters/stdout/stdoutmetric/go.sum index 08b2c141d1c..e2eeaf7227b 100644 --- a/exporters/stdout/stdoutmetric/go.sum +++ b/exporters/stdout/stdoutmetric/go.sum @@ -11,8 +11,8 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/stdout/stdouttrace/go.mod b/exporters/stdout/stdouttrace/go.mod index c24f4f3c7ca..c84416a1ad7 100644 --- a/exporters/stdout/stdouttrace/go.mod +++ b/exporters/stdout/stdouttrace/go.mod @@ -20,7 +20,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/stdout/stdouttrace/go.sum b/exporters/stdout/stdouttrace/go.sum index 08b2c141d1c..e2eeaf7227b 100644 --- a/exporters/stdout/stdouttrace/go.sum +++ b/exporters/stdout/stdouttrace/go.sum @@ -11,8 +11,8 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/exporters/zipkin/go.mod b/exporters/zipkin/go.mod index aa0d4f1b4aa..1e20759b930 100644 --- a/exporters/zipkin/go.mod +++ b/exporters/zipkin/go.mod @@ -17,7 +17,7 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/exporters/zipkin/go.sum b/exporters/zipkin/go.sum index 24c8c47dddc..3cbd0738622 100644 --- a/exporters/zipkin/go.sum +++ b/exporters/zipkin/go.sum @@ -13,8 +13,8 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/internal/tools/go.mod b/internal/tools/go.mod index 27622cdd224..b04cb121c12 100644 --- a/internal/tools/go.mod +++ b/internal/tools/go.mod @@ -15,7 +15,7 @@ require ( go.opentelemetry.io/build-tools/multimod v0.13.0 go.opentelemetry.io/build-tools/semconvgen v0.13.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 - golang.org/x/tools v0.18.0 + golang.org/x/tools v0.19.0 golang.org/x/vuln v1.0.4 ) @@ -202,14 +202,14 @@ require ( go.tmz.dev/musttag v0.7.2 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/mod v0.16.0 // indirect + golang.org/x/net v0.22.0 // indirect golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/protobuf v1.32.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/tools/go.sum b/internal/tools/go.sum index 2e35003affa..bbe820ceb04 100644 --- a/internal/tools/go.sum +++ b/internal/tools/go.sum @@ -666,8 +666,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -712,8 +712,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= +golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -754,8 +754,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -832,8 +832,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -841,8 +841,8 @@ golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -923,8 +923,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= +golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= golang.org/x/vuln v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I= golang.org/x/vuln v1.0.4/go.mod h1:NbJdUQhX8jY++FtuhrXs2Eyx0yePo9pF7nPlIjo9aaQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1006,8 +1006,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/sdk/go.mod b/sdk/go.mod index 2a7f014c104..28973b2f05b 100644 --- a/sdk/go.mod +++ b/sdk/go.mod @@ -10,7 +10,7 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 - golang.org/x/sys v0.17.0 + golang.org/x/sys v0.18.0 ) require ( diff --git a/sdk/go.sum b/sdk/go.sum index 08b2c141d1c..e2eeaf7227b 100644 --- a/sdk/go.sum +++ b/sdk/go.sum @@ -11,8 +11,8 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/metric/go.mod b/sdk/metric/go.mod index 4a3592d5481..feddeb32a0a 100644 --- a/sdk/metric/go.mod +++ b/sdk/metric/go.mod @@ -15,7 +15,7 @@ require ( require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/sys v0.18.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/metric/go.sum b/sdk/metric/go.sum index 08b2c141d1c..e2eeaf7227b 100644 --- a/sdk/metric/go.sum +++ b/sdk/metric/go.sum @@ -11,8 +11,8 @@ 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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= From 1fe2f03854b9c913e939c5bd8395c4f2afbb4993 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy <126021+ash2k@users.noreply.github.com> Date: Tue, 12 Mar 2024 02:31:19 +1100 Subject: [PATCH 02/15] Deprecate Sortable (#4734) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Deprecate Sortable * Remove redundant checks * Move code to a non-deprecated func * Apply suggestions from code review Co-authored-by: Tyler Yahn * Mention individual deprecated function * Update attribute/set.go Co-authored-by: Robert Pająk * Add BenchmarkNewSet --------- Co-authored-by: Tyler Yahn Co-authored-by: Robert Pająk --- CHANGELOG.md | 6 +++ attribute/set.go | 107 +++++++++++++++++------------------------- attribute/set_test.go | 19 ++++++++ 3 files changed, 69 insertions(+), 63 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04b1d584de0..cf7ea13693e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Drop support for [Go 1.20]. (#4967) +### Deprecated + +- Deprecate `go.opentelemetry.io/otel/attribute.Sortable` type. (#4734) +- Deprecate `go.opentelemetry.io/otel/attribute.NewSetWithSortable` function. (#4734) +- Deprecate `go.opentelemetry.io/otel/attribute.NewSetWithSortableFiltered` function. (#4734) + ## [1.24.0/0.46.0/0.0.1-alpha] 2024-02-23 This release is the last to support [Go 1.20]. diff --git a/attribute/set.go b/attribute/set.go index 6c335a08570..bff9c7fdbb9 100644 --- a/attribute/set.go +++ b/attribute/set.go @@ -4,10 +4,11 @@ package attribute // import "go.opentelemetry.io/otel/attribute" import ( + "cmp" "encoding/json" "reflect" + "slices" "sort" - "sync" ) type ( @@ -37,10 +38,11 @@ type ( iface interface{} } - // Sortable implements sort.Interface, used for sorting KeyValue. This is - // an exported type to support a memory optimization. A pointer to one of - // these is needed for the call to sort.Stable(), which the caller may - // provide in order to avoid an allocation. See NewSetWithSortable(). + // Sortable implements sort.Interface, used for sorting KeyValue. + // + // Deprecated: This type is no longer used. It was added as a performance + // optimization for Go < 1.21 that is no longer needed (Go < 1.21 is no + // longer supported by the module). Sortable []KeyValue ) @@ -54,12 +56,6 @@ var ( iface: [0]KeyValue{}, }, } - - // sortables is a pool of Sortables used to create Sets with a user does - // not provide one. - sortables = sync.Pool{ - New: func() interface{} { return new(Sortable) }, - } ) // EmptySet returns a reference to a Set with no elements. @@ -185,13 +181,7 @@ func empty() Set { // Except for empty sets, this method adds an additional allocation compared // with calls that include a Sortable. func NewSet(kvs ...KeyValue) Set { - // Check for empty set. - if len(kvs) == 0 { - return empty() - } - srt := sortables.Get().(*Sortable) - s, _ := NewSetWithSortableFiltered(kvs, srt, nil) - sortables.Put(srt) + s, _ := NewSetWithFiltered(kvs, nil) return s } @@ -199,12 +189,10 @@ func NewSet(kvs ...KeyValue) Set { // NewSetWithSortableFiltered for more details. // // This call includes a Sortable option as a memory optimization. -func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set { - // Check for empty set. - if len(kvs) == 0 { - return empty() - } - s, _ := NewSetWithSortableFiltered(kvs, tmp, nil) +// +// Deprecated: Use [NewSet] instead. +func NewSetWithSortable(kvs []KeyValue, _ *Sortable) Set { + s, _ := NewSetWithFiltered(kvs, nil) return s } @@ -218,48 +206,12 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) { if len(kvs) == 0 { return empty(), nil } - srt := sortables.Get().(*Sortable) - s, filtered := NewSetWithSortableFiltered(kvs, srt, filter) - sortables.Put(srt) - return s, filtered -} - -// NewSetWithSortableFiltered returns a new Set. -// -// Duplicate keys are eliminated by taking the last value. This -// re-orders the input slice so that unique last-values are contiguous -// at the end of the slice. -// -// This ensures the following: -// -// - Last-value-wins semantics -// - Caller sees the reordering, but doesn't lose values -// - Repeated call preserve last-value wins. -// -// Note that methods are defined on Set, although this returns Set. Callers -// can avoid memory allocations by: -// -// - allocating a Sortable for use as a temporary in this method -// - allocating a Set for storing the return value of this constructor. -// -// The result maintains a cache of encoded attributes, by attribute.EncoderID. -// This value should not be copied after its first use. -// -// The second []KeyValue return value is a list of attributes that were -// excluded by the Filter (if non-nil). -func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue) { - // Check for empty set. - if len(kvs) == 0 { - return empty(), nil - } - - *tmp = kvs // Stable sort so the following de-duplication can implement // last-value-wins semantics. - sort.Stable(tmp) - - *tmp = nil + slices.SortStableFunc(kvs, func(a, b KeyValue) int { + return cmp.Compare(a.Key, b.Key) + }) position := len(kvs) - 1 offset := position - 1 @@ -287,6 +239,35 @@ func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (S return Set{equivalent: computeDistinct(kvs)}, nil } +// NewSetWithSortableFiltered returns a new Set. +// +// Duplicate keys are eliminated by taking the last value. This +// re-orders the input slice so that unique last-values are contiguous +// at the end of the slice. +// +// This ensures the following: +// +// - Last-value-wins semantics +// - Caller sees the reordering, but doesn't lose values +// - Repeated call preserve last-value wins. +// +// Note that methods are defined on Set, although this returns Set. Callers +// can avoid memory allocations by: +// +// - allocating a Sortable for use as a temporary in this method +// - allocating a Set for storing the return value of this constructor. +// +// The result maintains a cache of encoded attributes, by attribute.EncoderID. +// This value should not be copied after its first use. +// +// The second []KeyValue return value is a list of attributes that were +// excluded by the Filter (if non-nil). +// +// Deprecated: Use [NewSetWithFiltered] instead. +func NewSetWithSortableFiltered(kvs []KeyValue, _ *Sortable, filter Filter) (Set, []KeyValue) { + return NewSetWithFiltered(kvs, filter) +} + // filteredToFront filters slice in-place using keep function. All KeyValues that need to // be removed are moved to the front. All KeyValues that need to be kept are // moved (in-order) to the back. The index for the first KeyValue to be kept is diff --git a/attribute/set_test.go b/attribute/set_test.go index 4920f4cbf15..b851d1fc7b0 100644 --- a/attribute/set_test.go +++ b/attribute/set_test.go @@ -356,3 +356,22 @@ func BenchmarkFiltering(b *testing.B) { b.Run("Filtered", benchFn(func(kv attribute.KeyValue) bool { return kv.Key == "A" })) b.Run("AllDropped", benchFn(func(attribute.KeyValue) bool { return false })) } + +var sinkSet attribute.Set + +func BenchmarkNewSet(b *testing.B) { + attrs := []attribute.KeyValue{ + attribute.String("B1", "2"), + attribute.String("C2", "5"), + attribute.String("B3", "2"), + attribute.String("C4", "1"), + attribute.String("A5", "4"), + attribute.String("C6", "3"), + attribute.String("A7", "1"), + } + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + sinkSet = attribute.NewSet(attrs...) + } +} From 9184b10456923f14301a654b3c662fa45ea80e8d Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Mon, 11 Mar 2024 23:59:43 -0700 Subject: [PATCH 03/15] exporters/otlp: fix spelling errors (#5050) --- exporters/otlp/otlpmetric/otlpmetrichttp/client.go | 2 +- exporters/otlp/otlptrace/otlptracehttp/client.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 4cfd2e5ac03..5b1e18e3f95 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -227,7 +227,7 @@ func (c *client) newRequest(ctx context.Context, body []byte) (request, error) { if _, err := gz.Write(body); err != nil { return req, err } - // Close needs to be called to ensure body if fully written. + // Close needs to be called to ensure body is fully written. if err := gz.Close(); err != nil { return req, err } diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 65224fafe49..d14cd51996b 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -236,7 +236,7 @@ func (d *client) newRequest(body []byte) (request, error) { if _, err := gz.Write(body); err != nil { return req, err } - // Close needs to be called to ensure body if fully written. + // Close needs to be called to ensure body is fully written. if err := gz.Close(); err != nil { return req, err } From 6ff94ab620b71bbe35e08ec09d456df1d4e4508b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Tue, 12 Mar 2024 08:39:28 +0100 Subject: [PATCH 04/15] trace: SpanFromContext and SpanContextFromContext make no allocs (#5049) --- CHANGELOG.md | 4 ++++ trace/context.go | 4 ++-- trace/context_test.go | 10 ++++++++++ trace/noop.go | 4 ++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf7ea13693e..ec2947488c7 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 + +- `SpanFromContext` and `SpanContextFromContext` in `go.opentelemetry.io/otel/trace` no longer make a heap allocation when the passed context has no span. (#5049) + ### Fixed - Clarify the documentation about equivalence guarantees for the `Set` and `Distinct` types in `go.opentelemetry.io/otel/attribute`. (#5027) diff --git a/trace/context.go b/trace/context.go index 5074bb44557..5650a174b4a 100644 --- a/trace/context.go +++ b/trace/context.go @@ -36,12 +36,12 @@ func ContextWithRemoteSpanContext(parent context.Context, rsc SpanContext) conte // performs no operations is returned. func SpanFromContext(ctx context.Context) Span { if ctx == nil { - return noopSpan{} + return noopSpanInstance } if span, ok := ctx.Value(currentSpanKey).(Span); ok { return span } - return noopSpan{} + return noopSpanInstance } // SpanContextFromContext returns the current Span's SpanContext. diff --git a/trace/context_test.go b/trace/context_test.go index d9378e1c430..38deb0aee5f 100644 --- a/trace/context_test.go +++ b/trace/context_test.go @@ -77,6 +77,16 @@ func TestSpanFromContext(t *testing.T) { // Ensure SpanContextFromContext is just // SpanFromContext(…).SpanContext(). assert.Equal(t, tc.expectedSpan.SpanContext(), SpanContextFromContext(tc.context)) + + // Check that SpanFromContext does not produce any heap allocation. + assert.Equal(t, 0.0, testing.AllocsPerRun(5, func() { + SpanFromContext(tc.context) + }), "SpanFromContext allocs") + + // Check that SpanContextFromContext does not produce any heap allocation. + assert.Equal(t, 0.0, testing.AllocsPerRun(5, func() { + SpanContextFromContext(tc.context) + }), "SpanContextFromContext allocs") }) } } diff --git a/trace/noop.go b/trace/noop.go index 583f109b064..84c775492ba 100644 --- a/trace/noop.go +++ b/trace/noop.go @@ -41,7 +41,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption span := SpanFromContext(ctx) if _, ok := span.(nonRecordingSpan); !ok { // span is likely already a noopSpan, but let's be sure - span = noopSpan{} + span = noopSpanInstance } return ContextWithSpan(ctx, span), span } @@ -49,7 +49,7 @@ func (t noopTracer) Start(ctx context.Context, name string, _ ...SpanStartOption // noopSpan is an implementation of Span that performs no operations. type noopSpan struct{ embedded.Span } -var _ Span = noopSpan{} +var noopSpanInstance Span = noopSpan{} // SpanContext returns an empty span context. func (noopSpan) SpanContext() SpanContext { return SpanContext{} } From 76921e90204033b73d1d469a0df1541fd80c6c95 Mon Sep 17 00:00:00 2001 From: tgolang <154592711+tgolang@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:45:20 +0800 Subject: [PATCH 05/15] chore: remove repetitive words (#5048) Signed-off-by: tgolang --- semconv/v1.10.0/trace.go | 4 ++-- semconv/v1.11.0/trace.go | 4 ++-- semconv/v1.12.0/trace.go | 4 ++-- semconv/v1.13.0/trace.go | 4 ++-- semconv/v1.14.0/trace.go | 4 ++-- semconv/v1.15.0/trace.go | 4 ++-- semconv/v1.16.0/trace.go | 4 ++-- semconv/v1.4.0/trace.go | 4 ++-- semconv/v1.5.0/trace.go | 4 ++-- semconv/v1.6.1/trace.go | 4 ++-- semconv/v1.7.0/trace.go | 4 ++-- semconv/v1.8.0/trace.go | 4 ++-- semconv/v1.9.0/trace.go | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/semconv/v1.10.0/trace.go b/semconv/v1.10.0/trace.go index 75f5f3b7995..001d5cbf306 100644 --- a/semconv/v1.10.0/trace.go +++ b/semconv/v1.10.0/trace.go @@ -1191,7 +1191,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1252,7 +1252,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.11.0/trace.go b/semconv/v1.11.0/trace.go index a4220f3de00..5099de95137 100644 --- a/semconv/v1.11.0/trace.go +++ b/semconv/v1.11.0/trace.go @@ -1195,7 +1195,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1256,7 +1256,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.12.0/trace.go b/semconv/v1.12.0/trace.go index fdae2cb3a56..70c25dc2108 100644 --- a/semconv/v1.12.0/trace.go +++ b/semconv/v1.12.0/trace.go @@ -1195,7 +1195,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1256,7 +1256,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.13.0/trace.go b/semconv/v1.13.0/trace.go index 0e0f4f86336..21ca87fe470 100644 --- a/semconv/v1.13.0/trace.go +++ b/semconv/v1.13.0/trace.go @@ -1225,7 +1225,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // RequirementLevel: Optional @@ -1286,7 +1286,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.14.0/trace.go b/semconv/v1.14.0/trace.go index 6d1dc2b68e0..ca13dd700a3 100644 --- a/semconv/v1.14.0/trace.go +++ b/semconv/v1.14.0/trace.go @@ -1231,7 +1231,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // RequirementLevel: Optional @@ -1292,7 +1292,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.15.0/trace.go b/semconv/v1.15.0/trace.go index f4998b85236..a021bc67a96 100644 --- a/semconv/v1.15.0/trace.go +++ b/semconv/v1.15.0/trace.go @@ -1261,7 +1261,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // RequirementLevel: Optional @@ -1322,7 +1322,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.16.0/trace.go b/semconv/v1.16.0/trace.go index 173a47894e5..5bb21e9a8cd 100644 --- a/semconv/v1.16.0/trace.go +++ b/semconv/v1.16.0/trace.go @@ -1259,7 +1259,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // RequirementLevel: Optional @@ -1320,7 +1320,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.4.0/trace.go b/semconv/v1.4.0/trace.go index 47fe261aea5..006482a3078 100644 --- a/semconv/v1.4.0/trace.go +++ b/semconv/v1.4.0/trace.go @@ -1001,7 +1001,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1062,7 +1062,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.5.0/trace.go b/semconv/v1.5.0/trace.go index 8c0600b9535..cd230ca7a21 100644 --- a/semconv/v1.5.0/trace.go +++ b/semconv/v1.5.0/trace.go @@ -1012,7 +1012,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1073,7 +1073,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.6.1/trace.go b/semconv/v1.6.1/trace.go index 1fb3573e14a..8ad93c0110c 100644 --- a/semconv/v1.6.1/trace.go +++ b/semconv/v1.6.1/trace.go @@ -1117,7 +1117,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1178,7 +1178,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.7.0/trace.go b/semconv/v1.7.0/trace.go index da0fdf660b7..3c5a4df9f6e 100644 --- a/semconv/v1.7.0/trace.go +++ b/semconv/v1.7.0/trace.go @@ -1131,7 +1131,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1192,7 +1192,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.8.0/trace.go b/semconv/v1.8.0/trace.go index e6c40347374..f8ce41a1f2f 100644 --- a/semconv/v1.8.0/trace.go +++ b/semconv/v1.8.0/trace.go @@ -1119,7 +1119,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1180,7 +1180,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] diff --git a/semconv/v1.9.0/trace.go b/semconv/v1.9.0/trace.go index 0917675d6bb..a97d38f1e21 100644 --- a/semconv/v1.9.0/trace.go +++ b/semconv/v1.9.0/trace.go @@ -1137,7 +1137,7 @@ const ( // Stability: stable // Examples: 'Users', 'CatsTable' AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - // The the number of items in the `TableNames` response parameter. + // The number of items in the `TableNames` response parameter. // // Type: int // Required: No @@ -1198,7 +1198,7 @@ const ( // Stability: stable // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - // The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` + // The JSON-serialized value of each item in the `GlobalSecondaryIndexUpdates` // request field. // // Type: string[] From 9a515ceb749ea347aaa1522a4ac581e5ac3b2b69 Mon Sep 17 00:00:00 2001 From: Mickael Alliel Date: Tue, 12 Mar 2024 12:04:06 +0200 Subject: [PATCH 06/15] otlptracehttp, otlpmetrichttp: Add WithProxy option (#4906) --- CHANGELOG.md | 5 ++++ .../otlpmetricgrpc/internal/oconf/options.go | 14 +++++++++++ .../internal/oconf/options_test.go | 25 +++++++++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/client.go | 15 ++++++++--- .../otlpmetric/otlpmetrichttp/client_test.go | 19 ++++++++++++++ .../otlp/otlpmetric/otlpmetrichttp/config.go | 14 +++++++++++ .../otlpmetrichttp/internal/oconf/options.go | 14 +++++++++++ .../internal/oconf/options_test.go | 25 +++++++++++++++++++ .../internal/otlpconfig/options.go | 14 +++++++++++ .../internal/otlpconfig/options_test.go | 25 +++++++++++++++++++ .../otlp/otlptrace/otlptracehttp/client.go | 15 ++++++++--- .../otlptrace/otlptracehttp/client_test.go | 19 ++++++++++++++ .../internal/otlpconfig/options.go | 14 +++++++++++ .../internal/otlpconfig/options_test.go | 25 +++++++++++++++++++ .../otlp/otlptrace/otlptracehttp/options.go | 14 +++++++++++ .../otlp/otlpmetric/oconf/options.go.tmpl | 14 +++++++++++ .../otlpmetric/oconf/options_test.go.tmpl | 25 +++++++++++++++++++ .../otlp/otlptrace/otlpconfig/options.go.tmpl | 14 +++++++++++ .../otlptrace/otlpconfig/options_test.go.tmpl | 25 +++++++++++++++++++ 19 files changed, 327 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec2947488c7..689ef03e18c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm ## [Unreleased] +### Added + +- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4906) +- Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906) + ### Changed - `SpanFromContext` and `SpanContextFromContext` in `go.opentelemetry.io/otel/trace` no longer make a heap allocation when the passed context has no span. (#5049) diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go index 316a26bd681..b6ed9a2bb65 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go @@ -9,6 +9,7 @@ package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlp import ( "crypto/tls" "fmt" + "net/http" "net/url" "path" "strings" @@ -42,6 +43,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -56,6 +61,8 @@ type ( TemporalitySelector metric.TemporalitySelector AggregationSelector metric.AggregationSelector + + Proxy HTTPTransportProxyFunc } Config struct { @@ -360,3 +367,10 @@ func WithAggregationSelector(selector metric.AggregationSelector) GenericOption return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Proxy = pf + return cfg + }) +} diff --git a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go index fb211a215e0..a24a9544556 100644 --- a/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go @@ -8,6 +8,8 @@ package oconf import ( "errors" + "net/http" + "net/url" "testing" "time" @@ -444,6 +446,29 @@ func TestConfigs(t *testing.T) { assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, + + // Proxy Tests + { + name: "Test With Proxy", + opts: []GenericOption{ + WithProxy(func(r *http.Request) (*url.URL, error) { + return url.Parse("http://proxy.com") + }), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.NotNil(t, c.Metrics.Proxy) + proxyURL, err := c.Metrics.Proxy(&http.Request{}) + assert.NoError(t, err) + assert.Equal(t, "http://proxy.com", proxyURL.String()) + }, + }, + { + name: "Test Without Proxy", + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Nil(t, c.Metrics.Proxy) + }, + }, } for _, tt := range tests { diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go index 5b1e18e3f95..eeb39339d45 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client.go @@ -58,10 +58,17 @@ func newClient(cfg oconf.Config) (*client, error) { Transport: ourTransport, Timeout: cfg.Metrics.Timeout, } - if cfg.Metrics.TLSCfg != nil { - transport := ourTransport.Clone() - transport.TLSClientConfig = cfg.Metrics.TLSCfg - httpClient.Transport = transport + + if cfg.Metrics.TLSCfg != nil || cfg.Metrics.Proxy != nil { + clonedTransport := ourTransport.Clone() + httpClient.Transport = clonedTransport + + if cfg.Metrics.TLSCfg != nil { + clonedTransport.TLSClientConfig = cfg.Metrics.TLSCfg + } + if cfg.Metrics.Proxy != nil { + clonedTransport.Proxy = cfg.Metrics.Proxy + } } u := &url.URL{ diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go index bd5205764f7..2838fd9d011 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go @@ -9,6 +9,7 @@ import ( "errors" "fmt" "net/http" + "net/url" "strings" "testing" "time" @@ -227,4 +228,22 @@ func TestConfig(t *testing.T) { require.Contains(t, got, key) assert.Equal(t, got[key], []string{headers[key]}) }) + + t.Run("WithProxy", func(t *testing.T) { + headerKeySetInProxy := http.CanonicalHeaderKey("X-Using-Proxy") + headerValueSetInProxy := "true" + exp, coll := factoryFunc("", nil, WithProxy(func(r *http.Request) (*url.URL, error) { + r.Header.Set(headerKeySetInProxy, headerValueSetInProxy) + return r.URL, nil + })) + ctx := context.Background() + t.Cleanup(func() { require.NoError(t, coll.Shutdown(ctx)) }) + require.NoError(t, exp.Export(ctx, &metricdata.ResourceMetrics{})) + // Ensure everything is flushed. + require.NoError(t, exp.Shutdown(ctx)) + + got := coll.Headers() + require.Contains(t, got, headerKeySetInProxy) + assert.Equal(t, got[headerKeySetInProxy], []string{headerValueSetInProxy}) + }) } diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go index 48706b68151..28b058e1634 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/config.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/config.go @@ -5,6 +5,8 @@ package otlpmetrichttp // import "go.opentelemetry.io/otel/exporters/otlp/otlpme import ( "crypto/tls" + "net/http" + "net/url" "time" "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf" @@ -16,6 +18,11 @@ import ( // collector. type Compression oconf.Compression +// HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. +// This type is compatible with http.Transport.Proxy and can be used to set a custom proxy function +// to the OTLP HTTP client. +type HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + const ( // NoCompression tells the driver to send payloads without // compression. @@ -206,3 +213,10 @@ func WithTemporalitySelector(selector metric.TemporalitySelector) Option { func WithAggregationSelector(selector metric.AggregationSelector) Option { return wrappedOption{oconf.WithAggregationSelector(selector)} } + +// WithProxy sets the Proxy function the client will use to determine the +// proxy to use for an HTTP request. If this option is not used, the client +// will use [http.ProxyFromEnvironment]. +func WithProxy(pf HTTPTransportProxyFunc) Option { + return wrappedOption{oconf.WithProxy(oconf.HTTPTransportProxyFunc(pf))} +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go index df64cb916de..9bbf0941f94 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go @@ -9,6 +9,7 @@ package oconf // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlp import ( "crypto/tls" "fmt" + "net/http" "net/url" "path" "strings" @@ -42,6 +43,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -56,6 +61,8 @@ type ( TemporalitySelector metric.TemporalitySelector AggregationSelector metric.AggregationSelector + + Proxy HTTPTransportProxyFunc } Config struct { @@ -360,3 +367,10 @@ func WithAggregationSelector(selector metric.AggregationSelector) GenericOption return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Proxy = pf + return cfg + }) +} diff --git a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go index 0bb67685ab1..3401f8ec524 100644 --- a/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go +++ b/exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go @@ -8,6 +8,8 @@ package oconf import ( "errors" + "net/http" + "net/url" "testing" "time" @@ -444,6 +446,29 @@ func TestConfigs(t *testing.T) { assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, + + // Proxy Tests + { + name: "Test With Proxy", + opts: []GenericOption{ + WithProxy(func(r *http.Request) (*url.URL, error) { + return url.Parse("http://proxy.com") + }), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.NotNil(t, c.Metrics.Proxy) + proxyURL, err := c.Metrics.Proxy(&http.Request{}) + assert.NoError(t, err) + assert.Equal(t, "http://proxy.com", proxyURL.String()) + }, + }, + { + name: "Test Without Proxy", + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Nil(t, c.Metrics.Proxy) + }, + }, } for _, tt := range tests { diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index 6b829cf69b7..e3f7f431fe0 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -9,6 +9,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "net/http" "net/url" "path" "strings" @@ -35,6 +36,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -46,6 +51,8 @@ type ( // gRPC configurations GRPCCredentials credentials.TransportCredentials + + Proxy HTTPTransportProxyFunc } Config struct { @@ -332,3 +339,10 @@ func WithTimeout(duration time.Duration) GenericOption { return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Proxy = pf + return cfg + }) +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go index f782783f1d5..87fd281dfc5 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go @@ -8,6 +8,8 @@ package otlpconfig import ( "errors" + "net/http" + "net/url" "testing" "time" @@ -408,6 +410,29 @@ func TestConfigs(t *testing.T) { assert.Equal(t, c.Traces.Timeout, 5*time.Second) }, }, + + // Proxy Tests + { + name: "Test With Proxy", + opts: []GenericOption{ + WithProxy(func(r *http.Request) (*url.URL, error) { + return url.Parse("http://proxy.com") + }), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.NotNil(t, c.Traces.Proxy) + proxyURL, err := c.Traces.Proxy(&http.Request{}) + assert.NoError(t, err) + assert.Equal(t, "http://proxy.com", proxyURL.String()) + }, + }, + { + name: "Test Without Proxy", + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Nil(t, c.Traces.Proxy) + }, + }, } for _, tt := range tests { diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index d14cd51996b..1c487a09630 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -74,10 +74,17 @@ func NewClient(opts ...Option) otlptrace.Client { Transport: ourTransport, Timeout: cfg.Traces.Timeout, } - if cfg.Traces.TLSCfg != nil { - transport := ourTransport.Clone() - transport.TLSClientConfig = cfg.Traces.TLSCfg - httpClient.Transport = transport + + if cfg.Traces.TLSCfg != nil || cfg.Traces.Proxy != nil { + clonedTransport := ourTransport.Clone() + httpClient.Transport = clonedTransport + + if cfg.Traces.TLSCfg != nil { + clonedTransport.TLSClientConfig = cfg.Traces.TLSCfg + } + if cfg.Traces.Proxy != nil { + clonedTransport.Proxy = cfg.Traces.Proxy + } } stopCh := make(chan struct{}) diff --git a/exporters/otlp/otlptrace/otlptracehttp/client_test.go b/exporters/otlp/otlptrace/otlptracehttp/client_test.go index aa25fedb92a..0494f82c9a7 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client_test.go @@ -8,6 +8,7 @@ import ( "errors" "fmt" "net/http" + "net/url" "strings" "testing" "time" @@ -36,6 +37,10 @@ var ( customUserAgentHeader = map[string]string{ "user-agent": "custome-user-agent", } + + customProxyHeader = map[string]string{ + "header-added-via-proxy": "proxy-value", + } ) func TestEndToEnd(t *testing.T) { @@ -150,6 +155,20 @@ func TestEndToEnd(t *testing.T) { ExpectedHeaders: customUserAgentHeader, }, }, + { + name: "with custom proxy", + opts: []otlptracehttp.Option{ + otlptracehttp.WithProxy(func(r *http.Request) (*url.URL, error) { + for k, v := range customProxyHeader { + r.Header.Set(k, v) + } + return r.URL, nil + }), + }, + mcCfg: mockCollectorConfig{ + ExpectedHeaders: customProxyHeader, + }, + }, } for _, tc := range tests { diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go index 5b286a232d0..45fefc4dd8c 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go @@ -9,6 +9,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ import ( "crypto/tls" "fmt" + "net/http" "net/url" "path" "strings" @@ -35,6 +36,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -46,6 +51,8 @@ type ( // gRPC configurations GRPCCredentials credentials.TransportCredentials + + Proxy HTTPTransportProxyFunc } Config struct { @@ -332,3 +339,10 @@ func WithTimeout(duration time.Duration) GenericOption { return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Proxy = pf + return cfg + }) +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go index 0257d8f9ffe..1df421a34dc 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go +++ b/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go @@ -8,6 +8,8 @@ package otlpconfig import ( "errors" + "net/http" + "net/url" "testing" "time" @@ -408,6 +410,29 @@ func TestConfigs(t *testing.T) { assert.Equal(t, c.Traces.Timeout, 5*time.Second) }, }, + + // Proxy Tests + { + name: "Test With Proxy", + opts: []GenericOption{ + WithProxy(func(r *http.Request) (*url.URL, error) { + return url.Parse("http://proxy.com") + }), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.NotNil(t, c.Traces.Proxy) + proxyURL, err := c.Traces.Proxy(&http.Request{}) + assert.NoError(t, err) + assert.Equal(t, "http://proxy.com", proxyURL.String()) + }, + }, + { + name: "Test Without Proxy", + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Nil(t, c.Traces.Proxy) + }, + }, } for _, tt := range tests { diff --git a/exporters/otlp/otlptrace/otlptracehttp/options.go b/exporters/otlp/otlptrace/otlptracehttp/options.go index 37679dd373c..a3bb2b66faa 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/options.go +++ b/exporters/otlp/otlptrace/otlptracehttp/options.go @@ -5,6 +5,8 @@ package otlptracehttp // import "go.opentelemetry.io/otel/exporters/otlp/otlptra import ( "crypto/tls" + "net/http" + "net/url" "time" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig" @@ -15,6 +17,11 @@ import ( // collector. type Compression otlpconfig.Compression +// HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. +// This type is compatible with http.Transport.Proxy and can be used to set a custom proxy function +// to the OTLP HTTP client. +type HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + const ( // NoCompression tells the driver to send payloads without // compression. @@ -132,3 +139,10 @@ func WithTimeout(duration time.Duration) Option { func WithRetry(rc RetryConfig) Option { return wrappedOption{otlpconfig.WithRetry(retry.Config(rc))} } + +// WithProxy sets the Proxy function the client will use to determine the +// proxy to use for an HTTP request. If this option is not used, the client +// will use [http.ProxyFromEnvironment]. +func WithProxy(pf HTTPTransportProxyFunc) Option { + return wrappedOption{otlpconfig.WithProxy(otlpconfig.HTTPTransportProxyFunc(pf))} +} diff --git a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl index e7a99af8d54..071a144fdf5 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options.go.tmpl @@ -9,6 +9,7 @@ package oconf import ( "crypto/tls" "fmt" + "net/http" "net/url" "path" "strings" @@ -42,6 +43,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -56,6 +61,8 @@ type ( TemporalitySelector metric.TemporalitySelector AggregationSelector metric.AggregationSelector + + Proxy HTTPTransportProxyFunc } Config struct { @@ -360,3 +367,10 @@ func WithAggregationSelector(selector metric.AggregationSelector) GenericOption return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Metrics.Proxy = pf + return cfg + }) +} diff --git a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl index 3bd1136e52c..f266628e2ae 100644 --- a/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl +++ b/internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl @@ -8,6 +8,8 @@ package oconf import ( "errors" + "net/http" + "net/url" "testing" "time" @@ -444,6 +446,29 @@ func TestConfigs(t *testing.T) { assert.Equal(t, metric.AggregationDrop{}, got(undefinedKind)) }, }, + + // Proxy Tests + { + name: "Test With Proxy", + opts: []GenericOption{ + WithProxy(func(r *http.Request) (*url.URL, error) { + return url.Parse("http://proxy.com") + }), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.NotNil(t, c.Metrics.Proxy) + proxyURL, err := c.Metrics.Proxy(&http.Request{}) + assert.NoError(t, err) + assert.Equal(t, "http://proxy.com", proxyURL.String()) + }, + }, + { + name: "Test Without Proxy", + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Nil(t, c.Metrics.Proxy) + }, + }, } for _, tt := range tests { diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl index 8e96ec475b2..0a64afe3ce6 100644 --- a/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl +++ b/internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl @@ -9,6 +9,7 @@ package otlpconfig import ( "crypto/tls" "fmt" + "net/http" "net/url" "path" "strings" @@ -35,6 +36,10 @@ const ( ) type ( + // HTTPTransportProxyFunc is a function that resolves which URL to use as proxy for a given request. + // This type is compatible with `http.Transport.Proxy` and can be used to set a custom proxy function to the OTLP HTTP client. + HTTPTransportProxyFunc func(*http.Request) (*url.URL, error) + SignalConfig struct { Endpoint string Insecure bool @@ -46,6 +51,8 @@ type ( // gRPC configurations GRPCCredentials credentials.TransportCredentials + + Proxy HTTPTransportProxyFunc } Config struct { @@ -332,3 +339,10 @@ func WithTimeout(duration time.Duration) GenericOption { return cfg }) } + +func WithProxy(pf HTTPTransportProxyFunc) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.Proxy = pf + return cfg + }) +} diff --git a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl index 3d1a9d460c7..2a25c103e4d 100644 --- a/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl +++ b/internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl @@ -8,6 +8,8 @@ package otlpconfig import ( "errors" + "net/http" + "net/url" "testing" "time" @@ -408,6 +410,29 @@ func TestConfigs(t *testing.T) { assert.Equal(t, c.Traces.Timeout, 5*time.Second) }, }, + + // Proxy Tests + { + name: "Test With Proxy", + opts: []GenericOption{ + WithProxy(func(r *http.Request) (*url.URL, error) { + return url.Parse("http://proxy.com") + }), + }, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.NotNil(t, c.Traces.Proxy) + proxyURL, err := c.Traces.Proxy(&http.Request{}) + assert.NoError(t, err) + assert.Equal(t, "http://proxy.com", proxyURL.String()) + }, + }, + { + name: "Test Without Proxy", + opts: []GenericOption{}, + asserts: func(t *testing.T, c *Config, grpcOption bool) { + assert.Nil(t, c.Traces.Proxy) + }, + }, } for _, tt := range tests { From 81512d9f31019fc5561d4fe68bf155ddfc7b3e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 13 Mar 2024 08:25:05 +0100 Subject: [PATCH 07/15] sdk/log: Add design doc (#4954) --- sdk/log/DESIGN.md | 422 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 422 insertions(+) create mode 100644 sdk/log/DESIGN.md diff --git a/sdk/log/DESIGN.md b/sdk/log/DESIGN.md new file mode 100644 index 00000000000..521788cc407 --- /dev/null +++ b/sdk/log/DESIGN.md @@ -0,0 +1,422 @@ +# Logs SDK + +## Abstract + +`go.opentelemetry.io/otel/sdk/log` provides Logs SDK compliant with the +[specification](https://opentelemetry.io/docs/specs/otel/logs/sdk/). + +The main and recommended use case is to configure the SDK to use an OTLP +exporter with a batch processor.[^1] Therefore, the design aims to be +high-performant in this scenario. + +The prototype was created in +[#4955](https://github.com/open-telemetry/opentelemetry-go/pull/4955). + +## Modules structure + +The SDK is published as a single `go.opentelemetry.io/otel/sdk/log` Go module. + +The exporters are going to be published as following Go modules: + +- `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` +- `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` +- `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` + +## LoggerProvider + +The [LoggerProvider](https://opentelemetry.io/docs/specs/otel/logs/sdk/#loggerprovider) +is defined as follows: + +```go +type LoggerProvider struct { + embedded.LoggerProvider +} + +// NewLoggerProvider returns a new and configured LoggerProvider. +// +// By default, the returned LoggerProvider is configured with the default +// Resource and no Processors. Processors cannot be added after a LoggerProvider is +// created. This means the returned LoggerProvider, one created with no +// Processors, will perform no operations. +func NewLoggerProvider(opts ...LoggerProviderOption) *LoggerProvider + +// Logger returns a new log.Logger with the provided name and configuration. +// +// This method can be called concurrently. +// +// Logger implements the log.LoggerProvider interface. +func (*LoggerProvider) Logger(name string, options ...log.LoggerOption) log.Logger + +type LoggerProviderOption interface { /* ... */ } + +// WithResource associates a Resource with a LoggerProvider. This Resource +// represents the entity producing telemetry and is associated with all Loggers +// the LoggerProvider will create. +// +// By default, if this Option is not used, the default Resource from the +// go.opentelemetry.io/otel/sdk/resource package will be used. +func WithResource(res *resource.Resource) LoggerProviderOption +``` + +## LogRecord limits + +The [LogRecord limits](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecord-limits) +can be configured using following options: + +```go +// WithAttributeCountLimit sets the maximum allowed log record attribute count. +// Any attribute added to a log record once this limit is reached will be dropped. +// +// Setting this to zero means no attributes will be recorded. +// +// Setting this to a negative value means no limit is applied. +// +// If the OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT environment variable is set, +// and this option is not passed, that variable value will be used. +// If both are set, OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no limit 128 will be used. +func WithAttributeCountLimit(limit int) LoggerProviderOption + +// AttributeValueLengthLimit sets the maximum allowed attribute value length. +// +// This limit only applies to string and string slice attribute values. +// Any string longer than this value will be truncated to this length. +// +// Setting this to a negative value means no limit is applied. +// +// If the OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT environment variable is set, +// and this option is not passed, that variable value will be used. +// If both are set, OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, no limit (-1) will be used. +func WithAttributeValueLengthLimit(limit int) LoggerProviderOption +``` + +The limits can be also configured using the `OTEL_LOGRECORD_*` environment variables as +[defined by the specification](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#logrecord-limits). + +### Processor + +The [LogRecordProcessor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordprocessor) +is defined as follows: + +```go +// WithProcessor associates Processor with a LoggerProvider. +// +// By default, if this option is not used, the LoggerProvider will perform no +// operations; no data will be exported without a processor. +// +// Each WithProcessor creates a separate pipeline. Use custom decorators +// for advanced scenarios such as enriching with attributes. +// +// Use NewBatchingProcessor to batch log records before they are exported. +// Use NewSimpleProcessor to synchronously export log records. +func WithProcessor(processor Processor) LoggerProviderOption + +// Processor handles the processing of log records. +// +// Any of the Processor's methods may be called concurrently with itself +// or with other methods. It is the responsibility of the Processor to manage +// this concurrency. +type Processor interface { + // OnEmit is called when a Record is emitted. + // + // Implementation should not interrupt the record processing + // if the context is canceled. + // + // All retry logic must be contained in this function. The SDK does not + // implement any retry logic. All errors returned by this function are + // considered unrecoverable and will be reported to a configured error + // Handler. + // + // Before modifying a Record, the implementation must use Record.Clone + // to create a copy that shares no state with the original. + OnEmit(ctx context.Context, record Record) error + + // Shutdown is called when the SDK shuts down. Any cleanup or release of + // resources held by the exporter should be done in this call. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // After Shutdown is called, calls to Export, Shutdown, or ForceFlush + // should perform no operation and return nil error. + Shutdown(ctx context.Context) error + + // ForceFlush exports log records to the configured Exporter that have not yet + // been exported. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + ForceFlush(ctx context.Context) error +} +``` + +The user can configure custom processors and decorate built-in processors. + +### SimpleProcessor + +The [Simple processor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#simple-processor) +is defined as follows: + +```go +// SimpleProcessor implements Processor. +type SimpleProcessor struct { /* ... */ } + +// NewSimpleProcessor is a simple Processor adapter. +// +// Any of the exporter's methods may be called concurrently with itself +// or with other methods. It is the responsibility of the exporter to manage +// this concurrency. +func NewSimpleProcessor(exporter Exporter) *SimpleProcessor +``` + +### BatchingProcessor + +The [Batching processor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#batching-processor) +is defined as follows: + +```go +// BatchingProcessor implements Processor. +type BatchingProcessor struct { /* ... */ } + +// NewBatchingProcessor decorates the provided exporter +// so that the log records are batched before exporting. +// +// All of the exporter's methods are called from a single dedicated +// background goroutine. Therefore, the expoter does not need to +// be concurrent safe. +func NewBatchingProcessor(exporter Exporter, opts ...BatchingOption) *BatchingProcessor + +// BatchingOption applies a configuration to a Batcher. +type BatchingOption interface { /* ... */ } + +// WithMaxQueueSize sets the maximum queue size used by the Batcher. +// After the size is reached log records are dropped. +// +// If the OTEL_BLRP_MAX_QUEUE_SIZE environment variable is set, +// and this option is not passed, that variable value will be used. +// If both are set, OTEL_BLRP_MAX_QUEUE_SIZE will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, 2048 will be used. +// The default value is also used when the provided value is not a positive value. +func WithMaxQueueSize(max int) BatchingOption + +// WithExportInterval sets the maximum duration between batched exports. +// +// If the OTEL_BSP_SCHEDULE_DELAY environment variable is set, +// and this option is not passed, that variable value will be used. +// If both are set, OTEL_BSP_SCHEDULE_DELAY will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, 1s will be used. +// The default value is also used when the provided value is not a positive value. +func WithExportInterval(d time.Duration) BatchingOption + +// WithExportTimeout sets the duration after which a batched export is canceled. +// +// If the OTEL_BSP_EXPORT_TIMEOUT environment variable is set, +// and this option is not passed, that variable value will be used. +// If both are set, OTEL_BSP_EXPORT_TIMEOUT will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, 30s will be used. +// The default value is also used when the provided value is not a positive value. +func WithExportTimeout(d time.Duration) BatchingOption + +// WithExportMaxBatchSize sets the maximum batch size of every export. +// +// If the OTEL_BSP_MAX_EXPORT_BATCH_SIZE environment variable is set, +// and this option is not passed, that variable value will be used. +// If both are set, OTEL_BSP_MAX_EXPORT_BATCH_SIZE will take precedence. +// +// By default, if an environment variable is not set, and this option is not +// passed, 512 will be used. +// The default value is also used when the provided value is not a positive value. +func WithExportMaxBatchSize(max int) BatchingOption +``` + +The `Batcher` can be also configured using the `OTEL_BLRP_*` environment variables as +[defined by the specification](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#batch-logrecord-processor). + +### Exporter + +The [LogRecordExporter](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordexporter) +is defined as follows: + +```go +// Exporter handles the delivery of log records to external receivers. +type Exporter interface { + // Export transmits log records to a receiver. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // All retry logic must be contained in this function. The SDK does not + // implement any retry logic. All errors returned by this function are + // considered unrecoverable and will be reported to a configured error + // Handler. + // + // Implementations must not retain the records slice. + // + // Before modifying a Record, the implementation must use Record.Clone + // to create a copy that shares no state with the original. + Export(ctx context.Context, records []Record) error + + // Shutdown is called when the SDK shuts down. Any cleanup or release of + // resources held by the exporter should be done in this call. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // After Shutdown is called, calls to Export, Shutdown, or ForceFlush + // should perform no operation and return nil error. + Shutdown(ctx context.Context) error + + // ForceFlush exports log records to the configured Exporter that have not yet + // been exported. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + ForceFlush(ctx context.Context) error +} +``` + +The slice passed to `Export` must not be retained by the implementation +(like e.g. [`io.Writer`](https://pkg.go.dev/io#Writer)) +so that the caller can reuse the passed slice +(e.g. using [`sync.Pool`](https://pkg.go.dev/sync#Pool)) +to avoid heap allocations on each call. + +### Record + +The [ReadWriteLogRecord](https://opentelemetry.io/docs/specs/otel/logs/sdk/#readwritelogrecord) +is defined as follows: + +```go +type Record struct { /* ... */ } + +func (r *Record) Timestamp() + +func (r *Record) SetTimestamp(t time.Time) + +func (r *Record) ObservedTimestamp() time.Time + +func (r *Record) SetObservedTimestamp(t time.Time) + +func (r *Record) Severity() log.Severity + +func (r *Record) SetSeverity(level log.Severity) + +func (r *Record) SeverityText() string + +func (r *Record) SetSeverityText(text string) + +func (r *Record) Body() log.Value + +func (r *Record) SetBody(v log.Value) + +func (r *Record) WalkAttributes(f func(log.KeyValue) bool) + +func (r *Record) AddAttributes(attrs ...log.KeyValue) + +// SetAttributes sets and overrides the attributes of the log record. +func (r *Record) SetAttributes(attrs ...log.KeyValue) + +func (r *Record) TraceID() trace.TraceID + +func (r *Record) SetTraceID(id trace.TraceID) + +func (r *Record) SpanID() trace.SpanID + +func (r *Record) SetSpanID(id trace.SpanID) + +func (r *Record) TraceFlags() trace.TraceFlags + +func (r *Record) SetTraceFlags(flags trace.TraceFlags) + +// Resource returns the entity that collected the log. +func (r *Record) Resource() resource.Resource + +// InstrumentationScope returns the scope that the Logger was created with. +func (r *Record) InstrumentationScope() instrumentation.Scope + +// AttributeValueLengthLimit is the maximum allowed attribute value length. +// +// This limit only applies to string and string slice attribute values. +// Any string longer than this value should be truncated to this length. +// +// Negative value means no limit should be applied. +func (r *Record) AttributeValueLengthLimit() int + +// AttributeCountLimit is the maximum allowed log record attribute count. Any +// attribute added to a log record once this limit is reached should be dropped. +// +// Zero means no attributes should be recorded. +// +// Negative value means no limit should be applied. +func (r *Record) AttributeCountLimit() int + +// Clone returns a copy of the record with no shared state. The original record +// and the clone can both be modified without interfering with each other. +func (r *Record) Clone() Record +``` + +The `Record` is designed similarly to [`log.Record`](https://pkg.go.dev/go.opentelemetry.io/otel/log#Record) +in order to reduce the number of heap allocations when processing attributes. + +The SDK does not have have an additional definition of +[ReadableLogRecord](https://opentelemetry.io/docs/specs/otel/logs/sdk/#readablelogrecord) +as the specification does not say that the exporters must not be able to modify +the log records. It simply requires them to be able to read the log records. +Having less abstractions reduces the API surface and makes the design simpler. + +## Benchmarking + +The benchmarks are supposed to test end-to-end scenarios +and avoid I/O that could affect the stability of the results, + +The benchmark results can be found in [the prototype](https://github.com/open-telemetry/opentelemetry-go/pull/4955). + +## Rejected alternatives + +### Represent both LogRecordProcessor and LogRecordExporter as Expoter + +Because the [LogRecordProcessor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordprocessor) +and the [LogRecordProcessor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordexporter) +abstractions are so similar, there was a proposal to unify them under +single `Expoter` interface.[^2] + +However, introducing a `Processor` interface makes it easier +to create custom processor decorators[^3] +and makes the design more aligned with the specifiation. + +### Embedd log.Record + +Because [`Record`](#record) and [`log.Record`](https://pkg.go.dev/go.opentelemetry.io/otel/log#Record) +are very similar, there was a proposal to embedd `log.Record` in `Record` definition. + +[`log.Record`](https://pkg.go.dev/go.opentelemetry.io/otel/log#Record) +supports only adding attributes. +In the SDK, we also need to be able to modify the attributes (e.g. removal) +provided via API. + +Moreover it is safer to have these abstraction decoupled. +E.g. there can be a need for some fields that can be set via API and cannot be modified by the processors. + +## Open issues + +The Logs SDK NOT be released as stable before all issues below are closed: + +- [Redefine ReadableLogRecord and ReadWriteLogRecord](https://github.com/open-telemetry/opentelemetry-specification/pull/3898) +- [Fix what can be modified via ReadWriteLogRecord](https://github.com/open-telemetry/opentelemetry-specification/pull/3907) +- [logs: Allow duplicate keys](https://github.com/open-telemetry/opentelemetry-specification/issues/3931) +- [Add an Enabled method to Logger](https://github.com/open-telemetry/opentelemetry-specification/issues/3917) + +[^1]: [OpenTelemetry Logging](https://opentelemetry.io/docs/specs/otel/logs) +[^2]: [Conversation on representing LogRecordProcessor and LogRecordExporter via a single Expoter interface](https://github.com/open-telemetry/opentelemetry-go/pull/4954#discussion_r1515050480) +[^3]: [Introduce Processor](https://github.com/pellared/opentelemetry-go/pull/9) From 6bc8314a5553ba97e4cfaf7838007085a6be2dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 13 Mar 2024 09:15:31 +0100 Subject: [PATCH 08/15] [chore] Update open issues in log design docs (#5052) --- log/DESIGN.md | 2 +- sdk/log/DESIGN.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/log/DESIGN.md b/log/DESIGN.md index a1a78a72efd..9bb60b3b355 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -774,8 +774,8 @@ and we may even have problems naming the functions. The Logs Bridge API MUST NOT be released as stable before all issues below are closed: -- [Clarify handling empty (null) values in Logs Data Model](https://github.com/open-telemetry/opentelemetry-specification/issues/3835) - [Clarify attributes parameter type of Get a Logger operation](https://github.com/open-telemetry/opentelemetry-specification/issues/3841) +- [Add an Enabled method to Logger](https://github.com/open-telemetry/opentelemetry-specification/issues/3917) [^1]: [Handle structured body and attributes](https://github.com/pellared/opentelemetry-go/pull/7) [^2]: Jonathan Amsterdam, [The Go Blog: Structured Logging with slog](https://go.dev/blog/slog) diff --git a/sdk/log/DESIGN.md b/sdk/log/DESIGN.md index 521788cc407..f4927ab69a1 100644 --- a/sdk/log/DESIGN.md +++ b/sdk/log/DESIGN.md @@ -410,9 +410,9 @@ E.g. there can be a need for some fields that can be set via API and cannot be m ## Open issues -The Logs SDK NOT be released as stable before all issues below are closed: +The Logs SDK MUST NOT be released as stable before all issues below are closed: -- [Redefine ReadableLogRecord and ReadWriteLogRecord](https://github.com/open-telemetry/opentelemetry-specification/pull/3898) +- [Clarify that ReadableLogRecord and ReadWriteLogRecord can be represented using a single type](https://github.com/open-telemetry/opentelemetry-specification/pull/3898) - [Fix what can be modified via ReadWriteLogRecord](https://github.com/open-telemetry/opentelemetry-specification/pull/3907) - [logs: Allow duplicate keys](https://github.com/open-telemetry/opentelemetry-specification/issues/3931) - [Add an Enabled method to Logger](https://github.com/open-telemetry/opentelemetry-specification/issues/3917) From 54b6ee41746734577b513eb3e0ba4f205fc87e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Wed, 13 Mar 2024 17:47:07 +0100 Subject: [PATCH 09/15] sdk/log: Scaffolding (#5068) --- .github/dependabot.yml | 9 +++ sdk/log/DESIGN.md | 6 -- sdk/log/batch.go | 119 +++++++++++++++++++++++++++++ sdk/log/doc.go | 9 +++ sdk/log/exporter.go | 42 +++++++++++ sdk/log/go.mod | 27 +++++++ sdk/log/go.sum | 17 +++++ sdk/log/logger.go | 22 ++++++ sdk/log/processor.go | 44 +++++++++++ sdk/log/provider.go | 137 +++++++++++++++++++++++++++++++++ sdk/log/record.go | 168 +++++++++++++++++++++++++++++++++++++++++ sdk/log/simple.go | 48 ++++++++++++ versions.yaml | 1 + 13 files changed, 643 insertions(+), 6 deletions(-) create mode 100644 sdk/log/batch.go create mode 100644 sdk/log/doc.go create mode 100644 sdk/log/exporter.go create mode 100644 sdk/log/go.mod create mode 100644 sdk/log/go.sum create mode 100644 sdk/log/logger.go create mode 100644 sdk/log/processor.go create mode 100644 sdk/log/provider.go create mode 100644 sdk/log/record.go create mode 100644 sdk/log/simple.go diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aa56688077f..aeacd58ea5a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -253,6 +253,15 @@ updates: schedule: interval: weekly day: sunday + - package-ecosystem: gomod + directory: /sdk/log + labels: + - dependencies + - go + - Skip Changelog + schedule: + interval: weekly + day: sunday - package-ecosystem: gomod directory: /sdk/metric labels: diff --git a/sdk/log/DESIGN.md b/sdk/log/DESIGN.md index f4927ab69a1..d80200a43af 100644 --- a/sdk/log/DESIGN.md +++ b/sdk/log/DESIGN.md @@ -73,7 +73,6 @@ can be configured using following options: // // If the OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT environment variable is set, // and this option is not passed, that variable value will be used. -// If both are set, OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT will take precedence. // // By default, if an environment variable is not set, and this option is not // passed, no limit 128 will be used. @@ -88,7 +87,6 @@ func WithAttributeCountLimit(limit int) LoggerProviderOption // // If the OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT environment variable is set, // and this option is not passed, that variable value will be used. -// If both are set, OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT will take precedence. // // By default, if an environment variable is not set, and this option is not // passed, no limit (-1) will be used. @@ -199,7 +197,6 @@ type BatchingOption interface { /* ... */ } // // If the OTEL_BLRP_MAX_QUEUE_SIZE environment variable is set, // and this option is not passed, that variable value will be used. -// If both are set, OTEL_BLRP_MAX_QUEUE_SIZE will take precedence. // // By default, if an environment variable is not set, and this option is not // passed, 2048 will be used. @@ -210,7 +207,6 @@ func WithMaxQueueSize(max int) BatchingOption // // If the OTEL_BSP_SCHEDULE_DELAY environment variable is set, // and this option is not passed, that variable value will be used. -// If both are set, OTEL_BSP_SCHEDULE_DELAY will take precedence. // // By default, if an environment variable is not set, and this option is not // passed, 1s will be used. @@ -221,7 +217,6 @@ func WithExportInterval(d time.Duration) BatchingOption // // If the OTEL_BSP_EXPORT_TIMEOUT environment variable is set, // and this option is not passed, that variable value will be used. -// If both are set, OTEL_BSP_EXPORT_TIMEOUT will take precedence. // // By default, if an environment variable is not set, and this option is not // passed, 30s will be used. @@ -232,7 +227,6 @@ func WithExportTimeout(d time.Duration) BatchingOption // // If the OTEL_BSP_MAX_EXPORT_BATCH_SIZE environment variable is set, // and this option is not passed, that variable value will be used. -// If both are set, OTEL_BSP_MAX_EXPORT_BATCH_SIZE will take precedence. // // By default, if an environment variable is not set, and this option is not // passed, 512 will be used. diff --git a/sdk/log/batch.go b/sdk/log/batch.go new file mode 100644 index 00000000000..4a420fb5655 --- /dev/null +++ b/sdk/log/batch.go @@ -0,0 +1,119 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" + "time" +) + +// Compile-time check BatchingProcessor implements Processor. +var _ Processor = (*BatchingProcessor)(nil) + +// BatchingProcessor is an processor that asynchronously exports batches of log records. +type BatchingProcessor struct{} + +type batcherConfig struct{} + +// NewBatchingProcessor decorates the provided exporter +// so that the log records are batched before exporting. +// +// All of the exporter's methods are called from a single dedicated +// background goroutine. Therefore, the expoter does not need to +// be concurrent safe. +func NewBatchingProcessor(exporter Exporter, opts ...BatchingOption) *BatchingProcessor { + // TODO (#5063): Implement. + return nil +} + +// OnEmit batches provided log record. +func (b *BatchingProcessor) OnEmit(ctx context.Context, r Record) error { + // TODO (#5063): Implement. + return nil +} + +// Shutdown flushes queued log records and shuts down the decorated expoter. +func (b *BatchingProcessor) Shutdown(ctx context.Context) error { + // TODO (#5063): Implement. + return nil +} + +// ForceFlush flushes queued log records and flushes the decorated expoter. +func (b *BatchingProcessor) ForceFlush(ctx context.Context) error { + // TODO (#5063): Implement. + return nil +} + +// BatchingOption applies a configuration to a BatchingProcessor. +type BatchingOption interface { + apply(batcherConfig) batcherConfig +} + +type batchingOptionFunc func(batcherConfig) batcherConfig + +func (fn batchingOptionFunc) apply(c batcherConfig) batcherConfig { + return fn(c) +} + +// WithMaxQueueSize sets the maximum queue size used by the Batcher. +// After the size is reached log records are dropped. +// +// If the OTEL_BLRP_MAX_QUEUE_SIZE environment variable is set, +// and this option is not passed, that variable value will be used. +// +// By default, if an environment variable is not set, and this option is not +// passed, 2048 will be used. +// The default value is also used when the provided value is less than one. +func WithMaxQueueSize(max int) BatchingOption { + return batchingOptionFunc(func(cfg batcherConfig) batcherConfig { + // TODO (#5063): Implement. + return cfg + }) +} + +// WithExportInterval sets the maximum duration between batched exports. +// +// If the OTEL_BSP_SCHEDULE_DELAY environment variable is set, +// and this option is not passed, that variable value will be used. +// +// By default, if an environment variable is not set, and this option is not +// passed, 1s will be used. +// The default value is also used when the provided value is less than one. +func WithExportInterval(d time.Duration) BatchingOption { + return batchingOptionFunc(func(cfg batcherConfig) batcherConfig { + // TODO (#5063): Implement. + return cfg + }) +} + +// WithExportTimeout sets the duration after which a batched export is canceled. +// +// If the OTEL_BSP_EXPORT_TIMEOUT environment variable is set, +// and this option is not passed, that variable value will be used. +// +// By default, if an environment variable is not set, and this option is not +// passed, 30s will be used. +// The default value is also used when the provided value is less than one. +func WithExportTimeout(d time.Duration) BatchingOption { + return batchingOptionFunc(func(cfg batcherConfig) batcherConfig { + // TODO (#5063): Implement. + return cfg + }) +} + +// WithExportMaxBatchSize sets the maximum batch size of every export. +// A batch will be split into multiple exports to not exceed this size. +// +// If the OTEL_BSP_MAX_EXPORT_BATCH_SIZE environment variable is set, +// and this option is not passed, that variable value will be used. +// +// By default, if an environment variable is not set, and this option is not +// passed, 512 will be used. +// The default value is also used when the provided value is less than one. +func WithExportMaxBatchSize(max int) BatchingOption { + return batchingOptionFunc(func(cfg batcherConfig) batcherConfig { + // TODO (#5063): Implement. + return cfg + }) +} diff --git a/sdk/log/doc.go b/sdk/log/doc.go new file mode 100644 index 00000000000..10704030aba --- /dev/null +++ b/sdk/log/doc.go @@ -0,0 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// TODO (#5065): Expand documentation stub. + +/* +Package log provides the OpenTelemetry Logs SDK. +*/ +package log // import "go.opentelemetry.io/otel/sdk/log" diff --git a/sdk/log/exporter.go b/sdk/log/exporter.go new file mode 100644 index 00000000000..4e72b6ef7ac --- /dev/null +++ b/sdk/log/exporter.go @@ -0,0 +1,42 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" +) + +// Exporter handles the delivery of log records to external receivers. +type Exporter interface { + // Export transmits log records to a receiver. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // All retry logic must be contained in this function. The SDK does not + // implement any retry logic. All errors returned by this function are + // considered unrecoverable and will be reported to a configured error + // Handler. + // + // Implementations must not retain the records slice. + // + // Before modifying a Record, the implementation must use Record.Clone + // to create a copy that shares no state with the original. + Export(ctx context.Context, records []Record) error + // Shutdown is called when the SDK shuts down. Any cleanup or release of + // resources held by the exporter should be done in this call. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // After Shutdown is called, calls to Export, Shutdown, or ForceFlush + // should perform no operation and return nil error. + Shutdown(ctx context.Context) error + // ForceFlush exports log records to the configured Exporter that have not yet + // been exported. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + ForceFlush(ctx context.Context) error +} diff --git a/sdk/log/go.mod b/sdk/log/go.mod new file mode 100644 index 00000000000..7a6c3d009f6 --- /dev/null +++ b/sdk/log/go.mod @@ -0,0 +1,27 @@ +module go.opentelemetry.io/otel/sdk/log + +go 1.21 + +require ( + go.opentelemetry.io/otel/log v0.0.1-alpha + go.opentelemetry.io/otel/sdk v1.24.0 + go.opentelemetry.io/otel/trace v1.24.0 +) + +require ( + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + golang.org/x/sys v0.18.0 // indirect +) + +replace go.opentelemetry.io/otel/metric => ../../metric + +replace go.opentelemetry.io/otel/trace => ../../trace + +replace go.opentelemetry.io/otel/sdk => ../ + +replace go.opentelemetry.io/otel/log => ../../log + +replace go.opentelemetry.io/otel => ../.. diff --git a/sdk/log/go.sum b/sdk/log/go.sum new file mode 100644 index 00000000000..bd9fd851e52 --- /dev/null +++ b/sdk/log/go.sum @@ -0,0 +1,17 @@ +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/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +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.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +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/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/log/logger.go b/sdk/log/logger.go new file mode 100644 index 00000000000..9bd87f447e9 --- /dev/null +++ b/sdk/log/logger.go @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" + + "go.opentelemetry.io/otel/log" + "go.opentelemetry.io/otel/log/embedded" +) + +// Compile-time check logger implements log.Logger. +var _ log.Logger = (*logger)(nil) + +type logger struct { + embedded.Logger +} + +func (l *logger) Emit(ctx context.Context, r log.Record) { + // TODO (#5061): Implement. +} diff --git a/sdk/log/processor.go b/sdk/log/processor.go new file mode 100644 index 00000000000..f84da4c36d3 --- /dev/null +++ b/sdk/log/processor.go @@ -0,0 +1,44 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" +) + +// Processor handles the processing of log records. +// +// Any of the Processor's methods may be called concurrently with itself +// or with other methods. It is the responsibility of the Processor to manage +// this concurrency. +type Processor interface { + // OnEmit is called when a Record is emitted. + // + // Implementation should not interrupt the record processing + // if the context is canceled. + // + // All retry logic must be contained in this function. The SDK does not + // implement any retry logic. All errors returned by this function are + // considered unrecoverable and will be reported to a configured error + // Handler. + // + // Before modifying a Record, the implementation must use Record.Clone + // to create a copy that shares no state with the original. + OnEmit(ctx context.Context, record Record) error + // Shutdown is called when the SDK shuts down. Any cleanup or release of + // resources held by the exporter should be done in this call. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + // + // After Shutdown is called, calls to Export, Shutdown, or ForceFlush + // should perform no operation and return nil error. + Shutdown(ctx context.Context) error + // ForceFlush exports log records to the configured Exporter that have not yet + // been exported. + // + // The deadline or cancellation of the passed context must be honored. An + // appropriate error should be returned in these situations. + ForceFlush(ctx context.Context) error +} diff --git a/sdk/log/provider.go b/sdk/log/provider.go new file mode 100644 index 00000000000..d0c6b23e8b1 --- /dev/null +++ b/sdk/log/provider.go @@ -0,0 +1,137 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" + + "go.opentelemetry.io/otel/log" + "go.opentelemetry.io/otel/log/embedded" + "go.opentelemetry.io/otel/sdk/resource" +) + +// Compile-time check LoggerProvider implements log.LoggerProvider. +var _ log.LoggerProvider = (*LoggerProvider)(nil) + +// LoggerProvider handles the creation and coordination of Loggers. All Loggers +// created by a LoggerProvider will be associated with the same Resource. +type LoggerProvider struct { + embedded.LoggerProvider +} + +type providerConfig struct{} + +// NewLoggerProvider returns a new and configured LoggerProvider. +// +// By default, the returned LoggerProvider is configured with the default +// Resource and no Processors. Processors cannot be added after a LoggerProvider is +// created. This means the returned LoggerProvider, one created with no +// Processors, will perform no operations. +func NewLoggerProvider(opts ...LoggerProviderOption) *LoggerProvider { + // TODO (#5060): Implement. + return nil +} + +// Logger returns a new [log.Logger] with the provided name and configuration. +// +// This method can be called concurrently. +func (p *LoggerProvider) Logger(name string, opts ...log.LoggerOption) log.Logger { + // TODO (#5060): Implement. + return &logger{} +} + +// Shutdown flushes queued log records and shuts down the decorated expoter. +// +// This method can be called concurrently. +func (p *LoggerProvider) Shutdown(ctx context.Context) error { + // TODO (#5060): Implement. + return nil +} + +// ForceFlush flushes all exporters. +// +// This method can be called concurrently. +func (p *LoggerProvider) ForceFlush(ctx context.Context) error { + // TODO (#5060): Implement. + return nil +} + +// LoggerProviderOption applies a configuration option value to a LoggerProvider. +type LoggerProviderOption interface { + apply(providerConfig) providerConfig +} + +type loggerProviderOptionFunc func(providerConfig) providerConfig + +func (fn loggerProviderOptionFunc) apply(c providerConfig) providerConfig { + return fn(c) +} + +// WithResource associates a Resource with a LoggerProvider. This Resource +// represents the entity producing telemetry and is associated with all Loggers +// the LoggerProvider will create. +// +// By default, if this Option is not used, the default Resource from the +// go.opentelemetry.io/otel/sdk/resource package will be used. +func WithResource(res *resource.Resource) LoggerProviderOption { + return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { + // TODO (#5060): Implement. + return cfg + }) +} + +// WithProcessor associates Processor with a LoggerProvider. +// +// By default, if this option is not used, the LoggerProvider will perform no +// operations; no data will be exported without a processor. +// +// Each WithProcessor creates a separate pipeline. Use custom decorators +// for advanced scenarios such as enriching with attributes. +// +// For production, use [NewBatchingProcessor] to batch log records before they are exported. +// For testing and debugging, use [NewSimpleProcessor] to synchronously export log records. +func WithProcessor(processor Processor) LoggerProviderOption { + return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { + // TODO (#5060): Implement. + return cfg + }) +} + +// WithAttributeCountLimit sets the maximum allowed log record attribute count. +// Any attribute added to a log record once this limit is reached will be dropped. +// +// Setting this to zero means no attributes will be recorded. +// +// Setting this to a negative value means no limit is applied. +// +// If the OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT environment variable is set, +// and this option is not passed, that variable value will be used. +// +// By default, if an environment variable is not set, and this option is not +// passed, 128 will be used. +func WithAttributeCountLimit(limit int) LoggerProviderOption { + return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { + // TODO (#5060): Implement. + return cfg + }) +} + +// AttributeValueLengthLimit sets the maximum allowed attribute value length. +// +// This limit only applies to string and string slice attribute values. +// Any string longer than this value will be truncated to this length. +// +// Setting this to a negative value means no limit is applied. +// +// If the OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT environment variable is set, +// and this option is not passed, that variable value will be used. +// +// By default, if an environment variable is not set, and this option is not +// passed, no limit (-1) will be used. +func WithAttributeValueLengthLimit(limit int) LoggerProviderOption { + return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { + // TODO (#5060): Implement. + return cfg + }) +} diff --git a/sdk/log/record.go b/sdk/log/record.go new file mode 100644 index 00000000000..d3b292bcf3b --- /dev/null +++ b/sdk/log/record.go @@ -0,0 +1,168 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "time" + + "go.opentelemetry.io/otel/log" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/trace" +) + +// Record is a log record emitted by the Logger. +type Record struct{} + +// Timestamp returns the time when the log record occurred. +func (r *Record) Timestamp() time.Time { + // TODO (#5064): Implement. + return time.Time{} +} + +// SetTimestamp sets the time when the log record occurred. +func (r *Record) SetTimestamp(t time.Time) { + // TODO (#5064): Implement. +} + +// ObservedTimestamp returns the time when the log record was observed. +func (r *Record) ObservedTimestamp() time.Time { + // TODO (#5064): Implement. + return time.Time{} +} + +// SetObservedTimestamp sets the time when the log record was observed. +func (r *Record) SetObservedTimestamp(t time.Time) { + // TODO (#5064): Implement. +} + +// Severity returns the severity of the log record. +func (r *Record) Severity() log.Severity { + // TODO (#5064): Implement. + return log.Severity(0) +} + +// SetSeverity sets the severity level of the log record. +func (r *Record) SetSeverity(level log.Severity) { + // TODO (#5064): Implement. +} + +// SeverityText returns severity (also known as log level) text. This is the +// original string representation of the severity as it is known at the source. +func (r *Record) SeverityText() string { + // TODO (#5064): Implement. + return "" +} + +// SetSeverityText sets severity (also known as log level) text. This is the +// original string representation of the severity as it is known at the source. +func (r *Record) SetSeverityText(text string) { + // TODO (#5064): Implement. +} + +// Body returns the body of the log record. +func (r *Record) Body() log.Value { + // TODO (#5064): Implement. + return log.Value{} +} + +// SetBody sets the body of the log record. +func (r *Record) SetBody(v log.Value) { + // TODO (#5064): Implement. +} + +// WalkAttributes walks all attributes the log record holds by calling f for +// each on each [log.KeyValue] in the [Record]. Iteration stops if f returns false. +func (r *Record) WalkAttributes(f func(log.KeyValue) bool) { + // TODO (#5064): Implement. +} + +// AddAttributes adds attributes to the log record. +func (r *Record) AddAttributes(attrs ...log.KeyValue) { + // TODO (#5064): Implement. +} + +// SetAttributes sets (and overrides) attributes to the log record. +func (r *Record) SetAttributes(attrs ...log.KeyValue) { + // TODO (#5064): Implement. +} + +// AttributesLen returns the number of attributes in the log record. +func (r *Record) AttributesLen() int { + // TODO (#5064): Implement. + return 0 +} + +// TraceID returns the trace ID or empty array. +func (r *Record) TraceID() trace.TraceID { + // TODO (#5064): Implement. + return trace.TraceID{} +} + +// SetTraceID sets the trace ID. +func (r *Record) SetTraceID(id trace.TraceID) { + // TODO (#5064): Implement. +} + +// SpanID returns the span ID or empty array. +func (r *Record) SpanID() trace.SpanID { + // TODO (#5064): Implement. + return trace.SpanID{} +} + +// SetSpanID sets the span ID. +func (r *Record) SetSpanID(id trace.SpanID) { + // TODO (#5064): Implement. +} + +// TraceFlags returns the trace flags. +func (r *Record) TraceFlags() trace.TraceFlags { + return 0 +} + +// SetTraceFlags sets the trace flags. +func (r *Record) SetTraceFlags(flags trace.TraceFlags) { + // TODO (#5064): Implement. +} + +// Resource returns the entity that collected the log. +func (r *Record) Resource() resource.Resource { + // TODO (#5064): Implement. + return resource.Resource{} +} + +// InstrumentationScope returns the scope that the Logger was created with. +func (r *Record) InstrumentationScope() instrumentation.Scope { + // TODO (#5064): Implement. + return instrumentation.Scope{} +} + +// AttributeValueLengthLimit is the maximum allowed attribute value length. +// +// This limit only applies to string and string slice attribute values. +// Any string longer than this value should be truncated to this length. +// +// Negative value means no limit should be applied. +func (r *Record) AttributeValueLengthLimit() int { + // TODO (#5064): Implement. + return 0 +} + +// AttributeCountLimit is the maximum allowed log record attribute count. Any +// attribute added to a log record once this limit is reached should be dropped. +// +// Zero means no attributes should be recorded. +// +// Negative value means no limit should be applied. +func (r *Record) AttributeCountLimit() int { + // TODO (#5064): Implement. + return 0 +} + +// Clone returns a copy of the record with no shared state. The original record +// and the clone can both be modified without interfering with each other. +func (r *Record) Clone() Record { + // TODO (#5064): Implement. + return *r +} diff --git a/sdk/log/simple.go b/sdk/log/simple.go new file mode 100644 index 00000000000..5151aaa2f68 --- /dev/null +++ b/sdk/log/simple.go @@ -0,0 +1,48 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" +) + +// Compile-time check SimpleProcessor implements Processor. +var _ Processor = (*SimpleProcessor)(nil) + +// SimpleProcessor is an processor that synchronously exports log records. +type SimpleProcessor struct{} + +// NewSimpleProcessor is a simple Processor adapter. +// +// Any of the exporter's methods may be called concurrently with itself +// or with other methods. It is the responsibility of the exporter to manage +// this concurrency. +// +// This Processor is not recommended for production use. The synchronous +// nature of this Processor make it good for testing, debugging, or +// showing examples of other features, but it can be slow and have a high +// computation resource usage overhead. [NewBatchingProcessor] is recommended +// for production use instead. +func NewSimpleProcessor(exporter Exporter) *SimpleProcessor { + // TODO (#5062): Implement. + return nil +} + +// OnEmit batches provided log record. +func (s *SimpleProcessor) OnEmit(ctx context.Context, r Record) error { + // TODO (#5062): Implement. + return nil +} + +// Shutdown shuts down the expoter. +func (s *SimpleProcessor) Shutdown(ctx context.Context) error { + // TODO (#5062): Implement. + return nil +} + +// ForceFlush flushes the exporter. +func (s *SimpleProcessor) ForceFlush(ctx context.Context) error { + // TODO (#5062): Implement. + return nil +} diff --git a/versions.yaml b/versions.yaml index bad0dcf6c45..21825dc1376 100644 --- a/versions.yaml +++ b/versions.yaml @@ -43,3 +43,4 @@ module-sets: - go.opentelemetry.io/otel/schema excluded-modules: - go.opentelemetry.io/otel/internal/tools + - go.opentelemetry.io/otel/sdk/log From ca35244789e2486de017ba8e38dabcab3f3a625c Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 14 Mar 2024 07:40:48 -0700 Subject: [PATCH 10/15] sdk/log: Implement Record (#5073) --- sdk/log/go.mod | 6 +- sdk/log/go.sum | 2 + sdk/log/record.go | 145 +++++++++++++++++++++-------- sdk/log/record_test.go | 206 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 319 insertions(+), 40 deletions(-) create mode 100644 sdk/log/record_test.go diff --git a/sdk/log/go.mod b/sdk/log/go.mod index 7a6c3d009f6..f646ba1da06 100644 --- a/sdk/log/go.mod +++ b/sdk/log/go.mod @@ -3,17 +3,21 @@ module go.opentelemetry.io/otel/sdk/log go 1.21 require ( + github.com/stretchr/testify v1.9.0 + go.opentelemetry.io/otel v1.24.0 go.opentelemetry.io/otel/log v0.0.1-alpha go.opentelemetry.io/otel/sdk v1.24.0 go.opentelemetry.io/otel/trace v1.24.0 ) require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel v1.24.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect go.opentelemetry.io/otel/metric v1.24.0 // indirect golang.org/x/sys v0.18.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) replace go.opentelemetry.io/otel/metric => ../../metric diff --git a/sdk/log/go.sum b/sdk/log/go.sum index bd9fd851e52..e2eeaf7227b 100644 --- a/sdk/log/go.sum +++ b/sdk/log/go.sum @@ -13,5 +13,7 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/log/record.go b/sdk/log/record.go index d3b292bcf3b..33e1c86c74f 100644 --- a/sdk/log/record.go +++ b/sdk/log/record.go @@ -4,6 +4,7 @@ package log // import "go.opentelemetry.io/otel/sdk/log" import ( + "slices" "time" "go.opentelemetry.io/otel/log" @@ -12,130 +13,197 @@ import ( "go.opentelemetry.io/otel/trace" ) +// attributesInlineCount is the number of attributes that are efficiently +// stored in an array within a Record. This value is borrowed from slog which +// performed a quantitative survey of log library use and found this value to +// cover 95% of all use-cases (https://go.dev/blog/slog#performance). +const attributesInlineCount = 5 + // Record is a log record emitted by the Logger. -type Record struct{} +type Record struct { + // Do not embed the log.Record. Attributes need to be overwrite-able and + // deep-copying needs to be possible. + + timestamp time.Time + observedTimestamp time.Time + severity log.Severity + severityText string + body log.Value + + // The fields below are for optimizing the implementation of Attributes and + // AddAttributes. This design is borrowed from the slog Record type: + // https://cs.opensource.google/go/go/+/refs/tags/go1.22.0:src/log/slog/record.go;l=20 + + // Allocation optimization: an inline array sized to hold + // the majority of log calls (based on examination of open-source + // code). It holds the start of the list of attributes. + front [attributesInlineCount]log.KeyValue + + // The number of attributes in front. + nFront int + + // The list of attributes except for those in front. + // Invariants: + // - len(back) > 0 if nFront == len(front) + // - Unused array elements are zero-ed. Used to detect mistakes. + back []log.KeyValue + + traceID trace.TraceID + spanID trace.SpanID + traceFlags trace.TraceFlags + + // resource represents the entity that collected the log. + resource *resource.Resource + + // scope is the Scope that the Logger was created with. + scope *instrumentation.Scope + + attributeValueLengthLimit int + attributeCountLimit int +} // Timestamp returns the time when the log record occurred. func (r *Record) Timestamp() time.Time { - // TODO (#5064): Implement. - return time.Time{} + return r.timestamp } // SetTimestamp sets the time when the log record occurred. func (r *Record) SetTimestamp(t time.Time) { - // TODO (#5064): Implement. + r.timestamp = t } // ObservedTimestamp returns the time when the log record was observed. func (r *Record) ObservedTimestamp() time.Time { - // TODO (#5064): Implement. - return time.Time{} + return r.observedTimestamp } // SetObservedTimestamp sets the time when the log record was observed. func (r *Record) SetObservedTimestamp(t time.Time) { - // TODO (#5064): Implement. + r.observedTimestamp = t } // Severity returns the severity of the log record. func (r *Record) Severity() log.Severity { - // TODO (#5064): Implement. - return log.Severity(0) + return r.severity } // SetSeverity sets the severity level of the log record. func (r *Record) SetSeverity(level log.Severity) { - // TODO (#5064): Implement. + r.severity = level } // SeverityText returns severity (also known as log level) text. This is the // original string representation of the severity as it is known at the source. func (r *Record) SeverityText() string { - // TODO (#5064): Implement. - return "" + return r.severityText } // SetSeverityText sets severity (also known as log level) text. This is the // original string representation of the severity as it is known at the source. func (r *Record) SetSeverityText(text string) { - // TODO (#5064): Implement. + r.severityText = text } // Body returns the body of the log record. func (r *Record) Body() log.Value { - // TODO (#5064): Implement. - return log.Value{} + return r.body } // SetBody sets the body of the log record. func (r *Record) SetBody(v log.Value) { - // TODO (#5064): Implement. + r.body = v } // WalkAttributes walks all attributes the log record holds by calling f for // each on each [log.KeyValue] in the [Record]. Iteration stops if f returns false. func (r *Record) WalkAttributes(f func(log.KeyValue) bool) { - // TODO (#5064): Implement. + for i := 0; i < r.nFront; i++ { + if !f(r.front[i]) { + return + } + } + for _, a := range r.back { + if !f(a) { + return + } + } } // AddAttributes adds attributes to the log record. func (r *Record) AddAttributes(attrs ...log.KeyValue) { - // TODO (#5064): Implement. + var i int + for i = 0; i < len(attrs) && r.nFront < len(r.front); i++ { + a := attrs[i] + r.front[r.nFront] = a + r.nFront++ + } + + r.back = slices.Grow(r.back, len(attrs[i:])) + r.back = append(r.back, attrs[i:]...) } // SetAttributes sets (and overrides) attributes to the log record. func (r *Record) SetAttributes(attrs ...log.KeyValue) { - // TODO (#5064): Implement. + r.nFront = 0 + var i int + for i = 0; i < len(attrs) && r.nFront < len(r.front); i++ { + a := attrs[i] + r.front[r.nFront] = a + r.nFront++ + } + + r.back = slices.Clone(attrs[i:]) } // AttributesLen returns the number of attributes in the log record. func (r *Record) AttributesLen() int { - // TODO (#5064): Implement. - return 0 + return r.nFront + len(r.back) } // TraceID returns the trace ID or empty array. func (r *Record) TraceID() trace.TraceID { - // TODO (#5064): Implement. - return trace.TraceID{} + return r.traceID } // SetTraceID sets the trace ID. func (r *Record) SetTraceID(id trace.TraceID) { - // TODO (#5064): Implement. + r.traceID = id } // SpanID returns the span ID or empty array. func (r *Record) SpanID() trace.SpanID { - // TODO (#5064): Implement. - return trace.SpanID{} + return r.spanID } // SetSpanID sets the span ID. func (r *Record) SetSpanID(id trace.SpanID) { - // TODO (#5064): Implement. + r.spanID = id } // TraceFlags returns the trace flags. func (r *Record) TraceFlags() trace.TraceFlags { - return 0 + return r.traceFlags } // SetTraceFlags sets the trace flags. func (r *Record) SetTraceFlags(flags trace.TraceFlags) { - // TODO (#5064): Implement. + r.traceFlags = flags } // Resource returns the entity that collected the log. func (r *Record) Resource() resource.Resource { - // TODO (#5064): Implement. - return resource.Resource{} + if r.resource == nil { + return *resource.Empty() + } + return *r.resource } // InstrumentationScope returns the scope that the Logger was created with. func (r *Record) InstrumentationScope() instrumentation.Scope { - // TODO (#5064): Implement. - return instrumentation.Scope{} + if r.scope == nil { + return instrumentation.Scope{} + } + return *r.scope } // AttributeValueLengthLimit is the maximum allowed attribute value length. @@ -145,8 +213,7 @@ func (r *Record) InstrumentationScope() instrumentation.Scope { // // Negative value means no limit should be applied. func (r *Record) AttributeValueLengthLimit() int { - // TODO (#5064): Implement. - return 0 + return r.attributeValueLengthLimit } // AttributeCountLimit is the maximum allowed log record attribute count. Any @@ -156,13 +223,13 @@ func (r *Record) AttributeValueLengthLimit() int { // // Negative value means no limit should be applied. func (r *Record) AttributeCountLimit() int { - // TODO (#5064): Implement. - return 0 + return r.attributeCountLimit } // Clone returns a copy of the record with no shared state. The original record // and the clone can both be modified without interfering with each other. func (r *Record) Clone() Record { - // TODO (#5064): Implement. - return *r + res := *r + res.back = slices.Clone(r.back) + return res } diff --git a/sdk/log/record_test.go b/sdk/log/record_test.go new file mode 100644 index 00000000000..0ccdfea0787 --- /dev/null +++ b/sdk/log/record_test.go @@ -0,0 +1,206 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/log" + "go.opentelemetry.io/otel/sdk/instrumentation" + "go.opentelemetry.io/otel/sdk/resource" + "go.opentelemetry.io/otel/trace" +) + +func TestRecordTimestamp(t *testing.T) { + now := time.Now() + r := new(Record) + r.SetTimestamp(now) + assert.Equal(t, now, r.Timestamp()) +} + +func TestRecordObservedTimestamp(t *testing.T) { + now := time.Now() + r := new(Record) + r.SetObservedTimestamp(now) + assert.Equal(t, now, r.ObservedTimestamp()) +} + +func TestRecordSeverity(t *testing.T) { + s := log.SeverityInfo + r := new(Record) + r.SetSeverity(s) + assert.Equal(t, s, r.Severity()) +} + +func TestRecordSeverityText(t *testing.T) { + text := "text" + r := new(Record) + r.SetSeverityText(text) + assert.Equal(t, text, r.SeverityText()) +} + +func TestRecordBody(t *testing.T) { + v := log.BoolValue(true) + r := new(Record) + r.SetBody(v) + assert.True(t, v.Equal(r.Body())) +} + +func TestRecordAttributes(t *testing.T) { + attrs := []log.KeyValue{ + log.Bool("0", true), + log.Int64("1", 2), + log.Float64("2", 3.0), + log.String("3", "forth"), + log.Slice("4", log.Int64Value(1)), + log.Map("5", log.Int("key", 2)), + log.Bytes("6", []byte("six")), + } + r := new(Record) + r.SetAttributes(attrs...) + r.SetAttributes(attrs[:2]...) // Overwrite existing. + r.AddAttributes(attrs[2:]...) + + assert.Equal(t, len(attrs), r.AttributesLen(), "attribute length") + + for n := range attrs { + var i int + r.WalkAttributes(func(log.KeyValue) bool { + i++ + return i <= n + }) + assert.Equalf(t, n+1, i, "WalkAttributes did not stop at %d", n+1) + } + + var i int + r.WalkAttributes(func(kv log.KeyValue) bool { + assert.Truef(t, kv.Equal(attrs[i]), "%d: %v != %v", i, kv, attrs[i]) + i++ + return true + }) +} + +func TestRecordTraceID(t *testing.T) { + id := trace.TraceID([16]byte{1}) + r := new(Record) + r.SetTraceID(id) + assert.Equal(t, id, r.TraceID()) +} + +func TestRecordSpanID(t *testing.T) { + id := trace.SpanID([8]byte{1}) + r := new(Record) + r.SetSpanID(id) + assert.Equal(t, id, r.SpanID()) +} + +func TestRecordTraceFlags(t *testing.T) { + flag := trace.FlagsSampled + r := new(Record) + r.SetTraceFlags(flag) + assert.Equal(t, flag, r.TraceFlags()) +} + +func TestRecordResource(t *testing.T) { + r := new(Record) + assert.NotPanics(t, func() { r.Resource() }) + + res := resource.NewSchemaless(attribute.Bool("key", true)) + r.resource = res + got := r.Resource() + assert.True(t, res.Equal(&got)) +} + +func TestRecordInstrumentationScope(t *testing.T) { + r := new(Record) + assert.NotPanics(t, func() { r.InstrumentationScope() }) + + scope := instrumentation.Scope{Name: "testing"} + r.scope = &scope + assert.Equal(t, scope, r.InstrumentationScope()) +} + +func TestRecordAttributeValueLengthLimit(t *testing.T) { + limit := 12 + r := new(Record) + r.attributeValueLengthLimit = limit + assert.Equal(t, limit, r.AttributeValueLengthLimit()) +} + +func TestRecordAttributeCountLimit(t *testing.T) { + limit := 21 + r := new(Record) + r.attributeCountLimit = limit + assert.Equal(t, limit, r.AttributeCountLimit()) +} + +func TestRecordClone(t *testing.T) { + now0 := time.Now() + sev0 := log.SeverityInfo + text0 := "text" + val0 := log.BoolValue(true) + attr0 := log.Bool("0", true) + traceID0 := trace.TraceID([16]byte{1}) + spanID0 := trace.SpanID([8]byte{1}) + flag0 := trace.FlagsSampled + + r0 := new(Record) + r0.SetTimestamp(now0) + r0.SetObservedTimestamp(now0) + r0.SetSeverity(sev0) + r0.SetSeverityText(text0) + r0.SetBody(val0) + r0.SetAttributes(attr0) + r0.SetTraceID(traceID0) + r0.SetSpanID(spanID0) + r0.SetTraceFlags(flag0) + + now1 := now0.Add(time.Second) + sev1 := log.SeverityDebug + text1 := "string" + val1 := log.IntValue(1) + attr1 := log.Int64("1", 2) + traceID1 := trace.TraceID([16]byte{2}) + spanID1 := trace.SpanID([8]byte{2}) + flag1 := trace.TraceFlags(2) + + r1 := r0.Clone() + r1.SetTimestamp(now1) + r1.SetObservedTimestamp(now1) + r1.SetSeverity(sev1) + r1.SetSeverityText(text1) + r1.SetBody(val1) + r1.SetAttributes(attr1) + r1.SetTraceID(traceID1) + r1.SetSpanID(spanID1) + r1.SetTraceFlags(flag1) + + assert.Equal(t, now0, r0.Timestamp()) + assert.Equal(t, now0, r0.ObservedTimestamp()) + assert.Equal(t, sev0, r0.Severity()) + assert.Equal(t, text0, r0.SeverityText()) + assert.True(t, val0.Equal(r0.Body())) + assert.Equal(t, traceID0, r0.TraceID()) + assert.Equal(t, spanID0, r0.SpanID()) + assert.Equal(t, flag0, r0.TraceFlags()) + r0.WalkAttributes(func(kv log.KeyValue) bool { + return assert.Truef(t, kv.Equal(attr0), "%v != %v", kv, attr0) + }) + + assert.Equal(t, now1, r1.Timestamp()) + assert.Equal(t, now1, r1.ObservedTimestamp()) + assert.Equal(t, sev1, r1.Severity()) + assert.Equal(t, text1, r1.SeverityText()) + assert.True(t, val1.Equal(r1.Body())) + assert.Equal(t, traceID1, r1.TraceID()) + assert.Equal(t, spanID1, r1.SpanID()) + assert.Equal(t, flag1, r1.TraceFlags()) + r1.WalkAttributes(func(kv log.KeyValue) bool { + return assert.Truef(t, kv.Equal(attr1), "%v != %v", kv, attr1) + }) +} From 42c1708ed52125e6e7357f5b279b8bc28b744926 Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Thu, 14 Mar 2024 13:22:12 -0700 Subject: [PATCH 11/15] Add SeverityUndefined to `otel/log` (#5072) * Add SeverityUndefined * Add changelog entry --------- Co-authored-by: Sam Xie --- CHANGELOG.md | 2 ++ log/severity.go | 3 +++ log/severity_string.go | 8 ++++---- log/severity_test.go | 6 ++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 689ef03e18c..06135e0d7d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4906) - Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906) +- Add `SeverityUndefined` `const` to `go.opentelemetry.io/otel/log`. + This value represents an unset severity level. (#5072) ### Changed diff --git a/log/severity.go b/log/severity.go index 5ef8826a07c..0240fd5acbd 100644 --- a/log/severity.go +++ b/log/severity.go @@ -13,6 +13,9 @@ type Severity int // Severity values defined by OpenTelemetry. const ( + // SeverityUndefined represents an unset Severity. + SeverityUndefined Severity = 0 // UNDEFINED + // A fine-grained debugging log record. Typically disabled in default // configurations. SeverityTrace1 Severity = 1 // TRACE diff --git a/log/severity_string.go b/log/severity_string.go index d742ae5fe88..4c20fa5e8aa 100644 --- a/log/severity_string.go +++ b/log/severity_string.go @@ -8,6 +8,7 @@ func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} + _ = x[SeverityUndefined-0] _ = x[SeverityTrace1-1] _ = x[SeverityTrace2-2] _ = x[SeverityTrace3-3] @@ -34,14 +35,13 @@ func _() { _ = x[SeverityFatal4-24] } -const _Severity_name = "TRACETRACE2TRACE3TRACE4DEBUGDEBUG2DEBUG3DEBUG4INFOINFO2INFO3INFO4WARNWARN2WARN3WARN4ERRORERROR2ERROR3ERROR4FATALFATAL2FATAL3FATAL4" +const _Severity_name = "UNDEFINEDTRACETRACE2TRACE3TRACE4DEBUGDEBUG2DEBUG3DEBUG4INFOINFO2INFO3INFO4WARNWARN2WARN3WARN4ERRORERROR2ERROR3ERROR4FATALFATAL2FATAL3FATAL4" -var _Severity_index = [...]uint8{0, 5, 11, 17, 23, 28, 34, 40, 46, 50, 55, 60, 65, 69, 74, 79, 84, 89, 95, 101, 107, 112, 118, 124, 130} +var _Severity_index = [...]uint8{0, 9, 14, 20, 26, 32, 37, 43, 49, 55, 59, 64, 69, 74, 78, 83, 88, 93, 98, 104, 110, 116, 121, 127, 133, 139} func (i Severity) String() string { - i -= 1 if i < 0 || i >= Severity(len(_Severity_index)-1) { - return "Severity(" + strconv.FormatInt(int64(i+1), 10) + ")" + return "Severity(" + strconv.FormatInt(int64(i), 10) + ")" } return _Severity_name[_Severity_index[i]:_Severity_index[i+1]] } diff --git a/log/severity_test.go b/log/severity_test.go index cd153d20d02..66cd8869d76 100644 --- a/log/severity_test.go +++ b/log/severity_test.go @@ -19,6 +19,12 @@ func TestSeverity(t *testing.T) { value int str string }{ + { + name: "SeverityUndefined", + severity: log.SeverityUndefined, + value: 0, + str: "UNDEFINED", + }, { name: "SeverityTrace", severity: log.SeverityTrace, From 47ac0d4df8ed365989e5d933e8934607a1170539 Mon Sep 17 00:00:00 2001 From: Sam Xie Date: Fri, 15 Mar 2024 07:52:24 -0700 Subject: [PATCH 12/15] logs: Add empty value for KeyValue (#5076) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add empty value for KeyValue * Update CHANGELOG * Apply suggestions from code review Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn * Fix comments * Update log/keyvalue.go Co-authored-by: Damien Mathieu <42@dmathieu.com> --------- Co-authored-by: Robert Pająk Co-authored-by: Tyler Yahn Co-authored-by: Damien Mathieu <42@dmathieu.com> --- CHANGELOG.md | 1 + log/keyvalue.go | 24 +++++++++++++++--------- log/keyvalue_test.go | 20 +++++++++++++++++++- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06135e0d7d1..b7e471bf39d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906) - Add `SeverityUndefined` `const` to `go.opentelemetry.io/otel/log`. This value represents an unset severity level. (#5072) +- Add `Empty` function in `go.opentelemetry.io/otel/log` to return a `KeyValue` for an empty value. (#5076) ### Changed diff --git a/log/keyvalue.go b/log/keyvalue.go index bb55f0d2270..da3d55c4fc8 100644 --- a/log/keyvalue.go +++ b/log/keyvalue.go @@ -34,6 +34,7 @@ const ( ) // A Value represents a structured log value. +// A zero value is valid and represents an empty value. type Value struct { // Ensure forward compatibility by explicitly making this not comparable. noCmp [0]func() //nolint: unused // This is indeed used. @@ -264,7 +265,7 @@ func (v Value) Equal(w Value) bool { } } -// An KeyValue is a key-value pair used to represent a log attribute (a +// A KeyValue is a key-value pair used to represent a log attribute (a // superset of [go.opentelemetry.io/otel/attribute.KeyValue]) and map item. type KeyValue struct { Key string @@ -276,42 +277,47 @@ func (a KeyValue) Equal(b KeyValue) bool { return a.Key == b.Key && a.Value.Equal(b.Value) } -// String returns an KeyValue for a string value. +// String returns a KeyValue for a string value. func String(key, value string) KeyValue { return KeyValue{key, StringValue(value)} } -// Int64 returns an KeyValue for an int64 value. +// Int64 returns a KeyValue for an int64 value. func Int64(key string, value int64) KeyValue { return KeyValue{key, Int64Value(value)} } -// Int returns an KeyValue for an int value. +// Int returns a KeyValue for an int value. func Int(key string, value int) KeyValue { return KeyValue{key, IntValue(value)} } -// Float64 returns an KeyValue for a float64 value. +// Float64 returns a KeyValue for a float64 value. func Float64(key string, value float64) KeyValue { return KeyValue{key, Float64Value(value)} } -// Bool returns an KeyValue for a bool value. +// Bool returns a KeyValue for a bool value. func Bool(key string, value bool) KeyValue { return KeyValue{key, BoolValue(value)} } -// Bytes returns an KeyValue for a []byte value. +// Bytes returns a KeyValue for a []byte value. func Bytes(key string, value []byte) KeyValue { return KeyValue{key, BytesValue(value)} } -// Slice returns an KeyValue for a []Value value. +// Slice returns a KeyValue for a []Value value. func Slice(key string, value ...Value) KeyValue { return KeyValue{key, SliceValue(value...)} } -// Map returns an KeyValue for a map value. +// Map returns a KeyValue for a map value. func Map(key string, value ...KeyValue) KeyValue { return KeyValue{key, MapValue(value...)} } + +// Empty returns a KeyValue with an empty value. +func Empty(key string) KeyValue { + return KeyValue{key, Value{}} +} diff --git a/log/keyvalue_test.go b/log/keyvalue_test.go index 098334b8f29..f7c6602de74 100644 --- a/log/keyvalue_test.go +++ b/log/keyvalue_test.go @@ -60,6 +60,7 @@ func TestValueEqual(t *testing.T) { log.MapValue( log.Slice("l", log.IntValue(3), log.StringValue("foo")), log.Bytes("b", []byte{3, 5, 7}), + log.Empty("e"), ), } for i, v1 := range vals { @@ -69,7 +70,7 @@ func TestValueEqual(t *testing.T) { } } -func TestEmpty(t *testing.T) { +func TestValueEmpty(t *testing.T) { v := log.Value{} t.Run("Value.Empty", func(t *testing.T) { assert.True(t, v.Empty()) @@ -246,6 +247,23 @@ func TestMap(t *testing.T) { }) } +func TestEmpty(t *testing.T) { + const key = "key" + kv := log.Empty(key) + + assert.Equal(t, key, kv.Key, "incorrect key") + assert.True(t, kv.Value.Empty(), "value not empty") + + v, k := kv.Value, log.KindEmpty + t.Run("AsBool", testErrKind(v.AsBool, "AsBool", k)) + t.Run("AsFloat64", testErrKind(v.AsFloat64, "AsFloat64", k)) + t.Run("AsInt64", testErrKind(v.AsInt64, "AsInt64", k)) + t.Run("AsString", testErrKind(v.AsString, "AsString", k)) + t.Run("AsBytes", testErrKind(v.AsBytes, "AsBytes", k)) + t.Run("AsSlice", testErrKind(v.AsSlice, "AsSlice", k)) + t.Run("AsMap", testErrKind(v.AsMap, "AsMap", k)) +} + type logSink struct { logr.LogSink From da047e70ef583efbc91883dd2e35c616569260ef Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 15 Mar 2024 08:15:44 -0700 Subject: [PATCH 13/15] Add the Enabled method to the Logger (#5071) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add the Enabled method to the Logger * Add a changelog entry * Rename enabled.go to min_sev.go * Remove MinSeverityProcessor * Document lack of interaction between OnEmit and Enabled * Update sdk/log/processor.go --------- Co-authored-by: Robert Pająk --- CHANGELOG.md | 2 ++ log/logger.go | 22 ++++++++++++++++++++++ log/noop/noop.go | 3 +++ sdk/log/batch.go | 5 +++++ sdk/log/logger.go | 5 +++++ sdk/log/processor.go | 21 +++++++++++++++++++++ sdk/log/simple.go | 5 +++++ 7 files changed, 63 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7e471bf39d..68cc02b478e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4906) - Add `WithProxy` option in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlptracehttp`. (#4906) +- The `Enabled` method is added to the `Logger` interface in `go.opentelemetry.io/otel/log`. + This method is used to notify users if a log record will be emitted or not. (#5071) - Add `SeverityUndefined` `const` to `go.opentelemetry.io/otel/log`. This value represents an unset severity level. (#5072) - Add `Empty` function in `go.opentelemetry.io/otel/log` to return a `KeyValue` for an empty value. (#5076) diff --git a/log/logger.go b/log/logger.go index 56843afe366..df2e88ea6b2 100644 --- a/log/logger.go +++ b/log/logger.go @@ -29,6 +29,28 @@ type Logger interface { // Implementations of this method need to be safe for a user to call // concurrently. Emit(ctx context.Context, record Record) + + // Enabled returns whether the Logger emits for the given context and + // record. + // + // The passed record is likely to be a partial record with only the + // bridge-relevant information being provided (e.g a record with only the + // Severity set). If a Logger needs more information than is provided, it + // is said to be in an indeterminate state (see below). + // + // The returned value will be true when the Logger will emit for the + // provided context and record, and will be false if the Logger will not + // emit. The returned value may be true or false in an indeterminate state. + // An implementation should default to returning true for an indeterminate + // state, but may return false if valid reasons in particular circumstances + // exist (e.g. performance, correctness). + // + // The record should not be held by the implementation. A copy should be + // made if the record needs to be held after the call returns. + // + // Implementations of this method need to be safe for a user to call + // concurrently. + Enabled(ctx context.Context, record Record) bool } // LoggerOption applies configuration options to a [Logger]. diff --git a/log/noop/noop.go b/log/noop/noop.go index be5a6ba5cbb..d2e21edba66 100644 --- a/log/noop/noop.go +++ b/log/noop/noop.go @@ -45,3 +45,6 @@ type Logger struct{ embedded.Logger } // Emit does nothing. func (Logger) Emit(context.Context, log.Record) {} + +// Enabled returns false. No log records are ever emitted. +func (Logger) Enabled(context.Context, log.Record) bool { return false } diff --git a/sdk/log/batch.go b/sdk/log/batch.go index 4a420fb5655..3c0b9f49024 100644 --- a/sdk/log/batch.go +++ b/sdk/log/batch.go @@ -33,6 +33,11 @@ func (b *BatchingProcessor) OnEmit(ctx context.Context, r Record) error { return nil } +// Enabled returns true. +func (b *BatchingProcessor) Enabled(context.Context, Record) bool { + return true +} + // Shutdown flushes queued log records and shuts down the decorated expoter. func (b *BatchingProcessor) Shutdown(ctx context.Context) error { // TODO (#5063): Implement. diff --git a/sdk/log/logger.go b/sdk/log/logger.go index 9bd87f447e9..9f81d48b6fd 100644 --- a/sdk/log/logger.go +++ b/sdk/log/logger.go @@ -20,3 +20,8 @@ type logger struct { func (l *logger) Emit(ctx context.Context, r log.Record) { // TODO (#5061): Implement. } + +func (l *logger) Enabled(ctx context.Context, r log.Record) bool { + // TODO (#5061): Implement. + return true +} diff --git a/sdk/log/processor.go b/sdk/log/processor.go index f84da4c36d3..f95ea949027 100644 --- a/sdk/log/processor.go +++ b/sdk/log/processor.go @@ -15,6 +15,9 @@ import ( type Processor interface { // OnEmit is called when a Record is emitted. // + // OnEmit will be called independent of Enabled. Implementations need to + // validate the arguments themselves before processing. + // // Implementation should not interrupt the record processing // if the context is canceled. // @@ -26,6 +29,24 @@ type Processor interface { // Before modifying a Record, the implementation must use Record.Clone // to create a copy that shares no state with the original. OnEmit(ctx context.Context, record Record) error + // Enabled returns whether the Processor will process for the given context + // and record. + // + // The passed record is likely to be a partial record with only the + // bridge-relevant information being provided (e.g a record with only the + // Severity set). If a Logger needs more information than is provided, it + // is said to be in an indeterminate state (see below). + // + // The returned value will be true when the Processor will process for the + // provided context and record, and will be false if the Processor will not + // process. The returned value may be true or false in an indeterminate + // state. An implementation should default to returning true for an + // indeterminate state, but may return false if valid reasons in particular + // circumstances exist (e.g. performance, correctness). + // + // Before modifying a Record, the implementation must use Record.Clone + // to create a copy that shares no state with the original. + Enabled(ctx context.Context, record Record) bool // Shutdown is called when the SDK shuts down. Any cleanup or release of // resources held by the exporter should be done in this call. // diff --git a/sdk/log/simple.go b/sdk/log/simple.go index 5151aaa2f68..fb8ebcaedb0 100644 --- a/sdk/log/simple.go +++ b/sdk/log/simple.go @@ -35,6 +35,11 @@ func (s *SimpleProcessor) OnEmit(ctx context.Context, r Record) error { return nil } +// Enabled returns true. +func (s *SimpleProcessor) Enabled(context.Context, Record) bool { + return true +} + // Shutdown shuts down the expoter. func (s *SimpleProcessor) Shutdown(ctx context.Context) error { // TODO (#5062): Implement. From 3a72c5ea94bf843beeaa044b0dda2ce4d627bb7b Mon Sep 17 00:00:00 2001 From: Tyler Yahn Date: Fri, 15 Mar 2024 10:24:32 -0700 Subject: [PATCH 14/15] Implement the providerConfig (#5074) * Implement the providerConfig * Add test for NewLoggerProvider configuration * Add TestLimitValueFailsOpen * Fix merge --- sdk/log/provider.go | 106 +++++++++++++++++++++++++++++--- sdk/log/provider_test.go | 126 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 223 insertions(+), 9 deletions(-) create mode 100644 sdk/log/provider_test.go diff --git a/sdk/log/provider.go b/sdk/log/provider.go index d0c6b23e8b1..1ab2affd6af 100644 --- a/sdk/log/provider.go +++ b/sdk/log/provider.go @@ -5,22 +5,105 @@ package log // import "go.opentelemetry.io/otel/sdk/log" import ( "context" + "fmt" + "os" + "strconv" + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/log" "go.opentelemetry.io/otel/log/embedded" "go.opentelemetry.io/otel/sdk/resource" ) -// Compile-time check LoggerProvider implements log.LoggerProvider. -var _ log.LoggerProvider = (*LoggerProvider)(nil) +const ( + defaultAttrCntLim = 128 + defaultAttrValLenLim = -1 + + envarAttrCntLim = "OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT" + envarAttrValLenLim = "OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT" +) + +type providerConfig struct { + resource *resource.Resource + processors []Processor + attrCntLim limit + attrValLenLim limit +} + +func newProviderConfig(opts []LoggerProviderOption) providerConfig { + var c providerConfig + for _, opt := range opts { + c = opt.apply(c) + } + + if c.resource == nil { + c.resource = resource.Default() + } + + c.attrCntLim = c.attrCntLim.Resolve( + envarAttrCntLim, + defaultAttrCntLim, + ) + + c.attrValLenLim = c.attrValLenLim.Resolve( + envarAttrValLenLim, + defaultAttrValLenLim, + ) + + return c +} + +type limit struct { + value int + set bool +} + +func newLimit(value int) limit { + return limit{value: value, set: true} +} + +// Resolve returns the resolved form of the limit l. If l's value is set, it +// will return l. If the l's value is not set, a new limit based on the +// environment variable envar will be returned if that environment variable is +// set. Otherwise, fallback is used to construct a new limit that is returned. +func (l limit) Resolve(envar string, fallback int) limit { + if l.set { + return l + } + + if v := os.Getenv(envar); v != "" { + n, err := strconv.Atoi(v) + if err == nil { + return newLimit(n) + } + otel.Handle(fmt.Errorf("invalid %s value %s: %w", envar, v, err)) + } + + return newLimit(fallback) +} + +// Value returns the limit value if set. Otherwise, it returns -1. +func (l limit) Value() int { + if l.set { + return l.value + } + // Fail open, not closed (-1 == unlimited). + return -1 +} // LoggerProvider handles the creation and coordination of Loggers. All Loggers // created by a LoggerProvider will be associated with the same Resource. type LoggerProvider struct { embedded.LoggerProvider + + resource *resource.Resource + processors []Processor + attributeCountLimit int + attributeValueLengthLimit int } -type providerConfig struct{} +// Compile-time check LoggerProvider implements log.LoggerProvider. +var _ log.LoggerProvider = (*LoggerProvider)(nil) // NewLoggerProvider returns a new and configured LoggerProvider. // @@ -29,8 +112,13 @@ type providerConfig struct{} // created. This means the returned LoggerProvider, one created with no // Processors, will perform no operations. func NewLoggerProvider(opts ...LoggerProviderOption) *LoggerProvider { - // TODO (#5060): Implement. - return nil + cfg := newProviderConfig(opts) + return &LoggerProvider{ + resource: cfg.resource, + processors: cfg.processors, + attributeCountLimit: cfg.attrCntLim.Value(), + attributeValueLengthLimit: cfg.attrValLenLim.Value(), + } } // Logger returns a new [log.Logger] with the provided name and configuration. @@ -76,7 +164,7 @@ func (fn loggerProviderOptionFunc) apply(c providerConfig) providerConfig { // go.opentelemetry.io/otel/sdk/resource package will be used. func WithResource(res *resource.Resource) LoggerProviderOption { return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { - // TODO (#5060): Implement. + cfg.resource = res return cfg }) } @@ -93,7 +181,7 @@ func WithResource(res *resource.Resource) LoggerProviderOption { // For testing and debugging, use [NewSimpleProcessor] to synchronously export log records. func WithProcessor(processor Processor) LoggerProviderOption { return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { - // TODO (#5060): Implement. + cfg.processors = append(cfg.processors, processor) return cfg }) } @@ -112,7 +200,7 @@ func WithProcessor(processor Processor) LoggerProviderOption { // passed, 128 will be used. func WithAttributeCountLimit(limit int) LoggerProviderOption { return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { - // TODO (#5060): Implement. + cfg.attrCntLim = newLimit(limit) return cfg }) } @@ -131,7 +219,7 @@ func WithAttributeCountLimit(limit int) LoggerProviderOption { // passed, no limit (-1) will be used. func WithAttributeValueLengthLimit(limit int) LoggerProviderOption { return loggerProviderOptionFunc(func(cfg providerConfig) providerConfig { - // TODO (#5060): Implement. + cfg.attrValLenLim = newLimit(limit) return cfg }) } diff --git a/sdk/log/provider_test.go b/sdk/log/provider_test.go new file mode 100644 index 00000000000..a53ea1aa85d --- /dev/null +++ b/sdk/log/provider_test.go @@ -0,0 +1,126 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package log // import "go.opentelemetry.io/otel/sdk/log" + +import ( + "context" + "strconv" + "testing" + + "github.com/stretchr/testify/assert" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/sdk/resource" +) + +type processor struct { + name string +} + +func (processor) OnEmit(context.Context, Record) error { return nil } +func (processor) Enabled(context.Context, Record) bool { return true } +func (processor) Shutdown(context.Context) error { return nil } +func (processor) ForceFlush(context.Context) error { return nil } + +func TestNewLoggerProviderConfiguration(t *testing.T) { + t.Cleanup(func(orig otel.ErrorHandler) func() { + otel.SetErrorHandler(otel.ErrorHandlerFunc(func(err error) { + t.Log(err) + })) + return func() { otel.SetErrorHandler(orig) } + }(otel.GetErrorHandler())) + + res := resource.NewSchemaless(attribute.String("key", "value")) + p0, p1 := processor{name: "0"}, processor{name: "1"} + attrCntLim := 12 + attrValLenLim := 21 + + testcases := []struct { + name string + envars map[string]string + options []LoggerProviderOption + want *LoggerProvider + }{ + { + name: "Defaults", + want: &LoggerProvider{ + resource: resource.Default(), + attributeCountLimit: defaultAttrCntLim, + attributeValueLengthLimit: defaultAttrValLenLim, + }, + }, + { + name: "Options", + options: []LoggerProviderOption{ + WithResource(res), + WithProcessor(p0), + WithProcessor(p1), + WithAttributeCountLimit(attrCntLim), + WithAttributeValueLengthLimit(attrValLenLim), + }, + want: &LoggerProvider{ + resource: res, + processors: []Processor{p0, p1}, + attributeCountLimit: attrCntLim, + attributeValueLengthLimit: attrValLenLim, + }, + }, + { + name: "Environment", + envars: map[string]string{ + envarAttrCntLim: strconv.Itoa(attrCntLim), + envarAttrValLenLim: strconv.Itoa(attrValLenLim), + }, + want: &LoggerProvider{ + resource: resource.Default(), + attributeCountLimit: attrCntLim, + attributeValueLengthLimit: attrValLenLim, + }, + }, + { + name: "InvalidEnvironment", + envars: map[string]string{ + envarAttrCntLim: "invalid attributeCountLimit", + envarAttrValLenLim: "invalid attributeValueLengthLimit", + }, + want: &LoggerProvider{ + resource: resource.Default(), + attributeCountLimit: defaultAttrCntLim, + attributeValueLengthLimit: defaultAttrValLenLim, + }, + }, + { + name: "Precedence", + envars: map[string]string{ + envarAttrCntLim: strconv.Itoa(100), + envarAttrValLenLim: strconv.Itoa(101), + }, + options: []LoggerProviderOption{ + // These override the environment variables. + WithAttributeCountLimit(attrCntLim), + WithAttributeValueLengthLimit(attrValLenLim), + }, + want: &LoggerProvider{ + resource: resource.Default(), + attributeCountLimit: attrCntLim, + attributeValueLengthLimit: attrValLenLim, + }, + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + for key, value := range tc.envars { + t.Setenv(key, value) + } + assert.Equal(t, tc.want, NewLoggerProvider(tc.options...)) + }) + } +} + +func TestLimitValueFailsOpen(t *testing.T) { + var l limit + assert.Equal(t, -1, l.Value(), "limit value should default to unlimited") +} From 6fb46a12116dac113bcf06dbc8c6fb0b26dae4dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Sat, 16 Mar 2024 11:06:06 +0100 Subject: [PATCH 15/15] Simplify log design docs (#5077) --- log/DESIGN.md | 186 ++-------------------------- sdk/log/DESIGN.md | 299 ++-------------------------------------------- 2 files changed, 20 insertions(+), 465 deletions(-) diff --git a/log/DESIGN.md b/log/DESIGN.md index 9bb60b3b355..029bc19fc38 100644 --- a/log/DESIGN.md +++ b/log/DESIGN.md @@ -5,8 +5,8 @@ `go.opentelemetry.io/otel/log` provides [Logs Bridge API](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/). -The initial version of the design and the prototype -was created in [#4725](https://github.com/open-telemetry/opentelemetry-go/pull/4725). +The prototype was created in +[#4725](https://github.com/open-telemetry/opentelemetry-go/pull/4725). ## Background @@ -43,14 +43,7 @@ Rejected alternative: ### LoggerProvider The [`LoggerProvider` abstraction](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#loggerprovider) -is defined as an interface: - -```go -type LoggerProvider interface { - embedded.LoggerProvider - Logger(name string, options ...LoggerOption) Logger -} -``` +is defined as `LoggerProvider` interface in [provider.go](provider.go). The specification may add new operations to `LoggerProvider`. The interface may have methods added without a package major version bump. @@ -64,13 +57,7 @@ The `Logger` method implements the [`Get a Logger` operation](https://openteleme The required `name` parameter is accepted as a `string` method argument. -The following options are defined to support optional parameters: - -```go -func WithInstrumentationVersion(version string) LoggerOption -func WithInstrumentationAttributes(attr ...attribute.KeyValue) LoggerOption -func WithSchemaURL(schemaURL string) LoggerOption -``` +The `LoggerOption` options are defined to support optional parameters. Implementation requirements: @@ -94,14 +81,7 @@ Rejected alternative: ### Logger The [`Logger` abstraction](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#logger) -is defined as an interface: - -```go -type Logger interface { - embedded.Logger - Emit(ctx context.Context, record Record) -} -``` +is defined as `Logger` interface in [logger.go](logger.go). The specification may add new operations to `Logger`. The interface may have methods added without a package major version bump. @@ -119,23 +99,7 @@ is accepted as a `context.Context` method argument. Calls to `Emit` are supposed to be on the hot path. Therefore, in order to reduce the number of heap allocations, the [`LogRecord` abstraction](https://opentelemetry.io/docs/specs/otel/logs/bridge-api/#emit-a-logrecord), -is defined as a `Record` type: - -```go -type Record struct { - timestamp time.Time - observedTimestamp time.Time - severity Severity - severityText string - body Value - - // The fields below are for optimizing the implementation of - // attributes. - front [5]KeyValue - nFront int // The number of attributes in front. - back []KeyValue -} -``` +is defined as `Record` struct in [record.go](record.go). [`Timestamp`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-timestamp) is accessed using following methods: @@ -161,53 +125,11 @@ func (r *Record) Severity() Severity func (r *Record) SetSeverity(s Severity) ``` -`Severity` type is defined and constants are based on +`Severity` type is defined in [severity.go](severity.go). +The constants are are based on [Displaying Severity recommendation](https://opentelemetry.io/docs/specs/otel/logs/data-model/#displaying-severity). Additionally, `Severity[Level]1` constants are defined to make the API more readable and user friendly. -```go -type Severity int - -const ( - SeverityTrace1 Severity = 1 // TRACE - SeverityTrace2 Severity = 2 // TRACE2 - SeverityTrace3 Severity = 3 // TRACE3 - SeverityTrace4 Severity = 4 // TRACE4 - - SeverityDebug1 Severity = 5 // DEBUG - SeverityDebug2 Severity = 6 // DEBUG2 - SeverityDebug3 Severity = 7 // DEBUG3 - SeverityDebug4 Severity = 8 // DEBUG4 - - SeverityInfo1 Severity = 9 // INFO - SeverityInfo2 Severity = 10 // INFO2 - SeverityInfo3 Severity = 11 // INFO3 - SeverityInfo4 Severity = 12 // INFO4 - - SeverityWarn1 Severity = 13 // WARN - SeverityWarn2 Severity = 14 // WARN2 - SeverityWarn3 Severity = 15 // WARN3 - SeverityWarn4 Severity = 16 // WARN4 - - SeverityError1 Severity = 17 // ERROR - SeverityError2 Severity = 18 // ERROR2 - SeverityError3 Severity = 19 // ERROR3 - SeverityError4 Severity = 20 // ERROR4 - - SeverityFatal1 Severity = 21 // FATAL - SeverityFatal2 Severity = 22 // FATAL2 - SeverityFatal3 Severity = 23 // FATAL3 - SeverityFatal4 Severity = 24 // FATAL4 - - SeverityTrace = SeverityTrace1 - SeverityDebug = SeverityDebug1 - SeverityInfo = SeverityInfo1 - SeverityWarn = SeverityWarn1 - SeverityError = SeverityError1 - SeverityFatal = SeverityFatal1 -) -``` - [`SeverityText`](https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitytext) is accessed using following methods: @@ -247,95 +169,9 @@ while keeping the API user friendly. It relieves the user from making his own improvements for reducing the number of allocations when passing attributes. -The following definitions are implementing the abstractions -described in [the specification](https://opentelemetry.io/docs/specs/otel/logs/#new-first-party-application-logs): - -```go -type Value struct{} - -type Kind int - -const ( - KindEmpty Kind = iota - KindBool - KindFloat64 - KindInt64 - KindString - KindBytes - KindSlice - KindMap -) - -func (v Value) Kind() Kind - -// Value factories: - -func StringValue(value string) Value - -func IntValue(v int) Value - -func Int64Value(v int64) Value - -func Float64Value(v float64) Value - -func BoolValue(v bool) Value - -func BytesValue(v []byte) Value - -func SliceValue(vs ...Value) Value - -func MapValue(kvs ...KeyValue) Value - -// Value accessors: - -func (v Value) AsString() string - -func (v Value) AsInt64() int64 - -func (v Value) AsBool() bool - -func (v Value) AsFloat64() float64 - -func (v Value) AsBytes() []byte - -func (v Value) AsSlice() []Value - -func (v Value) AsMap() []KeyValue - -func (v Value) Empty() bool - -// Value equality comparison: - -func (v Value) Equal(w Value) bool - - -type KeyValue struct { - Key string - Value Value -} - -// KeyValue factories: - -func String(key, value string) KeyValue - -func Int64(key string, value int64) KeyValue - -func Int(key string, value int) KeyValue - -func Float64(key string, v float64) KeyValue - -func Bool(key string, v bool) KeyValue - -func Bytes(key string, v []byte) KeyValue - -func Slice(key string, args ...Value) KeyValue - -func Map(key string, args ...KeyValue) KeyValue - -// KeyValue equality comparison: - -func (a KeyValue) Equal(b KeyValue) bool -``` +The abstractions described in +[the specification](https://opentelemetry.io/docs/specs/otel/logs/#new-first-party-application-logs) +are defined in [keyvalue.go](keyvalue.go). `Value` is representing `any`. `KeyValue` is representing a key(string)-value(`any`) pair. diff --git a/sdk/log/DESIGN.md b/sdk/log/DESIGN.md index d80200a43af..bd47d2683d7 100644 --- a/sdk/log/DESIGN.md +++ b/sdk/log/DESIGN.md @@ -25,38 +25,7 @@ The exporters are going to be published as following Go modules: ## LoggerProvider The [LoggerProvider](https://opentelemetry.io/docs/specs/otel/logs/sdk/#loggerprovider) -is defined as follows: - -```go -type LoggerProvider struct { - embedded.LoggerProvider -} - -// NewLoggerProvider returns a new and configured LoggerProvider. -// -// By default, the returned LoggerProvider is configured with the default -// Resource and no Processors. Processors cannot be added after a LoggerProvider is -// created. This means the returned LoggerProvider, one created with no -// Processors, will perform no operations. -func NewLoggerProvider(opts ...LoggerProviderOption) *LoggerProvider - -// Logger returns a new log.Logger with the provided name and configuration. -// -// This method can be called concurrently. -// -// Logger implements the log.LoggerProvider interface. -func (*LoggerProvider) Logger(name string, options ...log.LoggerOption) log.Logger - -type LoggerProviderOption interface { /* ... */ } - -// WithResource associates a Resource with a LoggerProvider. This Resource -// represents the entity producing telemetry and is associated with all Loggers -// the LoggerProvider will create. -// -// By default, if this Option is not used, the default Resource from the -// go.opentelemetry.io/otel/sdk/resource package will be used. -func WithResource(res *resource.Resource) LoggerProviderOption -``` +is implemented as `LoggerProvider` struct in [provider.go](provider.go). ## LogRecord limits @@ -64,32 +33,7 @@ The [LogRecord limits](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrec can be configured using following options: ```go -// WithAttributeCountLimit sets the maximum allowed log record attribute count. -// Any attribute added to a log record once this limit is reached will be dropped. -// -// Setting this to zero means no attributes will be recorded. -// -// Setting this to a negative value means no limit is applied. -// -// If the OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT environment variable is set, -// and this option is not passed, that variable value will be used. -// -// By default, if an environment variable is not set, and this option is not -// passed, no limit 128 will be used. func WithAttributeCountLimit(limit int) LoggerProviderOption - -// AttributeValueLengthLimit sets the maximum allowed attribute value length. -// -// This limit only applies to string and string slice attribute values. -// Any string longer than this value will be truncated to this length. -// -// Setting this to a negative value means no limit is applied. -// -// If the OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT environment variable is set, -// and this option is not passed, that variable value will be used. -// -// By default, if an environment variable is not set, and this option is not -// passed, no limit (-1) will be used. func WithAttributeValueLengthLimit(limit int) LoggerProviderOption ``` @@ -99,140 +43,22 @@ The limits can be also configured using the `OTEL_LOGRECORD_*` environment varia ### Processor The [LogRecordProcessor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordprocessor) -is defined as follows: +is defined as `Processor` interface in [processor.go](processor.go). -```go -// WithProcessor associates Processor with a LoggerProvider. -// -// By default, if this option is not used, the LoggerProvider will perform no -// operations; no data will be exported without a processor. -// -// Each WithProcessor creates a separate pipeline. Use custom decorators -// for advanced scenarios such as enriching with attributes. -// -// Use NewBatchingProcessor to batch log records before they are exported. -// Use NewSimpleProcessor to synchronously export log records. -func WithProcessor(processor Processor) LoggerProviderOption - -// Processor handles the processing of log records. -// -// Any of the Processor's methods may be called concurrently with itself -// or with other methods. It is the responsibility of the Processor to manage -// this concurrency. -type Processor interface { - // OnEmit is called when a Record is emitted. - // - // Implementation should not interrupt the record processing - // if the context is canceled. - // - // All retry logic must be contained in this function. The SDK does not - // implement any retry logic. All errors returned by this function are - // considered unrecoverable and will be reported to a configured error - // Handler. - // - // Before modifying a Record, the implementation must use Record.Clone - // to create a copy that shares no state with the original. - OnEmit(ctx context.Context, record Record) error - - // Shutdown is called when the SDK shuts down. Any cleanup or release of - // resources held by the exporter should be done in this call. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - // - // After Shutdown is called, calls to Export, Shutdown, or ForceFlush - // should perform no operation and return nil error. - Shutdown(ctx context.Context) error - - // ForceFlush exports log records to the configured Exporter that have not yet - // been exported. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - ForceFlush(ctx context.Context) error -} -``` +The user set processors for the `LoggerProvider` using +`func WithProcessor(processor Processor) LoggerProviderOption`. The user can configure custom processors and decorate built-in processors. ### SimpleProcessor The [Simple processor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#simple-processor) -is defined as follows: - -```go -// SimpleProcessor implements Processor. -type SimpleProcessor struct { /* ... */ } - -// NewSimpleProcessor is a simple Processor adapter. -// -// Any of the exporter's methods may be called concurrently with itself -// or with other methods. It is the responsibility of the exporter to manage -// this concurrency. -func NewSimpleProcessor(exporter Exporter) *SimpleProcessor -``` +is implemented as `SimpleProcessor` struct in [simple.go](simple.go). ### BatchingProcessor The [Batching processor](https://opentelemetry.io/docs/specs/otel/logs/sdk/#batching-processor) -is defined as follows: - -```go -// BatchingProcessor implements Processor. -type BatchingProcessor struct { /* ... */ } - -// NewBatchingProcessor decorates the provided exporter -// so that the log records are batched before exporting. -// -// All of the exporter's methods are called from a single dedicated -// background goroutine. Therefore, the expoter does not need to -// be concurrent safe. -func NewBatchingProcessor(exporter Exporter, opts ...BatchingOption) *BatchingProcessor - -// BatchingOption applies a configuration to a Batcher. -type BatchingOption interface { /* ... */ } - -// WithMaxQueueSize sets the maximum queue size used by the Batcher. -// After the size is reached log records are dropped. -// -// If the OTEL_BLRP_MAX_QUEUE_SIZE environment variable is set, -// and this option is not passed, that variable value will be used. -// -// By default, if an environment variable is not set, and this option is not -// passed, 2048 will be used. -// The default value is also used when the provided value is not a positive value. -func WithMaxQueueSize(max int) BatchingOption - -// WithExportInterval sets the maximum duration between batched exports. -// -// If the OTEL_BSP_SCHEDULE_DELAY environment variable is set, -// and this option is not passed, that variable value will be used. -// -// By default, if an environment variable is not set, and this option is not -// passed, 1s will be used. -// The default value is also used when the provided value is not a positive value. -func WithExportInterval(d time.Duration) BatchingOption - -// WithExportTimeout sets the duration after which a batched export is canceled. -// -// If the OTEL_BSP_EXPORT_TIMEOUT environment variable is set, -// and this option is not passed, that variable value will be used. -// -// By default, if an environment variable is not set, and this option is not -// passed, 30s will be used. -// The default value is also used when the provided value is not a positive value. -func WithExportTimeout(d time.Duration) BatchingOption - -// WithExportMaxBatchSize sets the maximum batch size of every export. -// -// If the OTEL_BSP_MAX_EXPORT_BATCH_SIZE environment variable is set, -// and this option is not passed, that variable value will be used. -// -// By default, if an environment variable is not set, and this option is not -// passed, 512 will be used. -// The default value is also used when the provided value is not a positive value. -func WithExportMaxBatchSize(max int) BatchingOption -``` +is implemented as `BatchingProcessor` struct in [batch.go](batch.go). The `Batcher` can be also configured using the `OTEL_BLRP_*` environment variables as [defined by the specification](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#batch-logrecord-processor). @@ -240,45 +66,7 @@ The `Batcher` can be also configured using the `OTEL_BLRP_*` environment variabl ### Exporter The [LogRecordExporter](https://opentelemetry.io/docs/specs/otel/logs/sdk/#logrecordexporter) -is defined as follows: - -```go -// Exporter handles the delivery of log records to external receivers. -type Exporter interface { - // Export transmits log records to a receiver. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - // - // All retry logic must be contained in this function. The SDK does not - // implement any retry logic. All errors returned by this function are - // considered unrecoverable and will be reported to a configured error - // Handler. - // - // Implementations must not retain the records slice. - // - // Before modifying a Record, the implementation must use Record.Clone - // to create a copy that shares no state with the original. - Export(ctx context.Context, records []Record) error - - // Shutdown is called when the SDK shuts down. Any cleanup or release of - // resources held by the exporter should be done in this call. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - // - // After Shutdown is called, calls to Export, Shutdown, or ForceFlush - // should perform no operation and return nil error. - Shutdown(ctx context.Context) error - - // ForceFlush exports log records to the configured Exporter that have not yet - // been exported. - // - // The deadline or cancellation of the passed context must be honored. An - // appropriate error should be returned in these situations. - ForceFlush(ctx context.Context) error -} -``` +is defined as `Exporter` interface in [exporter.go](exporter.go). The slice passed to `Export` must not be retained by the implementation (like e.g. [`io.Writer`](https://pkg.go.dev/io#Writer)) @@ -289,76 +77,7 @@ to avoid heap allocations on each call. ### Record The [ReadWriteLogRecord](https://opentelemetry.io/docs/specs/otel/logs/sdk/#readwritelogrecord) -is defined as follows: - -```go -type Record struct { /* ... */ } - -func (r *Record) Timestamp() - -func (r *Record) SetTimestamp(t time.Time) - -func (r *Record) ObservedTimestamp() time.Time - -func (r *Record) SetObservedTimestamp(t time.Time) - -func (r *Record) Severity() log.Severity - -func (r *Record) SetSeverity(level log.Severity) - -func (r *Record) SeverityText() string - -func (r *Record) SetSeverityText(text string) - -func (r *Record) Body() log.Value - -func (r *Record) SetBody(v log.Value) - -func (r *Record) WalkAttributes(f func(log.KeyValue) bool) - -func (r *Record) AddAttributes(attrs ...log.KeyValue) - -// SetAttributes sets and overrides the attributes of the log record. -func (r *Record) SetAttributes(attrs ...log.KeyValue) - -func (r *Record) TraceID() trace.TraceID - -func (r *Record) SetTraceID(id trace.TraceID) - -func (r *Record) SpanID() trace.SpanID - -func (r *Record) SetSpanID(id trace.SpanID) - -func (r *Record) TraceFlags() trace.TraceFlags - -func (r *Record) SetTraceFlags(flags trace.TraceFlags) - -// Resource returns the entity that collected the log. -func (r *Record) Resource() resource.Resource - -// InstrumentationScope returns the scope that the Logger was created with. -func (r *Record) InstrumentationScope() instrumentation.Scope - -// AttributeValueLengthLimit is the maximum allowed attribute value length. -// -// This limit only applies to string and string slice attribute values. -// Any string longer than this value should be truncated to this length. -// -// Negative value means no limit should be applied. -func (r *Record) AttributeValueLengthLimit() int - -// AttributeCountLimit is the maximum allowed log record attribute count. Any -// attribute added to a log record once this limit is reached should be dropped. -// -// Zero means no attributes should be recorded. -// -// Negative value means no limit should be applied. -func (r *Record) AttributeCountLimit() int - -// Clone returns a copy of the record with no shared state. The original record -// and the clone can both be modified without interfering with each other. -func (r *Record) Clone() Record -``` +is defined as `Record` struct in [record.go](record.go). The `Record` is designed similarly to [`log.Record`](https://pkg.go.dev/go.opentelemetry.io/otel/log#Record) in order to reduce the number of heap allocations when processing attributes. @@ -372,7 +91,7 @@ Having less abstractions reduces the API surface and makes the design simpler. ## Benchmarking The benchmarks are supposed to test end-to-end scenarios -and avoid I/O that could affect the stability of the results, +and avoid I/O that could affect the stability of the results. The benchmark results can be found in [the prototype](https://github.com/open-telemetry/opentelemetry-go/pull/4955).