chore(deps): bump google.golang.org/grpc from 1.68.1 to 1.69.0
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.68.1 to 1.69.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.68.1...v1.69.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
parent
6a0bf878bf
commit
78d29aaef6
14
go.mod
14
go.mod
@ -10,7 +10,7 @@ require (
|
|||||||
github.com/pborman/uuid v1.2.1
|
github.com/pborman/uuid v1.2.1
|
||||||
github.com/stretchr/testify v1.10.0
|
github.com/stretchr/testify v1.10.0
|
||||||
golang.org/x/net v0.32.0
|
golang.org/x/net v0.32.0
|
||||||
google.golang.org/grpc v1.68.1
|
google.golang.org/grpc v1.69.0
|
||||||
google.golang.org/protobuf v1.35.2
|
google.golang.org/protobuf v1.35.2
|
||||||
k8s.io/api v0.28.12
|
k8s.io/api v0.28.12
|
||||||
k8s.io/apimachinery v0.28.12
|
k8s.io/apimachinery v0.28.12
|
||||||
@ -84,12 +84,12 @@ require (
|
|||||||
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.20.0 // indirect
|
go.opentelemetry.io/otel v1.31.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.20.0 // indirect
|
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
||||||
go.opentelemetry.io/otel/sdk v1.20.0 // indirect
|
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.20.0 // indirect
|
go.opentelemetry.io/otel/trace v1.31.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
|
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
|
||||||
go.uber.org/atomic v1.10.0 // indirect
|
go.uber.org/atomic v1.10.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
@ -104,8 +104,8 @@ require (
|
|||||||
golang.org/x/time v0.3.0 // indirect
|
golang.org/x/time v0.3.0 // indirect
|
||||||
golang.org/x/tools v0.26.0 // indirect
|
golang.org/x/tools v0.26.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
|
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
|
||||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
|
|||||||
34
go.sum
34
go.sum
@ -9,8 +9,8 @@ cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gc
|
|||||||
cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM=
|
cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM=
|
||||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||||
cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg=
|
cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg=
|
||||||
cloud.google.com/go/compute/metadata v0.5.0 h1:Zr0eK8JbFv6+Wi4ilXAR8FJ3wyNdpxHKJNPos6LTZOY=
|
cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo=
|
||||||
cloud.google.com/go/compute/metadata v0.5.0/go.mod h1:aHnloV2TPI38yx4s9+wAZhHykWvVCfu7hQbF+9CWoiY=
|
cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k=
|
||||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||||
@ -390,18 +390,20 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.4
|
|||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0 h1:1eHu3/pUSWaOgltNK3WJFaywKsTIr/PwvHyDmi0lQA0=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.0/go.mod h1:HyABWq60Uy1kjJSa2BVOxUVao8Cdick5AWSKPutqy6U=
|
||||||
go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc=
|
go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY=
|
||||||
go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs=
|
go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0=
|
||||||
go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA=
|
go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE=
|
||||||
go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM=
|
go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY=
|
||||||
go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM=
|
go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk=
|
||||||
go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0=
|
go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0=
|
||||||
go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ=
|
go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc=
|
||||||
go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU=
|
go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8=
|
||||||
|
go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys=
|
||||||
|
go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A=
|
||||||
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
|
go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I=
|
||||||
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
|
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
|
||||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||||
@ -576,10 +578,10 @@ google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvx
|
|||||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||||
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY=
|
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY=
|
||||||
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo=
|
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc=
|
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53 h1:fVoAXEKA4+yufmbdVYv+SE73+cPZbbbe8paLsHfkK+U=
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I=
|
google.golang.org/genproto/googleapis/api v0.0.0-20241015192408-796eee8c2d53/go.mod h1:riSXTwQ4+nqmPGtobMFyW5FqVAmIs0St6VPp4Ug7CE4=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 h1:X58yt85/IXCx0Y3ZwN6sEIKZzQtDEYaBWrDvErdXrRE=
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||||
@ -588,8 +590,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
|
|||||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||||
google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
google.golang.org/grpc v1.29.0/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||||
google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0=
|
google.golang.org/grpc v1.69.0 h1:quSiOM1GJPmPH5XtU+BCoVXcDVJJAzNcoyfC2cCjGkI=
|
||||||
google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw=
|
google.golang.org/grpc v1.69.0/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4=
|
||||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||||
|
|||||||
4
vendor/go.opentelemetry.io/otel/.codespellignore
generated
vendored
4
vendor/go.opentelemetry.io/otel/.codespellignore
generated
vendored
@ -3,3 +3,7 @@ fo
|
|||||||
te
|
te
|
||||||
collison
|
collison
|
||||||
consequentially
|
consequentially
|
||||||
|
ans
|
||||||
|
nam
|
||||||
|
valu
|
||||||
|
thirdparty
|
||||||
|
|||||||
2
vendor/go.opentelemetry.io/otel/.codespellrc
generated
vendored
2
vendor/go.opentelemetry.io/otel/.codespellrc
generated
vendored
@ -5,6 +5,6 @@ check-filenames =
|
|||||||
check-hidden =
|
check-hidden =
|
||||||
ignore-words = .codespellignore
|
ignore-words = .codespellignore
|
||||||
interactive = 1
|
interactive = 1
|
||||||
skip = .git,go.mod,go.sum,semconv,venv,.tools
|
skip = .git,go.mod,go.sum,go.work,go.work.sum,semconv,venv,.tools
|
||||||
uri-ignore-words-list = *
|
uri-ignore-words-list = *
|
||||||
write =
|
write =
|
||||||
|
|||||||
4
vendor/go.opentelemetry.io/otel/.gitignore
generated
vendored
4
vendor/go.opentelemetry.io/otel/.gitignore
generated
vendored
@ -14,13 +14,9 @@ go.work.sum
|
|||||||
gen/
|
gen/
|
||||||
|
|
||||||
/example/dice/dice
|
/example/dice/dice
|
||||||
/example/fib/fib
|
|
||||||
/example/fib/traces.txt
|
|
||||||
/example/jaeger/jaeger
|
|
||||||
/example/namedtracer/namedtracer
|
/example/namedtracer/namedtracer
|
||||||
/example/otel-collector/otel-collector
|
/example/otel-collector/otel-collector
|
||||||
/example/opencensus/opencensus
|
/example/opencensus/opencensus
|
||||||
/example/passthrough/passthrough
|
/example/passthrough/passthrough
|
||||||
/example/prometheus/prometheus
|
/example/prometheus/prometheus
|
||||||
/example/view/view
|
|
||||||
/example/zipkin/zipkin
|
/example/zipkin/zipkin
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/.gitmodules
generated
vendored
3
vendor/go.opentelemetry.io/otel/.gitmodules
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "opentelemetry-proto"]
|
|
||||||
path = exporters/otlp/internal/opentelemetry-proto
|
|
||||||
url = https://github.com/open-telemetry/opentelemetry-proto
|
|
||||||
19
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
19
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
@ -9,8 +9,11 @@ linters:
|
|||||||
disable-all: true
|
disable-all: true
|
||||||
# Specifically enable linters we want to use.
|
# Specifically enable linters we want to use.
|
||||||
enable:
|
enable:
|
||||||
|
- asasalint
|
||||||
|
- bodyclose
|
||||||
- depguard
|
- depguard
|
||||||
- errcheck
|
- errcheck
|
||||||
|
- errorlint
|
||||||
- godot
|
- godot
|
||||||
- gofumpt
|
- gofumpt
|
||||||
- goimports
|
- goimports
|
||||||
@ -21,8 +24,12 @@ linters:
|
|||||||
- misspell
|
- misspell
|
||||||
- revive
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
|
- tenv
|
||||||
|
- testifylint
|
||||||
- typecheck
|
- typecheck
|
||||||
|
- unconvert
|
||||||
- unused
|
- unused
|
||||||
|
- unparam
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
# Maximum issues count per one linter.
|
# Maximum issues count per one linter.
|
||||||
@ -58,12 +65,12 @@ issues:
|
|||||||
- path: _test\.go
|
- path: _test\.go
|
||||||
linters:
|
linters:
|
||||||
- gosec
|
- gosec
|
||||||
# Igonoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand)
|
# Ignoring gosec G404: Use of weak random number generator (math/rand instead of crypto/rand)
|
||||||
# as we commonly use it in tests and examples.
|
# as we commonly use it in tests and examples.
|
||||||
- text: "G404:"
|
- text: "G404:"
|
||||||
linters:
|
linters:
|
||||||
- gosec
|
- gosec
|
||||||
# Igonoring gosec G402: TLS MinVersion too low
|
# Ignoring gosec G402: TLS MinVersion too low
|
||||||
# as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well.
|
# as the https://pkg.go.dev/crypto/tls#Config handles MinVersion default well.
|
||||||
- text: "G402: TLS MinVersion too low."
|
- text: "G402: TLS MinVersion too low."
|
||||||
linters:
|
linters:
|
||||||
@ -124,6 +131,8 @@ linters-settings:
|
|||||||
- "**/example/**/*.go"
|
- "**/example/**/*.go"
|
||||||
- "**/trace/*.go"
|
- "**/trace/*.go"
|
||||||
- "**/trace/**/*.go"
|
- "**/trace/**/*.go"
|
||||||
|
- "**/log/*.go"
|
||||||
|
- "**/log/**/*.go"
|
||||||
deny:
|
deny:
|
||||||
- pkg: "go.opentelemetry.io/otel/internal$"
|
- pkg: "go.opentelemetry.io/otel/internal$"
|
||||||
desc: Do not use cross-module internal packages.
|
desc: Do not use cross-module internal packages.
|
||||||
@ -294,3 +303,9 @@ linters-settings:
|
|||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#waitgroup-by-value
|
||||||
- name: waitgroup-by-value
|
- name: waitgroup-by-value
|
||||||
disabled: false
|
disabled: false
|
||||||
|
testifylint:
|
||||||
|
enable-all: true
|
||||||
|
disable:
|
||||||
|
- float-compare
|
||||||
|
- go-require
|
||||||
|
- require-error
|
||||||
|
|||||||
427
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
427
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
@ -8,9 +8,398 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
<!-- Released section -->
|
||||||
|
<!-- Don't change this section unless doing release -->
|
||||||
|
|
||||||
|
## [1.31.0/0.53.0/0.7.0/0.0.10] 2024-10-11
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add `go.opentelemetry.io/otel/sdk/metric/exemplar` package which includes `Exemplar`, `Filter`, `TraceBasedFilter`, `AlwaysOnFilter`, `HistogramReservoir`, `FixedSizeReservoir`, `Reservoir`, `Value` and `ValueType` types. These will be used for configuring the exemplar reservoir for the metrics sdk. (#5747, #5862)
|
||||||
|
- Add `WithExportBufferSize` option to log batch processor.(#5877)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Enable exemplars by default in `go.opentelemetry.io/otel/sdk/metric`. Exemplars can be disabled by setting `OTEL_METRICS_EXEMPLAR_FILTER=always_off` (#5778)
|
||||||
|
- `Logger.Enabled` in `go.opentelemetry.io/otel/log` now accepts a newly introduced `EnabledParameters` type instead of `Record`. (#5791)
|
||||||
|
- `FilterProcessor.Enabled` in `go.opentelemetry.io/otel/sdk/log/internal/x` now accepts `EnabledParameters` instead of `Record`. (#5791)
|
||||||
|
- The `Record` type in `go.opentelemetry.io/otel/log` is no longer comparable. (#5847)
|
||||||
|
- Performance improvements for the trace SDK `SetAttributes` method in `Span`. (#5864)
|
||||||
|
- Reduce memory allocations for the `Event` and `Link` lists in `Span`. (#5858)
|
||||||
|
- Performance improvements for the trace SDK `AddEvent`, `AddLink`, `RecordError` and `End` methods in `Span`. (#5874)
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
- Deprecate all examples under `go.opentelemetry.io/otel/example` as they are moved to [Contrib repository](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples). (#5854)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- The race condition for multiple `FixedSize` exemplar reservoirs identified in #5814 is resolved. (#5819)
|
||||||
|
- Fix log records duplication in case of heterogeneous resource attributes by correctly mapping each log record to it's resource and scope. (#5803)
|
||||||
|
- Fix timer channel drain to avoid hanging on Go 1.23. (#5868)
|
||||||
|
- Fix delegation for global meter providers, and panic when calling otel.SetMeterProvider. (#5827)
|
||||||
|
- Change the `reflect.TypeOf` to use a nil pointer to not allocate on the heap unless necessary. (#5827)
|
||||||
|
|
||||||
|
## [1.30.0/0.52.0/0.6.0/0.0.9] 2024-09-09
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support `OTEL_EXPORTER_OTLP_LOGS_INSECURE` and `OTEL_EXPORTER_OTLP_INSECURE` environments in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#5739)
|
||||||
|
- The `WithResource` option for `NewMeterProvider` now merges the provided resources with the ones from environment variables. (#5773)
|
||||||
|
- The `WithResource` option for `NewLoggerProvider` now merges the provided resources with the ones from environment variables. (#5773)
|
||||||
|
- Add UTF-8 support to `go.opentelemetry.io/otel/exporters/prometheus`. (#5755)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix memory leak in the global `MeterProvider` when identical instruments are repeatedly created. (#5754)
|
||||||
|
- Fix panic on instruments creation when setting meter provider. (#5758)
|
||||||
|
- Fix an issue where `SetMeterProvider` in `go.opentelemetry.io/otel` might miss the delegation for instruments and registries. (#5780)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Drop support for [Go 1.21]. (#5736, #5740, #5800)
|
||||||
|
|
||||||
|
## [1.29.0/0.51.0/0.5.0] 2024-08-23
|
||||||
|
|
||||||
|
This release is the last to support [Go 1.21].
|
||||||
|
The next release will require at least [Go 1.22].
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add MacOS ARM64 platform to the compatibility testing suite. (#5577)
|
||||||
|
- Add `InstrumentationScope` field to `SpanStub` in `go.opentelemetry.io/otel/sdk/trace/tracetest`, as a replacement for the deprecated `InstrumentationLibrary`. (#5627)
|
||||||
|
- Make the initial release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`.
|
||||||
|
This new module contains an OTLP exporter that transmits log telemetry using gRPC.
|
||||||
|
This module is unstable and breaking changes may be introduced.
|
||||||
|
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5629)
|
||||||
|
- Add `Walk` function to `TraceState` in `go.opentelemetry.io/otel/trace` to iterate all the key-value pairs. (#5651)
|
||||||
|
- Bridge the trace state in `go.opentelemetry.io/otel/bridge/opencensus`. (#5651)
|
||||||
|
- Zero value of `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` no longer panics. (#5665)
|
||||||
|
- The `FilterProcessor` interface type is added in `go.opentelemetry.io/otel/sdk/log/internal/x`.
|
||||||
|
This is an optional and experimental interface that log `Processor`s can implement to instruct the `Logger` if a `Record` will be processed or not.
|
||||||
|
It replaces the existing `Enabled` method that is removed from the `Processor` interface itself.
|
||||||
|
It does not fall within the scope of the OpenTelemetry Go versioning and stability [policy](./VERSIONING.md) and it may be changed in backwards incompatible ways or removed in feature releases. (#5692)
|
||||||
|
- Support [Go 1.23]. (#5720)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `NewMemberRaw`, `NewKeyProperty` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage` allow UTF-8 string in key. (#5132)
|
||||||
|
- `Processor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` now accepts a pointer to `Record` instead of a value so that the record modifications done in a processor are propagated to subsequent registered processors. (#5636)
|
||||||
|
- `SimpleProcessor.Enabled` in `go.opentelemetry.io/otel/sdk/log` now returns `false` if the exporter is `nil`. (#5665)
|
||||||
|
- Update the concurrency requirements of `Exporter` in `go.opentelemetry.io/otel/sdk/log`. (#5666)
|
||||||
|
- `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` synchronizes `OnEmit` calls. (#5666)
|
||||||
|
- The `Processor` interface in `go.opentelemetry.io/otel/sdk/log` no longer includes the `Enabled` method.
|
||||||
|
See the `FilterProcessor` interface type added in `go.opentelemetry.io/otel/sdk/log/internal/x` to continue providing this functionality. (#5692)
|
||||||
|
- The `SimpleProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693)
|
||||||
|
- The `BatchProcessor` type in `go.opentelemetry.io/otel/sdk/log` is no longer comparable. (#5693)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5584)
|
||||||
|
- Pass the underlying error rather than a generic retry-able failure in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`, `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` and `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#5541)
|
||||||
|
- Correct the `Tracer`, `Meter`, and `Logger` names used in `go.opentelemetry.io/otel/example/dice`. (#5612)
|
||||||
|
- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/namedtracer`. (#5612)
|
||||||
|
- Correct the `Tracer` name used in `go.opentelemetry.io/otel/example/opencensus`. (#5612)
|
||||||
|
- Correct the `Tracer` and `Meter` names used in `go.opentelemetry.io/otel/example/otel-collector`. (#5612)
|
||||||
|
- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/passthrough`. (#5612)
|
||||||
|
- Correct the `Meter` name used in `go.opentelemetry.io/otel/example/prometheus`. (#5612)
|
||||||
|
- Correct the `Tracer` names used in `go.opentelemetry.io/otel/example/zipkin`. (#5612)
|
||||||
|
- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#5641)
|
||||||
|
- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5650)
|
||||||
|
- Stop percent encoding header environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` (#5705)
|
||||||
|
- Remove invalid environment variable header keys in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`, `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`, `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` (#5705)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- The `Enabled` method of the `SimpleProcessor` in `go.opentelemetry.io/otel/sdk/log` is removed. (#5692)
|
||||||
|
- The `Enabled` method of the `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` is removed. (#5692)
|
||||||
|
|
||||||
|
## [1.28.0/0.50.0/0.4.0] 2024-07-02
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- The `IsEmpty` method is added to the `Instrument` type in `go.opentelemetry.io/otel/sdk/metric`.
|
||||||
|
This method is used to check if an `Instrument` instance is a zero-value. (#5431)
|
||||||
|
- Store and provide the emitted `context.Context` in `ScopeRecords` of `go.opentelemetry.io/otel/sdk/log/logtest`. (#5468)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.26.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.26.0` version of the OpenTelemetry Semantic Conventions. (#5476)
|
||||||
|
- The `AssertRecordEqual` method to `go.opentelemetry.io/otel/log/logtest` to allow comparison of two log records in tests. (#5499)
|
||||||
|
- The `WithHeaders` option to `go.opentelemetry.io/otel/exporters/zipkin` to allow configuring custom http headers while exporting spans. (#5530)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `Tracer.Start` in `go.opentelemetry.io/otel/trace/noop` no longer allocates a span for empty span context. (#5457)
|
||||||
|
- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/otel-collector`. (#5490)
|
||||||
|
- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/example/zipkin`. (#5490)
|
||||||
|
- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/exporters/zipkin`. (#5490)
|
||||||
|
- The exporter no longer exports the deprecated "otel.library.name" or "otel.library.version" attributes.
|
||||||
|
- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/resource`. (#5490)
|
||||||
|
- Upgrade `go.opentelemetry.io/otel/semconv/v1.25.0` to `go.opentelemetry.io/otel/semconv/v1.26.0` in `go.opentelemetry.io/otel/sdk/trace`. (#5490)
|
||||||
|
- `SimpleProcessor.OnEmit` in `go.opentelemetry.io/otel/sdk/log` no longer allocates a slice which makes it possible to have a zero-allocation log processing using `SimpleProcessor`. (#5493)
|
||||||
|
- Use non-generic functions in the `Start` method of `"go.opentelemetry.io/otel/sdk/trace".Trace` to reduce memory allocation. (#5497)
|
||||||
|
- `service.instance.id` is populated for a `Resource` created with `"go.opentelemetry.io/otel/sdk/resource".Default` with a default value when `OTEL_GO_X_RESOURCE` is set. (#5520)
|
||||||
|
- Improve performance of metric instruments in `go.opentelemetry.io/otel/sdk/metric` by removing unnecessary calls to `time.Now`. (#5545)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Log a warning to the OpenTelemetry internal logger when a `Record` in `go.opentelemetry.io/otel/sdk/log` drops an attribute due to a limit being reached. (#5376)
|
||||||
|
- Identify the `Tracer` returned from the global `TracerProvider` in `go.opentelemetry.io/otel/global` with its schema URL. (#5426)
|
||||||
|
- Identify the `Meter` returned from the global `MeterProvider` in `go.opentelemetry.io/otel/global` with its schema URL. (#5426)
|
||||||
|
- Log a warning to the OpenTelemetry internal logger when a `Span` in `go.opentelemetry.io/otel/sdk/trace` drops an attribute, event, or link due to a limit being reached. (#5434)
|
||||||
|
- Document instrument name requirements in `go.opentelemetry.io/otel/metric`. (#5435)
|
||||||
|
- Prevent random number generation data-race for experimental rand exemplars in `go.opentelemetry.io/otel/sdk/metric`. (#5456)
|
||||||
|
- Fix counting number of dropped attributes of `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5464)
|
||||||
|
- Fix panic in baggage creation when a member contains `0x80` char in key or value. (#5494)
|
||||||
|
- Correct comments for the priority of the `WithEndpoint` and `WithEndpointURL` options and their corresponding environment variables in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#5508)
|
||||||
|
- Retry trace and span ID generation if it generated an invalid one in `go.opentelemetry.io/otel/sdk/trace`. (#5514)
|
||||||
|
- Fix stale timestamps reported by the last-value aggregation. (#5517)
|
||||||
|
- Indicate the `Exporter` in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp` must be created by the `New` method. (#5521)
|
||||||
|
- Improved performance in all `{Bool,Int64,Float64,String}SliceValue` functions of `go.opentelemetry.io/attributes` by reducing the number of allocations. (#5549)
|
||||||
|
- Replace invalid percent-encoded octet sequences with replacement char in `go.opentelemetry.io/otel/baggage`. (#5528)
|
||||||
|
|
||||||
|
## [1.27.0/0.49.0/0.3.0] 2024-05-21
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add example for `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#5242)
|
||||||
|
- Add `RecordFactory` in `go.opentelemetry.io/otel/sdk/log/logtest` to facilitate testing exporter and processor implementations. (#5258)
|
||||||
|
- Add `RecordFactory` in `go.opentelemetry.io/otel/log/logtest` to facilitate testing bridge implementations. (#5263)
|
||||||
|
- The count of dropped records from the `BatchProcessor` in `go.opentelemetry.io/otel/sdk/log` is logged. (#5276)
|
||||||
|
- Add metrics in the `otel-collector` example. (#5283)
|
||||||
|
- Add the synchronous gauge instrument to `go.opentelemetry.io/otel/metric`. (#5304)
|
||||||
|
- An `int64` or `float64` synchronous gauge instrument can now be created from a `Meter`.
|
||||||
|
- All implementations of the API (`go.opentelemetry.io/otel/metric/noop`, `go.opentelemetry.io/otel/sdk/metric`) are updated to support this instrument.
|
||||||
|
- Add logs to `go.opentelemetry.io/otel/example/dice`. (#5349)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- The `Shutdown` method of `Exporter` in `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` ignores the context cancellation and always returns `nil`. (#5189)
|
||||||
|
- The `ForceFlush` and `Shutdown` methods of the exporter returned by `New` in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` ignore the context cancellation and always return `nil`. (#5189)
|
||||||
|
- Apply the value length limits to `Record` attributes in `go.opentelemetry.io/otel/sdk/log`. (#5230)
|
||||||
|
- De-duplicate map attributes added to a `Record` in `go.opentelemetry.io/otel/sdk/log`. (#5230)
|
||||||
|
- `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` won't print timestamps when `WithoutTimestamps` option is set. (#5241)
|
||||||
|
- The `go.opentelemetry.io/otel/exporters/stdout/stdoutlog` exporter won't print `AttributeValueLengthLimit` and `AttributeCountLimit` fields now, instead it prints the `DroppedAttributes` field. (#5272)
|
||||||
|
- Improved performance in the `Stringer` implementation of `go.opentelemetry.io/otel/baggage.Member` by reducing the number of allocations. (#5286)
|
||||||
|
- Set the start time for last-value aggregates in `go.opentelemetry.io/otel/sdk/metric`. (#5305)
|
||||||
|
- The `Span` in `go.opentelemetry.io/otel/sdk/trace` will record links without span context if either non-empty `TraceState` or attributes are provided. (#5315)
|
||||||
|
- Upgrade all dependencies of `go.opentelemetry.io/otel/semconv/v1.24.0` to `go.opentelemetry.io/otel/semconv/v1.25.0`. (#5374)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Comparison of unordered maps for `go.opentelemetry.io/otel/log.KeyValue` and `go.opentelemetry.io/otel/log.Value`. (#5306)
|
||||||
|
- Fix the empty output of `go.opentelemetry.io/otel/log.Value` in `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`. (#5311)
|
||||||
|
- Split the behavior of `Recorder` in `go.opentelemetry.io/otel/log/logtest` so it behaves as a `LoggerProvider` only. (#5365)
|
||||||
|
- Fix wrong package name of the error message when parsing endpoint URL in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#5371)
|
||||||
|
- Identify the `Logger` returned from the global `LoggerProvider` in `go.opentelemetry.io/otel/log/global` with its schema URL. (#5375)
|
||||||
|
|
||||||
|
## [1.26.0/0.48.0/0.2.0-alpha] 2024-04-24
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add `Recorder` in `go.opentelemetry.io/otel/log/logtest` to facilitate testing the log bridge implementations. (#5134)
|
||||||
|
- Add span flags to OTLP spans and links exported by `go.opentelemetry.io/otel/exporters/otlp/otlptrace`. (#5194)
|
||||||
|
- Make the initial alpha release of `go.opentelemetry.io/otel/sdk/log`.
|
||||||
|
This new module contains the Go implementation of the OpenTelemetry Logs SDK.
|
||||||
|
This module is unstable and breaking changes may be introduced.
|
||||||
|
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240)
|
||||||
|
- Make the initial alpha release of `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`.
|
||||||
|
This new module contains an OTLP exporter that transmits log telemetry using HTTP.
|
||||||
|
This module is unstable and breaking changes may be introduced.
|
||||||
|
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240)
|
||||||
|
- Make the initial alpha release of `go.opentelemetry.io/otel/exporters/stdout/stdoutlog`.
|
||||||
|
This new module contains an exporter prints log records to STDOUT.
|
||||||
|
This module is unstable and breaking changes may be introduced.
|
||||||
|
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees. (#5240)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.25.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.25.0` version of the OpenTelemetry Semantic Conventions. (#5254)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Update `go.opentelemetry.io/proto/otlp` from v1.1.0 to v1.2.0. (#5177)
|
||||||
|
- Improve performance of baggage member character validation in `go.opentelemetry.io/otel/baggage`. (#5214)
|
||||||
|
- The `otel-collector` example now uses docker compose to bring up services instead of kubernetes. (#5244)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Slice attribute values in `go.opentelemetry.io/otel/attribute` are now emitted as their JSON representation. (#5159)
|
||||||
|
|
||||||
|
## [1.25.0/0.47.0/0.0.8/0.1.0-alpha] 2024-04-05
|
||||||
|
|
||||||
|
### 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)
|
||||||
|
- Add `AddLink` method to the `Span` interface in `go.opentelemetry.io/otel/trace`. (#5032)
|
||||||
|
- 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)
|
||||||
|
- Add `go.opentelemetry.io/otel/log/global` to manage the global `LoggerProvider`.
|
||||||
|
This package is provided with the anticipation that all functionality will be migrate to `go.opentelemetry.io/otel` when `go.opentelemetry.io/otel/log` stabilizes.
|
||||||
|
At which point, users will be required to migrage their code, and this package will be deprecated then removed. (#5085)
|
||||||
|
- Add support for `Summary` metrics in the `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` exporters. (#5100)
|
||||||
|
- Add `otel.scope.name` and `otel.scope.version` tags to spans exported by `go.opentelemetry.io/otel/exporters/zipkin`. (#5108)
|
||||||
|
- Add support for `AddLink` to `go.opentelemetry.io/otel/bridge/opencensus`. (#5116)
|
||||||
|
- Add `String` method to `Value` and `KeyValue` in `go.opentelemetry.io/otel/log`. (#5117)
|
||||||
|
- Add Exemplar support to `go.opentelemetry.io/otel/exporters/prometheus`. (#5111)
|
||||||
|
- Add metric semantic conventions to `go.opentelemetry.io/otel/semconv/v1.24.0`. Future `semconv` packages will include metric semantic conventions as well. (#4528)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `SpanFromContext` and `SpanContextFromContext` in `go.opentelemetry.io/otel/trace` no longer make a heap allocation when the passed context has no span. (#5049)
|
||||||
|
- `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` and `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` now create a gRPC client in idle mode and with "dns" as the default resolver using [`grpc.NewClient`](https://pkg.go.dev/google.golang.org/grpc#NewClient). (#5151)
|
||||||
|
Because of that `WithDialOption` ignores [`grpc.WithBlock`](https://pkg.go.dev/google.golang.org/grpc#WithBlock), [`grpc.WithTimeout`](https://pkg.go.dev/google.golang.org/grpc#WithTimeout), and [`grpc.WithReturnConnectionError`](https://pkg.go.dev/google.golang.org/grpc#WithReturnConnectionError).
|
||||||
|
Notice that [`grpc.DialContext`](https://pkg.go.dev/google.golang.org/grpc#DialContext) which was used before is now deprecated.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Clarify the documentation about equivalence guarantees for the `Set` and `Distinct` types in `go.opentelemetry.io/otel/attribute`. (#5027)
|
||||||
|
- Prevent default `ErrorHandler` self-delegation. (#5137)
|
||||||
|
- Update all dependencies to address [GO-2024-2687]. (#5139)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- 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].
|
||||||
|
The next release will require at least [Go 1.21].
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Support [Go 1.22]. (#4890)
|
||||||
|
- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#4900)
|
||||||
|
- Add exemplar support to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4900)
|
||||||
|
- The `go.opentelemetry.io/otel/log` module is added.
|
||||||
|
This module includes OpenTelemetry Go's implementation of the Logs Bridge API.
|
||||||
|
This module is in an alpha state, it is subject to breaking changes.
|
||||||
|
See our [versioning policy](./VERSIONING.md) for more info. (#4961)
|
||||||
|
- Add ARM64 platform to the compatibility testing suite. (#4994)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix registration of multiple callbacks when using the global meter provider from `go.opentelemetry.io/otel`. (#4945)
|
||||||
|
- Fix negative buckets in output of exponential histograms. (#4956)
|
||||||
|
|
||||||
|
## [1.23.1] 2024-02-07
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Register all callbacks passed during observable instrument creation instead of just the last one multiple times in `go.opentelemetry.io/otel/sdk/metric`. (#4888)
|
||||||
|
|
||||||
|
## [1.23.0] 2024-02-06
|
||||||
|
|
||||||
|
This release contains the first stable, `v1`, release of the following modules:
|
||||||
|
|
||||||
|
- `go.opentelemetry.io/otel/bridge/opencensus`
|
||||||
|
- `go.opentelemetry.io/otel/bridge/opencensus/test`
|
||||||
|
- `go.opentelemetry.io/otel/example/opencensus`
|
||||||
|
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`
|
||||||
|
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`
|
||||||
|
- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric`
|
||||||
|
|
||||||
|
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Add `WithEndpointURL` option to the `exporters/otlp/otlpmetric/otlpmetricgrpc`, `exporters/otlp/otlpmetric/otlpmetrichttp`, `exporters/otlp/otlptrace/otlptracegrpc` and `exporters/otlp/otlptrace/otlptracehttp` packages. (#4808)
|
||||||
|
- Experimental exemplar exporting is added to the metric SDK.
|
||||||
|
See [metric documentation](./sdk/metric/internal/x/README.md#exemplars) for more information about this feature and how to enable it. (#4871)
|
||||||
|
- `ErrSchemaURLConflict` is added to `go.opentelemetry.io/otel/sdk/resource`.
|
||||||
|
This error is returned when a merge of two `Resource`s with different (non-empty) schema URL is attempted. (#4876)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- The `Merge` and `New` functions in `go.opentelemetry.io/otel/sdk/resource` now returns a partial result if there is a schema URL merge conflict.
|
||||||
|
Instead of returning `nil` when two `Resource`s with different (non-empty) schema URLs are merged the merged `Resource`, along with the new `ErrSchemaURLConflict` error, is returned.
|
||||||
|
It is up to the user to decide if they want to use the returned `Resource` or not.
|
||||||
|
It may have desired attributes overwritten or include stale semantic conventions. (#4876)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix `ContainerID` resource detection on systemd when cgroup path has a colon. (#4449)
|
||||||
|
- Fix `go.opentelemetry.io/otel/sdk/metric` to cache instruments to avoid leaking memory when the same instrument is created multiple times. (#4820)
|
||||||
|
- Fix missing `Mix` and `Max` values for `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` by introducing `MarshalText` and `MarshalJSON` for the `Extrema` type in `go.opentelemetry.io/sdk/metric/metricdata`. (#4827)
|
||||||
|
|
||||||
|
## [1.23.0-rc.1] 2024-01-18
|
||||||
|
|
||||||
|
This is a release candidate for the v1.23.0 release.
|
||||||
|
That release is expected to include the `v1` release of the following modules:
|
||||||
|
|
||||||
|
- `go.opentelemetry.io/otel/bridge/opencensus`
|
||||||
|
- `go.opentelemetry.io/otel/bridge/opencensus/test`
|
||||||
|
- `go.opentelemetry.io/otel/example/opencensus`
|
||||||
|
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`
|
||||||
|
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`
|
||||||
|
- `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric`
|
||||||
|
|
||||||
|
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
|
||||||
|
|
||||||
|
## [1.22.0/0.45.0] 2024-01-17
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.22.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.22.0` version of the OpenTelemetry Semantic Conventions. (#4735)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.23.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.23.0` version of the OpenTelemetry Semantic Conventions. (#4746)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.23.1` package.
|
||||||
|
The package contains semantic conventions from the `v1.23.1` version of the OpenTelemetry Semantic Conventions. (#4749)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.24.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.24.0` version of the OpenTelemetry Semantic Conventions. (#4770)
|
||||||
|
- Add `WithResourceAsConstantLabels` option to apply resource attributes for every metric emitted by the Prometheus exporter. (#4733)
|
||||||
|
- Experimental cardinality limiting is added to the metric SDK.
|
||||||
|
See [metric documentation](./sdk/metric/internal/x/README.md#cardinality-limit) for more information about this feature and how to enable it. (#4457)
|
||||||
|
- Add `NewMemberRaw` and `NewKeyValuePropertyRaw` in `go.opentelemetry.io/otel/baggage`. (#4804)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Upgrade all use of `go.opentelemetry.io/otel/semconv` to use `v1.24.0`. (#4754)
|
||||||
|
- Update transformations in `go.opentelemetry.io/otel/exporters/zipkin` to follow `v1.24.0` version of the OpenTelemetry specification. (#4754)
|
||||||
|
- Record synchronous measurements when the passed context is canceled instead of dropping in `go.opentelemetry.io/otel/sdk/metric`.
|
||||||
|
If you do not want to make a measurement when the context is cancelled, you need to handle it yourself (e.g `if ctx.Err() != nil`). (#4671)
|
||||||
|
- Improve `go.opentelemetry.io/otel/trace.TraceState`'s performance. (#4722)
|
||||||
|
- Improve `go.opentelemetry.io/otel/propagation.TraceContext`'s performance. (#4721)
|
||||||
|
- Improve `go.opentelemetry.io/otel/baggage` performance. (#4743)
|
||||||
|
- Improve performance of the `(*Set).Filter` method in `go.opentelemetry.io/otel/attribute` when the passed filter does not filter out any attributes from the set. (#4774)
|
||||||
|
- `Member.String` in `go.opentelemetry.io/otel/baggage` percent-encodes only when necessary. (#4775)
|
||||||
|
- Improve `go.opentelemetry.io/otel/trace.Span`'s performance when adding multiple attributes. (#4818)
|
||||||
|
- `Property.Value` in `go.opentelemetry.io/otel/baggage` now returns a raw string instead of a percent-encoded value. (#4804)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fix `Parse` in `go.opentelemetry.io/otel/baggage` to validate member value before percent-decoding. (#4755)
|
||||||
|
- Fix whitespace encoding of `Member.String` in `go.opentelemetry.io/otel/baggage`. (#4756)
|
||||||
|
- Fix observable not registered error when the asynchronous instrument has a drop aggregation in `go.opentelemetry.io/otel/sdk/metric`. (#4772)
|
||||||
|
- Fix baggage item key so that it is not canonicalized in `go.opentelemetry.io/otel/bridge/opentracing`. (#4776)
|
||||||
|
- Fix `go.opentelemetry.io/otel/bridge/opentracing` to properly handle baggage values that requires escaping during propagation. (#4804)
|
||||||
|
- Fix a bug where using multiple readers resulted in incorrect asynchronous counter values in `go.opentelemetry.io/otel/sdk/metric`. (#4742)
|
||||||
|
|
||||||
|
## [1.21.0/0.44.0] 2023-11-16
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Remove the deprecated `go.opentelemetry.io/otel/bridge/opencensus.NewTracer`. (#4706)
|
||||||
|
- Remove the deprecated `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` module. (#4707)
|
||||||
|
- Remove the deprecated `go.opentelemetry.io/otel/example/view` module. (#4708)
|
||||||
|
- Remove the deprecated `go.opentelemetry.io/otel/example/fib` module. (#4723)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#4719)
|
||||||
|
- Do not parse non-protobuf responses in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#4719)
|
||||||
|
|
||||||
## [1.20.0/0.43.0] 2023-11-10
|
## [1.20.0/0.43.0] 2023-11-10
|
||||||
|
|
||||||
This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementors need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this.
|
This release brings a breaking change for custom trace API implementations. Some interfaces (`TracerProvider`, `Tracer`, `Span`) now embed the `go.opentelemetry.io/otel/trace/embedded` types. Implementers need to update their implementations based on what they want the default behavior to be. See the "API Implementations" section of the [trace API] package documentation for more information about how to accomplish this.
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
@ -42,15 +431,15 @@ This release brings a breaking change for custom trace API implementations. Some
|
|||||||
- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583)
|
- `go.opentelemetry.io/otel/bridge/opencensus.NewMetricProducer` returns a `*MetricProducer` struct instead of the metric.Producer interface. (#4583)
|
||||||
- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type.
|
- The `TracerProvider` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.TracerProvider` type.
|
||||||
This extends the `TracerProvider` interface and is is a breaking change for any existing implementation.
|
This extends the `TracerProvider` interface and is is a breaking change for any existing implementation.
|
||||||
Implementors need to update their implementations based on what they want the default behavior of the interface to be.
|
Implementers need to update their implementations based on what they want the default behavior of the interface to be.
|
||||||
See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620)
|
See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620)
|
||||||
- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type.
|
- The `Tracer` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Tracer` type.
|
||||||
This extends the `Tracer` interface and is is a breaking change for any existing implementation.
|
This extends the `Tracer` interface and is is a breaking change for any existing implementation.
|
||||||
Implementors need to update their implementations based on what they want the default behavior of the interface to be.
|
Implementers need to update their implementations based on what they want the default behavior of the interface to be.
|
||||||
See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620)
|
See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620)
|
||||||
- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type.
|
- The `Span` in `go.opentelemetry.io/otel/trace` now embeds the `go.opentelemetry.io/otel/trace/embedded.Span` type.
|
||||||
This extends the `Span` interface and is is a breaking change for any existing implementation.
|
This extends the `Span` interface and is is a breaking change for any existing implementation.
|
||||||
Implementors need to update their implementations based on what they want the default behavior of the interface to be.
|
Implementers need to update their implementations based on what they want the default behavior of the interface to be.
|
||||||
See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620)
|
See the "API Implementations" section of the `go.opentelemetry.io/otel/trace` package documentation for more information about how to accomplish this. (#4620)
|
||||||
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660)
|
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660)
|
||||||
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660)
|
- `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp` does no longer depend on `go.opentelemetry.io/otel/exporters/otlp/otlpmetric`. (#4660)
|
||||||
@ -686,7 +1075,7 @@ The next release will require at least [Go 1.19].
|
|||||||
- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340)
|
- Exported `Status` codes in the `go.opentelemetry.io/otel/exporters/zipkin` exporter are now exported as all upper case values. (#3340)
|
||||||
- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436)
|
- `Aggregation`s from `go.opentelemetry.io/otel/sdk/metric` with no data are not exported. (#3394, #3436)
|
||||||
- Re-enabled Attribute Filters in the Metric SDK. (#3396)
|
- Re-enabled Attribute Filters in the Metric SDK. (#3396)
|
||||||
- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408)
|
- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggregation. (#3408)
|
||||||
- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432)
|
- Do not report empty partial-success responses in the `go.opentelemetry.io/otel/exporters/otlp` exporters. (#3438, #3432)
|
||||||
- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440)
|
- Handle partial success responses in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` exporters. (#3162, #3440)
|
||||||
- Prevent duplicate Prometheus description, unit, and type. (#3469)
|
- Prevent duplicate Prometheus description, unit, and type. (#3469)
|
||||||
@ -1554,7 +1943,7 @@ with major version 0.
|
|||||||
- Setting error status while recording error with Span from oteltest package. (#1729)
|
- Setting error status while recording error with Span from oteltest package. (#1729)
|
||||||
- The concept of a remote and local Span stored in a context is unified to just the current Span.
|
- The concept of a remote and local Span stored in a context is unified to just the current Span.
|
||||||
Because of this `"go.opentelemetry.io/otel/trace".RemoteSpanContextFromContext` is removed as it is no longer needed.
|
Because of this `"go.opentelemetry.io/otel/trace".RemoteSpanContextFromContext` is removed as it is no longer needed.
|
||||||
Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContex` can be used to return the current Span.
|
Instead, `"go.opentelemetry.io/otel/trace".SpanContextFromContext` can be used to return the current Span.
|
||||||
If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731)
|
If needed, that Span's `SpanContext.IsRemote()` can then be used to determine if it is remote or not. (#1731)
|
||||||
- The `HasRemoteParent` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is removed.
|
- The `HasRemoteParent` field of the `"go.opentelemetry.io/otel/sdk/trace".SamplingParameters` is removed.
|
||||||
This field is redundant to the information returned from the `Remote` method of the `SpanContext` held in the `ParentContext` field. (#1749)
|
This field is redundant to the information returned from the `Remote` method of the `SpanContext` held in the `ParentContext` field. (#1749)
|
||||||
@ -1731,7 +2120,7 @@ with major version 0.
|
|||||||
- `NewExporter` from `exporters/otlp` now takes a `ProtocolDriver` as a parameter. (#1369)
|
- `NewExporter` from `exporters/otlp` now takes a `ProtocolDriver` as a parameter. (#1369)
|
||||||
- Many OTLP Exporter options became gRPC ProtocolDriver options. (#1369)
|
- Many OTLP Exporter options became gRPC ProtocolDriver options. (#1369)
|
||||||
- Unify endpoint API that related to OTel exporter. (#1401)
|
- Unify endpoint API that related to OTel exporter. (#1401)
|
||||||
- Optimize metric histogram aggregator to re-use its slice of buckets. (#1435)
|
- Optimize metric histogram aggregator to reuse its slice of buckets. (#1435)
|
||||||
- Metric aggregator Count() and histogram Bucket.Counts are consistently `uint64`. (1430)
|
- Metric aggregator Count() and histogram Bucket.Counts are consistently `uint64`. (1430)
|
||||||
- Histogram aggregator accepts functional options, uses default boundaries if none given. (#1434)
|
- Histogram aggregator accepts functional options, uses default boundaries if none given. (#1434)
|
||||||
- `SamplingResult` now passed a `Tracestate` from the parent `SpanContext` (#1432)
|
- `SamplingResult` now passed a `Tracestate` from the parent `SpanContext` (#1432)
|
||||||
@ -2128,7 +2517,7 @@ This release migrates the default OpenTelemetry SDK into its own Go module, deco
|
|||||||
- Prometheus exporter will not apply stale updates or forget inactive metrics. (#903)
|
- Prometheus exporter will not apply stale updates or forget inactive metrics. (#903)
|
||||||
- Add test for api.standard `HTTPClientAttributesFromHTTPRequest`. (#905)
|
- Add test for api.standard `HTTPClientAttributesFromHTTPRequest`. (#905)
|
||||||
- Bump github.com/golangci/golangci-lint from 1.27.0 to 1.28.1 in /tools. (#901, #913)
|
- Bump github.com/golangci/golangci-lint from 1.27.0 to 1.28.1 in /tools. (#901, #913)
|
||||||
- Update otel-colector example to use the v0.5.0 collector. (#915)
|
- Update otel-collector example to use the v0.5.0 collector. (#915)
|
||||||
- The `grpctrace` instrumentation uses a span name conforming to the OpenTelemetry semantic conventions (does not contain a leading slash (`/`)). (#922)
|
- The `grpctrace` instrumentation uses a span name conforming to the OpenTelemetry semantic conventions (does not contain a leading slash (`/`)). (#922)
|
||||||
- The `grpctrace` instrumentation includes an `rpc.method` attribute now set to the gRPC method name. (#900, #922)
|
- The `grpctrace` instrumentation includes an `rpc.method` attribute now set to the gRPC method name. (#900, #922)
|
||||||
- The `grpctrace` instrumentation `rpc.service` attribute now contains the package name if one exists.
|
- The `grpctrace` instrumentation `rpc.service` attribute now contains the package name if one exists.
|
||||||
@ -2721,7 +3110,20 @@ It contains api and sdk for trace and meter.
|
|||||||
- CircleCI build CI manifest files.
|
- CircleCI build CI manifest files.
|
||||||
- CODEOWNERS file to track owners of this project.
|
- CODEOWNERS file to track owners of this project.
|
||||||
|
|
||||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.20.0...HEAD
|
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.31.0...HEAD
|
||||||
|
[1.31.0/0.53.0/0.7.0/0.0.10]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.31.0
|
||||||
|
[1.30.0/0.52.0/0.6.0/0.0.9]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.30.0
|
||||||
|
[1.29.0/0.51.0/0.5.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.29.0
|
||||||
|
[1.28.0/0.50.0/0.4.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.28.0
|
||||||
|
[1.27.0/0.49.0/0.3.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.27.0
|
||||||
|
[1.26.0/0.48.0/0.2.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.26.0
|
||||||
|
[1.25.0/0.47.0/0.0.8/0.1.0-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.25.0
|
||||||
|
[1.24.0/0.46.0/0.0.1-alpha]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.24.0
|
||||||
|
[1.23.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.1
|
||||||
|
[1.23.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0
|
||||||
|
[1.23.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.23.0-rc.1
|
||||||
|
[1.22.0/0.45.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.22.0
|
||||||
|
[1.21.0/0.44.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.21.0
|
||||||
[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0
|
[1.20.0/0.43.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.20.0
|
||||||
[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0
|
[1.19.0/0.42.0/0.0.7]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0
|
||||||
[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1
|
[1.19.0-rc.1/0.42.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.19.0-rc.1
|
||||||
@ -2794,6 +3196,11 @@ It contains api and sdk for trace and meter.
|
|||||||
[0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1
|
[0.1.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.1
|
||||||
[0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0
|
[0.1.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v0.1.0
|
||||||
|
|
||||||
|
<!-- Released section ended -->
|
||||||
|
|
||||||
|
[Go 1.23]: https://go.dev/doc/go1.23
|
||||||
|
[Go 1.22]: https://go.dev/doc/go1.22
|
||||||
|
[Go 1.21]: https://go.dev/doc/go1.21
|
||||||
[Go 1.20]: https://go.dev/doc/go1.20
|
[Go 1.20]: https://go.dev/doc/go1.20
|
||||||
[Go 1.19]: https://go.dev/doc/go1.19
|
[Go 1.19]: https://go.dev/doc/go1.19
|
||||||
[Go 1.18]: https://go.dev/doc/go1.18
|
[Go 1.18]: https://go.dev/doc/go1.18
|
||||||
@ -2801,3 +3208,5 @@ It contains api and sdk for trace and meter.
|
|||||||
[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric
|
[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric
|
||||||
[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric
|
[metric SDK]:https://pkg.go.dev/go.opentelemetry.io/otel/sdk/metric
|
||||||
[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace
|
[trace API]:https://pkg.go.dev/go.opentelemetry.io/otel/trace
|
||||||
|
|
||||||
|
[GO-2024-2687]: https://pkg.go.dev/vuln/GO-2024-2687
|
||||||
|
|||||||
6
vendor/go.opentelemetry.io/otel/CODEOWNERS
generated
vendored
6
vendor/go.opentelemetry.io/otel/CODEOWNERS
generated
vendored
@ -5,13 +5,13 @@
|
|||||||
#####################################################
|
#####################################################
|
||||||
#
|
#
|
||||||
# Learn about membership in OpenTelemetry community:
|
# Learn about membership in OpenTelemetry community:
|
||||||
# https://github.com/open-telemetry/community/blob/main/community-membership.md
|
# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Learn about CODEOWNERS file format:
|
# Learn about CODEOWNERS file format:
|
||||||
# https://help.github.com/en/articles/about-code-owners
|
# https://help.github.com/en/articles/about-code-owners
|
||||||
#
|
#
|
||||||
|
|
||||||
* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu
|
* @MrAlias @XSAM @dashpole @pellared @dmathieu
|
||||||
|
|
||||||
CODEOWNERS @MrAlias @MadVikingGod @pellared
|
CODEOWNERS @MrAlias @pellared @dashpole @XSAM @dmathieu
|
||||||
|
|||||||
60
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
60
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
@ -90,6 +90,10 @@ git push <YOUR_FORK> <YOUR_BRANCH_NAME>
|
|||||||
Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull
|
Open a pull request against the main `opentelemetry-go` repo. Be sure to add the pull
|
||||||
request ID to the entry you added to `CHANGELOG.md`.
|
request ID to the entry you added to `CHANGELOG.md`.
|
||||||
|
|
||||||
|
Avoid rebasing and force-pushing to your branch to facilitate reviewing the pull request.
|
||||||
|
Rewriting Git history makes it difficult to keep track of iterations during code review.
|
||||||
|
All pull requests are squashed to a single commit upon merge to `main`.
|
||||||
|
|
||||||
### How to Receive Comments
|
### How to Receive Comments
|
||||||
|
|
||||||
* If the PR is not ready for review, please put `[WIP]` in the title,
|
* If the PR is not ready for review, please put `[WIP]` in the title,
|
||||||
@ -197,6 +201,16 @@ You can install and run a "local Go Doc site" in the following way:
|
|||||||
[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric)
|
[`go.opentelemetry.io/otel/metric`](https://pkg.go.dev/go.opentelemetry.io/otel/metric)
|
||||||
is an example of a very well-documented package.
|
is an example of a very well-documented package.
|
||||||
|
|
||||||
|
### README files
|
||||||
|
|
||||||
|
Each (non-internal, non-test, non-documentation) package must contain a
|
||||||
|
`README.md` file containing at least a title, and a `pkg.go.dev` badge.
|
||||||
|
|
||||||
|
The README should not be a repetition of Go doc comments.
|
||||||
|
|
||||||
|
You can verify the presence of all README files with the `make verify-readmes`
|
||||||
|
command.
|
||||||
|
|
||||||
## Style Guide
|
## Style Guide
|
||||||
|
|
||||||
One of the primary goals of this project is that it is actually used by
|
One of the primary goals of this project is that it is actually used by
|
||||||
@ -556,12 +570,18 @@ functionality should be added, each one will need their own super-set
|
|||||||
interfaces and will duplicate the pattern. For this reason, the simple targeted
|
interfaces and will duplicate the pattern. For this reason, the simple targeted
|
||||||
interface that defines the specific functionality should be preferred.
|
interface that defines the specific functionality should be preferred.
|
||||||
|
|
||||||
|
See also:
|
||||||
|
[Keeping Your Modules Compatible: Working with interfaces](https://go.dev/blog/module-compatibility#working-with-interfaces).
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
The tests should never leak goroutines.
|
The tests should never leak goroutines.
|
||||||
|
|
||||||
Use the term `ConcurrentSafe` in the test name when it aims to verify the
|
Use the term `ConcurrentSafe` in the test name when it aims to verify the
|
||||||
absence of race conditions.
|
absence of race conditions. The top-level tests with this term will be run
|
||||||
|
many times in the `test-concurrent-safe` CI job to increase the chance of
|
||||||
|
catching concurrency issues. This does not apply to subtests when this term
|
||||||
|
is not in their root name.
|
||||||
|
|
||||||
### Internal packages
|
### Internal packages
|
||||||
|
|
||||||
@ -587,32 +607,52 @@ this.
|
|||||||
|
|
||||||
[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548
|
[^3]: https://github.com/open-telemetry/opentelemetry-go/issues/3548
|
||||||
|
|
||||||
|
### Ignoring context cancellation
|
||||||
|
|
||||||
|
OpenTelemetry API implementations need to ignore the cancellation of the context that are
|
||||||
|
passed when recording a value (e.g. starting a span, recording a measurement, emitting a log).
|
||||||
|
Recording methods should not return an error describing the cancellation state of the context
|
||||||
|
when they complete, nor should they abort any work.
|
||||||
|
|
||||||
|
This rule may not apply if the OpenTelemetry specification defines a timeout mechanism for
|
||||||
|
the method. In that case the context cancellation can be used for the timeout with the
|
||||||
|
restriction that this behavior is documented for the method. Otherwise, timeouts
|
||||||
|
are expected to be handled by the user calling the API, not the implementation.
|
||||||
|
|
||||||
|
Stoppage of the telemetry pipeline is handled by calling the appropriate `Shutdown` method
|
||||||
|
of a provider. It is assumed the context passed from a user is not used for this purpose.
|
||||||
|
|
||||||
|
Outside of the direct recording of telemetry from the API (e.g. exporting telemetry,
|
||||||
|
force flushing telemetry, shutting down a signal provider) the context cancellation
|
||||||
|
should be honored. This means all work done on behalf of the user provided context
|
||||||
|
should be canceled.
|
||||||
|
|
||||||
## Approvers and Maintainers
|
## Approvers and Maintainers
|
||||||
|
|
||||||
### Approvers
|
### Approvers
|
||||||
|
|
||||||
- [Evan Torrie](https://github.com/evantorrie), Verizon Media
|
|
||||||
- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics
|
|
||||||
- [David Ashpole](https://github.com/dashpole), Google
|
|
||||||
- [Chester Cheung](https://github.com/hanyuancheung), Tencent
|
|
||||||
- [Damien Mathieu](https://github.com/dmathieu), Elastic
|
|
||||||
- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
|
|
||||||
|
|
||||||
### Maintainers
|
### Maintainers
|
||||||
|
|
||||||
- [Aaron Clawson](https://github.com/MadVikingGod), LightStep
|
- [Damien Mathieu](https://github.com/dmathieu), Elastic
|
||||||
|
- [David Ashpole](https://github.com/dashpole), Google
|
||||||
- [Robert Pająk](https://github.com/pellared), Splunk
|
- [Robert Pająk](https://github.com/pellared), Splunk
|
||||||
|
- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics
|
||||||
- [Tyler Yahn](https://github.com/MrAlias), Splunk
|
- [Tyler Yahn](https://github.com/MrAlias), Splunk
|
||||||
|
|
||||||
### Emeritus
|
### Emeritus
|
||||||
|
|
||||||
|
- [Aaron Clawson](https://github.com/MadVikingGod), LightStep
|
||||||
|
- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
|
||||||
|
- [Chester Cheung](https://github.com/hanyuancheung), Tencent
|
||||||
|
- [Evan Torrie](https://github.com/evantorrie), Yahoo
|
||||||
- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep
|
- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep
|
||||||
- [Josh MacDonald](https://github.com/jmacd), LightStep
|
- [Josh MacDonald](https://github.com/jmacd), LightStep
|
||||||
|
- [Liz Fong-Jones](https://github.com/lizthegrey), Honeycomb
|
||||||
|
|
||||||
### Become an Approver or a Maintainer
|
### Become an Approver or a Maintainer
|
||||||
|
|
||||||
See the [community membership document in OpenTelemetry community
|
See the [community membership document in OpenTelemetry community
|
||||||
repo](https://github.com/open-telemetry/community/blob/main/community-membership.md).
|
repo](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md).
|
||||||
|
|
||||||
[Approver]: #approvers
|
[Approver]: #approvers
|
||||||
[Maintainer]: #maintainers
|
[Maintainer]: #maintainers
|
||||||
|
|||||||
105
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
105
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
# Copyright The OpenTelemetry Authors
|
# Copyright The OpenTelemetry Authors
|
||||||
#
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
TOOLS_MOD_DIR := ./internal/tools
|
TOOLS_MOD_DIR := ./internal/tools
|
||||||
|
|
||||||
@ -25,8 +14,8 @@ TIMEOUT = 60
|
|||||||
.DEFAULT_GOAL := precommit
|
.DEFAULT_GOAL := precommit
|
||||||
|
|
||||||
.PHONY: precommit ci
|
.PHONY: precommit ci
|
||||||
precommit: generate dependabot-generate license-check misspell go-mod-tidy golangci-lint-fix test-default
|
precommit: generate license-check misspell go-mod-tidy golangci-lint-fix verify-readmes verify-mods test-default
|
||||||
ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage
|
ci: generate license-check lint vanity-import-check verify-readmes verify-mods build test-default check-clean-work-tree test-coverage
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
|
|
||||||
@ -34,7 +23,7 @@ TOOLS = $(CURDIR)/.tools
|
|||||||
|
|
||||||
$(TOOLS):
|
$(TOOLS):
|
||||||
@mkdir -p $@
|
@mkdir -p $@
|
||||||
$(TOOLS)/%: | $(TOOLS)
|
$(TOOLS)/%: $(TOOLS_MOD_DIR)/go.mod | $(TOOLS)
|
||||||
cd $(TOOLS_MOD_DIR) && \
|
cd $(TOOLS_MOD_DIR) && \
|
||||||
$(GO) build -o $@ $(PACKAGE)
|
$(GO) build -o $@ $(PACKAGE)
|
||||||
|
|
||||||
@ -50,9 +39,6 @@ $(TOOLS)/crosslink: PACKAGE=go.opentelemetry.io/build-tools/crosslink
|
|||||||
SEMCONVKIT = $(TOOLS)/semconvkit
|
SEMCONVKIT = $(TOOLS)/semconvkit
|
||||||
$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit
|
$(TOOLS)/semconvkit: PACKAGE=go.opentelemetry.io/otel/$(TOOLS_MOD_DIR)/semconvkit
|
||||||
|
|
||||||
DBOTCONF = $(TOOLS)/dbotconf
|
|
||||||
$(TOOLS)/dbotconf: PACKAGE=go.opentelemetry.io/build-tools/dbotconf
|
|
||||||
|
|
||||||
GOLANGCI_LINT = $(TOOLS)/golangci-lint
|
GOLANGCI_LINT = $(TOOLS)/golangci-lint
|
||||||
$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint
|
$(TOOLS)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||||
|
|
||||||
@ -68,9 +54,6 @@ $(TOOLS)/stringer: PACKAGE=golang.org/x/tools/cmd/stringer
|
|||||||
PORTO = $(TOOLS)/porto
|
PORTO = $(TOOLS)/porto
|
||||||
$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto
|
$(TOOLS)/porto: PACKAGE=github.com/jcchavezs/porto/cmd/porto
|
||||||
|
|
||||||
GOJQ = $(TOOLS)/gojq
|
|
||||||
$(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq
|
|
||||||
|
|
||||||
GOTMPL = $(TOOLS)/gotmpl
|
GOTMPL = $(TOOLS)/gotmpl
|
||||||
$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl
|
$(GOTMPL): PACKAGE=go.opentelemetry.io/build-tools/gotmpl
|
||||||
|
|
||||||
@ -81,7 +64,7 @@ GOVULNCHECK = $(TOOLS)/govulncheck
|
|||||||
$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck
|
$(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck
|
||||||
|
|
||||||
.PHONY: tools
|
.PHONY: tools
|
||||||
tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE)
|
tools: $(CROSSLINK) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT) $(GOTMPL) $(GORELEASE)
|
||||||
|
|
||||||
# Virtualized python tools via docker
|
# Virtualized python tools via docker
|
||||||
|
|
||||||
@ -110,7 +93,7 @@ $(PYTOOLS):
|
|||||||
@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip"
|
@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip"
|
||||||
|
|
||||||
# Install python packages into the virtual environment.
|
# Install python packages into the virtual environment.
|
||||||
$(PYTOOLS)/%: | $(PYTOOLS)
|
$(PYTOOLS)/%: $(PYTOOLS)
|
||||||
@$(DOCKERPY) $(PIP) install -r requirements.txt
|
@$(DOCKERPY) $(PIP) install -r requirements.txt
|
||||||
|
|
||||||
CODESPELL = $(PYTOOLS)/codespell
|
CODESPELL = $(PYTOOLS)/codespell
|
||||||
@ -124,18 +107,18 @@ generate: go-generate vanity-import-fix
|
|||||||
.PHONY: go-generate
|
.PHONY: go-generate
|
||||||
go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%)
|
go-generate: $(OTEL_GO_MOD_DIRS:%=go-generate/%)
|
||||||
go-generate/%: DIR=$*
|
go-generate/%: DIR=$*
|
||||||
go-generate/%: | $(STRINGER) $(GOTMPL)
|
go-generate/%: $(STRINGER) $(GOTMPL)
|
||||||
@echo "$(GO) generate $(DIR)/..." \
|
@echo "$(GO) generate $(DIR)/..." \
|
||||||
&& cd $(DIR) \
|
&& cd $(DIR) \
|
||||||
&& PATH="$(TOOLS):$${PATH}" $(GO) generate ./...
|
&& PATH="$(TOOLS):$${PATH}" $(GO) generate ./...
|
||||||
|
|
||||||
.PHONY: vanity-import-fix
|
.PHONY: vanity-import-fix
|
||||||
vanity-import-fix: | $(PORTO)
|
vanity-import-fix: $(PORTO)
|
||||||
@$(PORTO) --include-internal -w .
|
@$(PORTO) --include-internal -w .
|
||||||
|
|
||||||
# Generate go.work file for local development.
|
# Generate go.work file for local development.
|
||||||
.PHONY: go-work
|
.PHONY: go-work
|
||||||
go-work: | $(CROSSLINK)
|
go-work: $(CROSSLINK)
|
||||||
$(CROSSLINK) work --root=$(shell pwd)
|
$(CROSSLINK) work --root=$(shell pwd)
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
@ -159,12 +142,14 @@ build-tests/%:
|
|||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
|
||||||
TEST_TARGETS := test-default test-bench test-short test-verbose test-race
|
TEST_TARGETS := test-default test-bench test-short test-verbose test-race test-concurrent-safe
|
||||||
.PHONY: $(TEST_TARGETS) test
|
.PHONY: $(TEST_TARGETS) test
|
||||||
test-default test-race: ARGS=-race
|
test-default test-race: ARGS=-race
|
||||||
test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=.
|
test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=.
|
||||||
test-short: ARGS=-short
|
test-short: ARGS=-short
|
||||||
test-verbose: ARGS=-v -race
|
test-verbose: ARGS=-v -race
|
||||||
|
test-concurrent-safe: ARGS=-run=ConcurrentSafe -count=100 -race
|
||||||
|
test-concurrent-safe: TIMEOUT=120
|
||||||
$(TEST_TARGETS): test
|
$(TEST_TARGETS): test
|
||||||
test: $(OTEL_GO_MOD_DIRS:%=test/%)
|
test: $(OTEL_GO_MOD_DIRS:%=test/%)
|
||||||
test/%: DIR=$*
|
test/%: DIR=$*
|
||||||
@ -178,7 +163,7 @@ test/%:
|
|||||||
COVERAGE_MODE = atomic
|
COVERAGE_MODE = atomic
|
||||||
COVERAGE_PROFILE = coverage.out
|
COVERAGE_PROFILE = coverage.out
|
||||||
.PHONY: test-coverage
|
.PHONY: test-coverage
|
||||||
test-coverage: | $(GOCOVMERGE)
|
test-coverage: $(GOCOVMERGE)
|
||||||
@set -e; \
|
@set -e; \
|
||||||
printf "" > coverage.txt; \
|
printf "" > coverage.txt; \
|
||||||
for dir in $(ALL_COVERAGE_MOD_DIRS); do \
|
for dir in $(ALL_COVERAGE_MOD_DIRS); do \
|
||||||
@ -192,40 +177,37 @@ test-coverage: | $(GOCOVMERGE)
|
|||||||
done; \
|
done; \
|
||||||
$(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt
|
$(GOCOVMERGE) $$(find . -name coverage.out) > coverage.txt
|
||||||
|
|
||||||
# Adding a directory will include all benchmarks in that direcotry if a filter is not specified.
|
|
||||||
BENCHMARK_TARGETS := sdk/trace
|
|
||||||
.PHONY: benchmark
|
.PHONY: benchmark
|
||||||
benchmark: $(BENCHMARK_TARGETS:%=benchmark/%)
|
benchmark: $(OTEL_GO_MOD_DIRS:%=benchmark/%)
|
||||||
BENCHMARK_FILTER = .
|
|
||||||
# You can override the filter for a particular directory by adding a rule here.
|
|
||||||
benchmark/sdk/trace: BENCHMARK_FILTER = SpanWithAttributes_8/AlwaysSample
|
|
||||||
benchmark/%:
|
benchmark/%:
|
||||||
@echo "$(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(BENCHMARK_FILTER) $*..." \
|
@echo "$(GO) test -run=xxxxxMatchNothingxxxxx -bench=. $*..." \
|
||||||
&& cd $* \
|
&& cd $* \
|
||||||
$(foreach filter, $(BENCHMARK_FILTER), && $(GO) test -timeout $(TIMEOUT)s -run=xxxxxMatchNothingxxxxx -bench=$(filter))
|
&& $(GO) list ./... \
|
||||||
|
| grep -v third_party \
|
||||||
|
| xargs $(GO) test -run=xxxxxMatchNothingxxxxx -bench=.
|
||||||
|
|
||||||
.PHONY: golangci-lint golangci-lint-fix
|
.PHONY: golangci-lint golangci-lint-fix
|
||||||
golangci-lint-fix: ARGS=--fix
|
golangci-lint-fix: ARGS=--fix
|
||||||
golangci-lint-fix: golangci-lint
|
golangci-lint-fix: golangci-lint
|
||||||
golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%)
|
golangci-lint: $(OTEL_GO_MOD_DIRS:%=golangci-lint/%)
|
||||||
golangci-lint/%: DIR=$*
|
golangci-lint/%: DIR=$*
|
||||||
golangci-lint/%: | $(GOLANGCI_LINT)
|
golangci-lint/%: $(GOLANGCI_LINT)
|
||||||
@echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \
|
@echo 'golangci-lint $(if $(ARGS),$(ARGS) ,)$(DIR)' \
|
||||||
&& cd $(DIR) \
|
&& cd $(DIR) \
|
||||||
&& $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS)
|
&& $(GOLANGCI_LINT) run --allow-serial-runners $(ARGS)
|
||||||
|
|
||||||
.PHONY: crosslink
|
.PHONY: crosslink
|
||||||
crosslink: | $(CROSSLINK)
|
crosslink: $(CROSSLINK)
|
||||||
@echo "Updating intra-repository dependencies in all go modules" \
|
@echo "Updating intra-repository dependencies in all go modules" \
|
||||||
&& $(CROSSLINK) --root=$(shell pwd) --prune
|
&& $(CROSSLINK) --root=$(shell pwd) --prune
|
||||||
|
|
||||||
.PHONY: go-mod-tidy
|
.PHONY: go-mod-tidy
|
||||||
go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%)
|
go-mod-tidy: $(ALL_GO_MOD_DIRS:%=go-mod-tidy/%)
|
||||||
go-mod-tidy/%: DIR=$*
|
go-mod-tidy/%: DIR=$*
|
||||||
go-mod-tidy/%: | crosslink
|
go-mod-tidy/%: crosslink
|
||||||
@echo "$(GO) mod tidy in $(DIR)" \
|
@echo "$(GO) mod tidy in $(DIR)" \
|
||||||
&& cd $(DIR) \
|
&& cd $(DIR) \
|
||||||
&& $(GO) mod tidy -compat=1.20
|
&& $(GO) mod tidy -compat=1.21
|
||||||
|
|
||||||
.PHONY: lint-modules
|
.PHONY: lint-modules
|
||||||
lint-modules: go-mod-tidy
|
lint-modules: go-mod-tidy
|
||||||
@ -234,23 +216,23 @@ lint-modules: go-mod-tidy
|
|||||||
lint: misspell lint-modules golangci-lint govulncheck
|
lint: misspell lint-modules golangci-lint govulncheck
|
||||||
|
|
||||||
.PHONY: vanity-import-check
|
.PHONY: vanity-import-check
|
||||||
vanity-import-check: | $(PORTO)
|
vanity-import-check: $(PORTO)
|
||||||
@$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 )
|
@$(PORTO) --include-internal -l . || ( echo "(run: make vanity-import-fix)"; exit 1 )
|
||||||
|
|
||||||
.PHONY: misspell
|
.PHONY: misspell
|
||||||
misspell: | $(MISSPELL)
|
misspell: $(MISSPELL)
|
||||||
@$(MISSPELL) -w $(ALL_DOCS)
|
@$(MISSPELL) -w $(ALL_DOCS)
|
||||||
|
|
||||||
.PHONY: govulncheck
|
.PHONY: govulncheck
|
||||||
govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%)
|
govulncheck: $(OTEL_GO_MOD_DIRS:%=govulncheck/%)
|
||||||
govulncheck/%: DIR=$*
|
govulncheck/%: DIR=$*
|
||||||
govulncheck/%: | $(GOVULNCHECK)
|
govulncheck/%: $(GOVULNCHECK)
|
||||||
@echo "govulncheck ./... in $(DIR)" \
|
@echo "govulncheck ./... in $(DIR)" \
|
||||||
&& cd $(DIR) \
|
&& cd $(DIR) \
|
||||||
&& $(GOVULNCHECK) ./...
|
&& $(GOVULNCHECK) ./...
|
||||||
|
|
||||||
.PHONY: codespell
|
.PHONY: codespell
|
||||||
codespell: | $(CODESPELL)
|
codespell: $(CODESPELL)
|
||||||
@$(DOCKERPY) $(CODESPELL)
|
@$(DOCKERPY) $(CODESPELL)
|
||||||
|
|
||||||
.PHONY: license-check
|
.PHONY: license-check
|
||||||
@ -263,15 +245,6 @@ license-check:
|
|||||||
exit 1; \
|
exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEPENDABOT_CONFIG = .github/dependabot.yml
|
|
||||||
.PHONY: dependabot-check
|
|
||||||
dependabot-check: | $(DBOTCONF)
|
|
||||||
@$(DBOTCONF) verify $(DEPENDABOT_CONFIG) || ( echo "(run: make dependabot-generate)"; exit 1 )
|
|
||||||
|
|
||||||
.PHONY: dependabot-generate
|
|
||||||
dependabot-generate: | $(DBOTCONF)
|
|
||||||
@$(DBOTCONF) generate > $(DEPENDABOT_CONFIG)
|
|
||||||
|
|
||||||
.PHONY: check-clean-work-tree
|
.PHONY: check-clean-work-tree
|
||||||
check-clean-work-tree:
|
check-clean-work-tree:
|
||||||
@if ! git diff --quiet; then \
|
@if ! git diff --quiet; then \
|
||||||
@ -284,13 +257,11 @@ check-clean-work-tree:
|
|||||||
|
|
||||||
SEMCONVPKG ?= "semconv/"
|
SEMCONVPKG ?= "semconv/"
|
||||||
.PHONY: semconv-generate
|
.PHONY: semconv-generate
|
||||||
semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT)
|
semconv-generate: $(SEMCONVGEN) $(SEMCONVKIT)
|
||||||
[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 )
|
[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry semantic-conventions tag"; exit 1 )
|
||||||
[ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 )
|
[ "$(OTEL_SEMCONV_REPO)" ] || ( echo "OTEL_SEMCONV_REPO unset: missing path to opentelemetry semantic-conventions repo"; exit 1 )
|
||||||
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
|
||||||
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
||||||
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=metric -f metric.go -t "$(SEMCONVPKG)/metric_template.j2" -s "$(TAG)"
|
||||||
$(SEMCONVGEN) -i "$(OTEL_SEMCONV_REPO)/model/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
|
||||||
$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)"
|
$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)"
|
||||||
|
|
||||||
.PHONY: gorelease
|
.PHONY: gorelease
|
||||||
@ -302,17 +273,25 @@ gorelease/%:| $(GORELEASE)
|
|||||||
&& $(GORELEASE) \
|
&& $(GORELEASE) \
|
||||||
|| echo ""
|
|| echo ""
|
||||||
|
|
||||||
|
.PHONY: verify-mods
|
||||||
|
verify-mods: $(MULTIMOD)
|
||||||
|
$(MULTIMOD) verify
|
||||||
|
|
||||||
.PHONY: prerelease
|
.PHONY: prerelease
|
||||||
prerelease: | $(MULTIMOD)
|
prerelease: verify-mods
|
||||||
@[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 )
|
@[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 )
|
||||||
$(MULTIMOD) verify && $(MULTIMOD) prerelease -m ${MODSET}
|
$(MULTIMOD) prerelease -m ${MODSET}
|
||||||
|
|
||||||
COMMIT ?= "HEAD"
|
COMMIT ?= "HEAD"
|
||||||
.PHONY: add-tags
|
.PHONY: add-tags
|
||||||
add-tags: | $(MULTIMOD)
|
add-tags: verify-mods
|
||||||
@[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 )
|
@[ "${MODSET}" ] || ( echo ">> env var MODSET is not set"; exit 1 )
|
||||||
$(MULTIMOD) verify && $(MULTIMOD) tag -m ${MODSET} -c ${COMMIT}
|
$(MULTIMOD) tag -m ${MODSET} -c ${COMMIT}
|
||||||
|
|
||||||
.PHONY: lint-markdown
|
.PHONY: lint-markdown
|
||||||
lint-markdown:
|
lint-markdown:
|
||||||
docker run -v "$(CURDIR):$(WORKDIR)" docker://avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md
|
docker run -v "$(CURDIR):$(WORKDIR)" avtodev/markdown-lint:v1 -c $(WORKDIR)/.markdownlint.yaml $(WORKDIR)/**/*.md
|
||||||
|
|
||||||
|
.PHONY: verify-readmes
|
||||||
|
verify-readmes:
|
||||||
|
./verify_readmes.sh
|
||||||
|
|||||||
61
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
61
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
@ -11,14 +11,11 @@ It provides a set of APIs to directly measure performance and behavior of your s
|
|||||||
|
|
||||||
## Project Status
|
## Project Status
|
||||||
|
|
||||||
| Signal | Status |
|
| Signal | Status |
|
||||||
|---------|------------|
|
|---------|--------------------|
|
||||||
| Traces | Stable |
|
| Traces | Stable |
|
||||||
| Metrics | Stable |
|
| Metrics | Stable |
|
||||||
| Logs | Design [1] |
|
| Logs | Beta[^1] |
|
||||||
|
|
||||||
- [1]: Currently the logs signal development is in a design phase ([#4696](https://github.com/open-telemetry/opentelemetry-go/issues/4696)).
|
|
||||||
No Logs Pull Requests are currently being accepted.
|
|
||||||
|
|
||||||
Progress and status specific to this repository is tracked in our
|
Progress and status specific to this repository is tracked in our
|
||||||
[project boards](https://github.com/open-telemetry/opentelemetry-go/projects)
|
[project boards](https://github.com/open-telemetry/opentelemetry-go/projects)
|
||||||
@ -28,6 +25,8 @@ and
|
|||||||
Project versioning information and stability guarantees can be found in the
|
Project versioning information and stability guarantees can be found in the
|
||||||
[versioning documentation](VERSIONING.md).
|
[versioning documentation](VERSIONING.md).
|
||||||
|
|
||||||
|
[^1]: https://github.com/orgs/open-telemetry/projects/43
|
||||||
|
|
||||||
### Compatibility
|
### Compatibility
|
||||||
|
|
||||||
OpenTelemetry-Go ensures compatibility with the current supported versions of
|
OpenTelemetry-Go ensures compatibility with the current supported versions of
|
||||||
@ -48,25 +47,29 @@ stop ensuring compatibility with these versions in the following manner:
|
|||||||
|
|
||||||
Currently, this project supports the following environments.
|
Currently, this project supports the following environments.
|
||||||
|
|
||||||
| OS | Go Version | Architecture |
|
| OS | Go Version | Architecture |
|
||||||
|---------|------------|--------------|
|
|----------|------------|--------------|
|
||||||
| Ubuntu | 1.21 | amd64 |
|
| Ubuntu | 1.23 | amd64 |
|
||||||
| Ubuntu | 1.20 | amd64 |
|
| Ubuntu | 1.22 | amd64 |
|
||||||
| Ubuntu | 1.21 | 386 |
|
| Ubuntu | 1.23 | 386 |
|
||||||
| Ubuntu | 1.20 | 386 |
|
| Ubuntu | 1.22 | 386 |
|
||||||
| MacOS | 1.21 | amd64 |
|
| Linux | 1.23 | arm64 |
|
||||||
| MacOS | 1.20 | amd64 |
|
| Linux | 1.22 | arm64 |
|
||||||
| Windows | 1.21 | amd64 |
|
| macOS 13 | 1.23 | amd64 |
|
||||||
| Windows | 1.20 | amd64 |
|
| macOS 13 | 1.22 | amd64 |
|
||||||
| Windows | 1.21 | 386 |
|
| macOS | 1.23 | arm64 |
|
||||||
| Windows | 1.20 | 386 |
|
| macOS | 1.22 | arm64 |
|
||||||
|
| Windows | 1.23 | amd64 |
|
||||||
|
| Windows | 1.22 | amd64 |
|
||||||
|
| Windows | 1.23 | 386 |
|
||||||
|
| Windows | 1.22 | 386 |
|
||||||
|
|
||||||
While this project should work for other systems, no compatibility guarantees
|
While this project should work for other systems, no compatibility guarantees
|
||||||
are made for those systems currently.
|
are made for those systems currently.
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/go/getting-started/).
|
You can find a getting started guide on [opentelemetry.io](https://opentelemetry.io/docs/languages/go/getting-started/).
|
||||||
|
|
||||||
OpenTelemetry's goal is to provide a single set of APIs to capture distributed
|
OpenTelemetry's goal is to provide a single set of APIs to capture distributed
|
||||||
traces and metrics from your application and send them to an observability
|
traces and metrics from your application and send them to an observability
|
||||||
@ -86,8 +89,8 @@ If you need to extend the telemetry an instrumentation library provides or want
|
|||||||
to build your own instrumentation for your application directly you will need
|
to build your own instrumentation for your application directly you will need
|
||||||
to use the
|
to use the
|
||||||
[Go otel](https://pkg.go.dev/go.opentelemetry.io/otel)
|
[Go otel](https://pkg.go.dev/go.opentelemetry.io/otel)
|
||||||
package. The included [examples](./example/) are a good way to see some
|
package. The [examples](https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/examples)
|
||||||
practical uses of this process.
|
are a good way to see some practical uses of this process.
|
||||||
|
|
||||||
### Export
|
### Export
|
||||||
|
|
||||||
@ -96,12 +99,12 @@ export pipeline to send that telemetry to an observability platform.
|
|||||||
|
|
||||||
All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters).
|
All officially supported exporters for the OpenTelemetry project are contained in the [exporters directory](./exporters).
|
||||||
|
|
||||||
| Exporter | Metrics | Traces |
|
| Exporter | Logs | Metrics | Traces |
|
||||||
|---------------------------------------|:-------:|:------:|
|
|---------------------------------------|:----:|:-------:|:------:|
|
||||||
| [OTLP](./exporters/otlp/) | ✓ | ✓ |
|
| [OTLP](./exporters/otlp/) | ✓ | ✓ | ✓ |
|
||||||
| [Prometheus](./exporters/prometheus/) | ✓ | |
|
| [Prometheus](./exporters/prometheus/) | | ✓ | |
|
||||||
| [stdout](./exporters/stdout/) | ✓ | ✓ |
|
| [stdout](./exporters/stdout/) | ✓ | ✓ | ✓ |
|
||||||
| [Zipkin](./exporters/zipkin/) | | ✓ |
|
| [Zipkin](./exporters/zipkin/) | | | ✓ |
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
24
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
24
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
@ -27,6 +27,12 @@ You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org
|
|||||||
|
|
||||||
You can check/report problems with `gorelease` [here](https://golang.org/issues/26420).
|
You can check/report problems with `gorelease` [here](https://golang.org/issues/26420).
|
||||||
|
|
||||||
|
## Verify changes for contrib repository
|
||||||
|
|
||||||
|
If the changes in the main repository are going to affect the contrib repository, it is important to verify that the changes are compatible with the contrib repository.
|
||||||
|
|
||||||
|
Follow [the steps](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/RELEASING.md#verify-otel-changes) in the contrib repository to verify OTel changes.
|
||||||
|
|
||||||
## Pre-Release
|
## Pre-Release
|
||||||
|
|
||||||
First, decide which module sets will be released and update their versions
|
First, decide which module sets will be released and update their versions
|
||||||
@ -63,6 +69,7 @@ Update go.mod for submodules to depend on the new release which will happen in t
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Move all the `Unreleased` changes into a new section following the title scheme (`[<new tag>] - <date of release>`).
|
- Move all the `Unreleased` changes into a new section following the title scheme (`[<new tag>] - <date of release>`).
|
||||||
|
- Make sure the new section is under the comment for released section, like `<!-- Released section -->`, so it is protected from being overwritten in the future.
|
||||||
- Update all the appropriate links at the bottom.
|
- Update all the appropriate links at the bottom.
|
||||||
|
|
||||||
4. Push the changes to upstream and create a Pull Request on GitHub.
|
4. Push the changes to upstream and create a Pull Request on GitHub.
|
||||||
@ -104,17 +111,6 @@ It is critical you make sure the version you push upstream is correct.
|
|||||||
Finally create a Release for the new `<new tag>` on GitHub.
|
Finally create a Release for the new `<new tag>` on GitHub.
|
||||||
The release body should include all the release notes from the Changelog for this release.
|
The release body should include all the release notes from the Changelog for this release.
|
||||||
|
|
||||||
## Verify Examples
|
|
||||||
|
|
||||||
After releasing verify that examples build outside of the repository.
|
|
||||||
|
|
||||||
```
|
|
||||||
./verify_examples.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
The script copies examples into a different directory removes any `replace` declarations in `go.mod` and builds them.
|
|
||||||
This ensures they build with the published release, not the local copy.
|
|
||||||
|
|
||||||
## Post-Release
|
## Post-Release
|
||||||
|
|
||||||
### Contrib Repository
|
### Contrib Repository
|
||||||
@ -123,12 +119,12 @@ Once verified be sure to [make a release for the `contrib` repository](https://g
|
|||||||
|
|
||||||
### Website Documentation
|
### Website Documentation
|
||||||
|
|
||||||
Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/instrumentation/go].
|
Update the [Go instrumentation documentation] in the OpenTelemetry website under [content/en/docs/languages/go].
|
||||||
Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate.
|
Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate.
|
||||||
|
|
||||||
[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions
|
[OpenTelemetry Semantic Conventions]: https://github.com/open-telemetry/semantic-conventions
|
||||||
[Go instrumentation documentation]: https://opentelemetry.io/docs/instrumentation/go/
|
[Go instrumentation documentation]: https://opentelemetry.io/docs/languages/go/
|
||||||
[content/en/docs/instrumentation/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/instrumentation/go
|
[content/en/docs/languages/go]: https://github.com/open-telemetry/opentelemetry.io/tree/main/content/en/docs/languages/go
|
||||||
|
|
||||||
### Demo Repository
|
### Demo Repository
|
||||||
|
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/attribute/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/attribute/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Attribute
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/attribute)
|
||||||
13
vendor/go.opentelemetry.io/otel/attribute/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/attribute/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// Package attribute provides key and value attributes.
|
// Package attribute provides key and value attributes.
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/attribute/encoder.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/attribute/encoder.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/attribute/filter.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/attribute/filter.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/attribute/iterator.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/attribute/iterator.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/attribute/key.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/attribute/key.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/attribute/kv.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/attribute/kv.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
|
|||||||
262
vendor/go.opentelemetry.io/otel/attribute/set.go
generated
vendored
262
vendor/go.opentelemetry.io/otel/attribute/set.go
generated
vendored
@ -1,24 +1,14 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cmp"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -26,23 +16,33 @@ type (
|
|||||||
// immutable set of attributes, with an internal cache for storing
|
// immutable set of attributes, with an internal cache for storing
|
||||||
// attribute encodings.
|
// attribute encodings.
|
||||||
//
|
//
|
||||||
// This type supports the Equivalent method of comparison using values of
|
// This type will remain comparable for backwards compatibility. The
|
||||||
// type Distinct.
|
// equivalence of Sets across versions is not guaranteed to be stable.
|
||||||
|
// Prior versions may find two Sets to be equal or not when compared
|
||||||
|
// directly (i.e. ==), but subsequent versions may not. Users should use
|
||||||
|
// the Equals method to ensure stable equivalence checking.
|
||||||
|
//
|
||||||
|
// Users should also use the Distinct returned from Equivalent as a map key
|
||||||
|
// instead of a Set directly. In addition to that type providing guarantees
|
||||||
|
// on stable equivalence, it may also provide performance improvements.
|
||||||
Set struct {
|
Set struct {
|
||||||
equivalent Distinct
|
equivalent Distinct
|
||||||
}
|
}
|
||||||
|
|
||||||
// Distinct wraps a variable-size array of KeyValue, constructed with keys
|
// Distinct is a unique identifier of a Set.
|
||||||
// in sorted order. This can be used as a map key or for equality checking
|
//
|
||||||
// between Sets.
|
// Distinct is designed to be ensures equivalence stability: comparisons
|
||||||
|
// will return the save value across versions. For this reason, Distinct
|
||||||
|
// should always be used as a map key instead of a Set.
|
||||||
Distinct struct {
|
Distinct struct {
|
||||||
iface interface{}
|
iface interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sortable implements sort.Interface, used for sorting KeyValue. This is
|
// Sortable implements sort.Interface, used for sorting KeyValue.
|
||||||
// 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
|
// Deprecated: This type is no longer used. It was added as a performance
|
||||||
// provide in order to avoid an allocation. See NewSetWithSortable().
|
// optimization for Go < 1.21 that is no longer needed (Go < 1.21 is no
|
||||||
|
// longer supported by the module).
|
||||||
Sortable []KeyValue
|
Sortable []KeyValue
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,12 +56,6 @@ var (
|
|||||||
iface: [0]KeyValue{},
|
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.
|
// EmptySet returns a reference to a Set with no elements.
|
||||||
@ -187,13 +181,7 @@ func empty() Set {
|
|||||||
// Except for empty sets, this method adds an additional allocation compared
|
// Except for empty sets, this method adds an additional allocation compared
|
||||||
// with calls that include a Sortable.
|
// with calls that include a Sortable.
|
||||||
func NewSet(kvs ...KeyValue) Set {
|
func NewSet(kvs ...KeyValue) Set {
|
||||||
// Check for empty set.
|
s, _ := NewSetWithFiltered(kvs, nil)
|
||||||
if len(kvs) == 0 {
|
|
||||||
return empty()
|
|
||||||
}
|
|
||||||
srt := sortables.Get().(*Sortable)
|
|
||||||
s, _ := NewSetWithSortableFiltered(kvs, srt, nil)
|
|
||||||
sortables.Put(srt)
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,12 +189,10 @@ func NewSet(kvs ...KeyValue) Set {
|
|||||||
// NewSetWithSortableFiltered for more details.
|
// NewSetWithSortableFiltered for more details.
|
||||||
//
|
//
|
||||||
// This call includes a Sortable option as a memory optimization.
|
// This call includes a Sortable option as a memory optimization.
|
||||||
func NewSetWithSortable(kvs []KeyValue, tmp *Sortable) Set {
|
//
|
||||||
// Check for empty set.
|
// Deprecated: Use [NewSet] instead.
|
||||||
if len(kvs) == 0 {
|
func NewSetWithSortable(kvs []KeyValue, _ *Sortable) Set {
|
||||||
return empty()
|
s, _ := NewSetWithFiltered(kvs, nil)
|
||||||
}
|
|
||||||
s, _ := NewSetWithSortableFiltered(kvs, tmp, nil)
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,10 +206,37 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
|||||||
if len(kvs) == 0 {
|
if len(kvs) == 0 {
|
||||||
return empty(), nil
|
return empty(), nil
|
||||||
}
|
}
|
||||||
srt := sortables.Get().(*Sortable)
|
|
||||||
s, filtered := NewSetWithSortableFiltered(kvs, srt, filter)
|
// Stable sort so the following de-duplication can implement
|
||||||
sortables.Put(srt)
|
// last-value-wins semantics.
|
||||||
return s, filtered
|
slices.SortStableFunc(kvs, func(a, b KeyValue) int {
|
||||||
|
return cmp.Compare(a.Key, b.Key)
|
||||||
|
})
|
||||||
|
|
||||||
|
position := len(kvs) - 1
|
||||||
|
offset := position - 1
|
||||||
|
|
||||||
|
// The requirements stated above require that the stable
|
||||||
|
// result be placed in the end of the input slice, while
|
||||||
|
// overwritten values are swapped to the beginning.
|
||||||
|
//
|
||||||
|
// De-duplicate with last-value-wins semantics. Preserve
|
||||||
|
// duplicate values at the beginning of the input slice.
|
||||||
|
for ; offset >= 0; offset-- {
|
||||||
|
if kvs[offset].Key == kvs[position].Key {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
position--
|
||||||
|
kvs[offset], kvs[position] = kvs[position], kvs[offset]
|
||||||
|
}
|
||||||
|
kvs = kvs[position:]
|
||||||
|
|
||||||
|
if filter != nil {
|
||||||
|
if div := filteredToFront(kvs, filter); div != 0 {
|
||||||
|
return Set{equivalent: computeDistinct(kvs[div:])}, kvs[:div]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Set{equivalent: computeDistinct(kvs)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewSetWithSortableFiltered returns a new Set.
|
// NewSetWithSortableFiltered returns a new Set.
|
||||||
@ -249,82 +262,71 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
|||||||
//
|
//
|
||||||
// The second []KeyValue return value is a list of attributes that were
|
// The second []KeyValue return value is a list of attributes that were
|
||||||
// excluded by the Filter (if non-nil).
|
// excluded by the Filter (if non-nil).
|
||||||
func NewSetWithSortableFiltered(kvs []KeyValue, tmp *Sortable, filter Filter) (Set, []KeyValue) {
|
//
|
||||||
// Check for empty set.
|
// Deprecated: Use [NewSetWithFiltered] instead.
|
||||||
if len(kvs) == 0 {
|
func NewSetWithSortableFiltered(kvs []KeyValue, _ *Sortable, filter Filter) (Set, []KeyValue) {
|
||||||
return empty(), nil
|
return NewSetWithFiltered(kvs, filter)
|
||||||
}
|
|
||||||
|
|
||||||
*tmp = kvs
|
|
||||||
|
|
||||||
// Stable sort so the following de-duplication can implement
|
|
||||||
// last-value-wins semantics.
|
|
||||||
sort.Stable(tmp)
|
|
||||||
|
|
||||||
*tmp = nil
|
|
||||||
|
|
||||||
position := len(kvs) - 1
|
|
||||||
offset := position - 1
|
|
||||||
|
|
||||||
// The requirements stated above require that the stable
|
|
||||||
// result be placed in the end of the input slice, while
|
|
||||||
// overwritten values are swapped to the beginning.
|
|
||||||
//
|
|
||||||
// De-duplicate with last-value-wins semantics. Preserve
|
|
||||||
// duplicate values at the beginning of the input slice.
|
|
||||||
for ; offset >= 0; offset-- {
|
|
||||||
if kvs[offset].Key == kvs[position].Key {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
position--
|
|
||||||
kvs[offset], kvs[position] = kvs[position], kvs[offset]
|
|
||||||
}
|
|
||||||
if filter != nil {
|
|
||||||
return filterSet(kvs[position:], filter)
|
|
||||||
}
|
|
||||||
return Set{
|
|
||||||
equivalent: computeDistinct(kvs[position:]),
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// filterSet reorders kvs so that included keys are contiguous at the end of
|
// filteredToFront filters slice in-place using keep function. All KeyValues that need to
|
||||||
// the slice, while excluded keys precede the included keys.
|
// be removed are moved to the front. All KeyValues that need to be kept are
|
||||||
func filterSet(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
// moved (in-order) to the back. The index for the first KeyValue to be kept is
|
||||||
var excluded []KeyValue
|
// returned.
|
||||||
|
func filteredToFront(slice []KeyValue, keep Filter) int {
|
||||||
// Move attributes that do not match the filter so they're adjacent before
|
n := len(slice)
|
||||||
// calling computeDistinct().
|
j := n
|
||||||
distinctPosition := len(kvs)
|
for i := n - 1; i >= 0; i-- {
|
||||||
|
if keep(slice[i]) {
|
||||||
// Swap indistinct keys forward and distinct keys toward the
|
j--
|
||||||
// end of the slice.
|
slice[i], slice[j] = slice[j], slice[i]
|
||||||
offset := len(kvs) - 1
|
|
||||||
for ; offset >= 0; offset-- {
|
|
||||||
if filter(kvs[offset]) {
|
|
||||||
distinctPosition--
|
|
||||||
kvs[offset], kvs[distinctPosition] = kvs[distinctPosition], kvs[offset]
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
excluded = kvs[:distinctPosition]
|
return j
|
||||||
|
|
||||||
return Set{
|
|
||||||
equivalent: computeDistinct(kvs[distinctPosition:]),
|
|
||||||
}, excluded
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter returns a filtered copy of this Set. See the documentation for
|
// Filter returns a filtered copy of this Set. See the documentation for
|
||||||
// NewSetWithSortableFiltered for more details.
|
// NewSetWithSortableFiltered for more details.
|
||||||
func (l *Set) Filter(re Filter) (Set, []KeyValue) {
|
func (l *Set) Filter(re Filter) (Set, []KeyValue) {
|
||||||
if re == nil {
|
if re == nil {
|
||||||
return Set{
|
return *l, nil
|
||||||
equivalent: l.equivalent,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note: This could be refactored to avoid the temporary slice
|
// Iterate in reverse to the first attribute that will be filtered out.
|
||||||
// allocation, if it proves to be expensive.
|
n := l.Len()
|
||||||
return filterSet(l.ToSlice(), re)
|
first := n - 1
|
||||||
|
for ; first >= 0; first-- {
|
||||||
|
kv, _ := l.Get(first)
|
||||||
|
if !re(kv) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No attributes will be dropped, return the immutable Set l and nil.
|
||||||
|
if first < 0 {
|
||||||
|
return *l, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy now that we know we need to return a modified set.
|
||||||
|
//
|
||||||
|
// Do not do this in-place on the underlying storage of *Set l. Sets are
|
||||||
|
// immutable and filtering should not change this.
|
||||||
|
slice := l.ToSlice()
|
||||||
|
|
||||||
|
// Don't re-iterate the slice if only slice[0] is filtered.
|
||||||
|
if first == 0 {
|
||||||
|
// It is safe to assume len(slice) >= 1 given we found at least one
|
||||||
|
// attribute above that needs to be filtered out.
|
||||||
|
return Set{equivalent: computeDistinct(slice[1:])}, slice[:1]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move the filtered slice[first] to the front (preserving order).
|
||||||
|
kv := slice[first]
|
||||||
|
copy(slice[1:first+1], slice[:first])
|
||||||
|
slice[0] = kv
|
||||||
|
|
||||||
|
// Do not re-evaluate re(slice[first+1:]).
|
||||||
|
div := filteredToFront(slice[1:first+1], re) + 1
|
||||||
|
return Set{equivalent: computeDistinct(slice[div:])}, slice[:div]
|
||||||
}
|
}
|
||||||
|
|
||||||
// computeDistinct returns a Distinct using either the fixed- or
|
// computeDistinct returns a Distinct using either the fixed- or
|
||||||
@ -345,45 +347,25 @@ func computeDistinct(kvs []KeyValue) Distinct {
|
|||||||
func computeDistinctFixed(kvs []KeyValue) interface{} {
|
func computeDistinctFixed(kvs []KeyValue) interface{} {
|
||||||
switch len(kvs) {
|
switch len(kvs) {
|
||||||
case 1:
|
case 1:
|
||||||
ptr := new([1]KeyValue)
|
return [1]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 2:
|
case 2:
|
||||||
ptr := new([2]KeyValue)
|
return [2]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 3:
|
case 3:
|
||||||
ptr := new([3]KeyValue)
|
return [3]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 4:
|
case 4:
|
||||||
ptr := new([4]KeyValue)
|
return [4]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 5:
|
case 5:
|
||||||
ptr := new([5]KeyValue)
|
return [5]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 6:
|
case 6:
|
||||||
ptr := new([6]KeyValue)
|
return [6]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 7:
|
case 7:
|
||||||
ptr := new([7]KeyValue)
|
return [7]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 8:
|
case 8:
|
||||||
ptr := new([8]KeyValue)
|
return [8]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 9:
|
case 9:
|
||||||
ptr := new([9]KeyValue)
|
return [9]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
case 10:
|
case 10:
|
||||||
ptr := new([10]KeyValue)
|
return [10]KeyValue(kvs)
|
||||||
copy((*ptr)[:], kvs)
|
|
||||||
return *ptr
|
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -404,7 +386,7 @@ func (l *Set) MarshalJSON() ([]byte, error) {
|
|||||||
return json.Marshal(l.equivalent.iface)
|
return json.Marshal(l.equivalent.iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalLog is the marshaling function used by the logging system to represent this exporter.
|
// MarshalLog is the marshaling function used by the logging system to represent this Set.
|
||||||
func (l Set) MarshalLog() interface{} {
|
func (l Set) MarshalLog() interface{} {
|
||||||
kvs := make(map[string]string)
|
kvs := make(map[string]string)
|
||||||
for _, kv := range l.ToSlice() {
|
for _, kv := range l.ToSlice() {
|
||||||
|
|||||||
31
vendor/go.opentelemetry.io/otel/attribute/value.go
generated
vendored
31
vendor/go.opentelemetry.io/otel/attribute/value.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||||
|
|
||||||
@ -242,15 +231,27 @@ func (v Value) Emit() string {
|
|||||||
case BOOL:
|
case BOOL:
|
||||||
return strconv.FormatBool(v.AsBool())
|
return strconv.FormatBool(v.AsBool())
|
||||||
case INT64SLICE:
|
case INT64SLICE:
|
||||||
return fmt.Sprint(v.asInt64Slice())
|
j, err := json.Marshal(v.asInt64Slice())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Sprintf("invalid: %v", v.asInt64Slice())
|
||||||
|
}
|
||||||
|
return string(j)
|
||||||
case INT64:
|
case INT64:
|
||||||
return strconv.FormatInt(v.AsInt64(), 10)
|
return strconv.FormatInt(v.AsInt64(), 10)
|
||||||
case FLOAT64SLICE:
|
case FLOAT64SLICE:
|
||||||
return fmt.Sprint(v.asFloat64Slice())
|
j, err := json.Marshal(v.asFloat64Slice())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Sprintf("invalid: %v", v.asFloat64Slice())
|
||||||
|
}
|
||||||
|
return string(j)
|
||||||
case FLOAT64:
|
case FLOAT64:
|
||||||
return fmt.Sprint(v.AsFloat64())
|
return fmt.Sprint(v.AsFloat64())
|
||||||
case STRINGSLICE:
|
case STRINGSLICE:
|
||||||
return fmt.Sprint(v.asStringSlice())
|
j, err := json.Marshal(v.asStringSlice())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Sprintf("invalid: %v", v.asStringSlice())
|
||||||
|
}
|
||||||
|
return string(j)
|
||||||
case STRING:
|
case STRING:
|
||||||
return v.stringly
|
return v.stringly
|
||||||
default:
|
default:
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/baggage/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/baggage/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Baggage
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/baggage)
|
||||||
640
vendor/go.opentelemetry.io/otel/baggage/baggage.go
generated
vendored
640
vendor/go.opentelemetry.io/otel/baggage/baggage.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package baggage // import "go.opentelemetry.io/otel/baggage"
|
package baggage // import "go.opentelemetry.io/otel/baggage"
|
||||||
|
|
||||||
@ -18,8 +7,8 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/internal/baggage"
|
"go.opentelemetry.io/otel/internal/baggage"
|
||||||
)
|
)
|
||||||
@ -32,16 +21,6 @@ const (
|
|||||||
listDelimiter = ","
|
listDelimiter = ","
|
||||||
keyValueDelimiter = "="
|
keyValueDelimiter = "="
|
||||||
propertyDelimiter = ";"
|
propertyDelimiter = ";"
|
||||||
|
|
||||||
keyDef = `([\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5a\x5e-\x7a\x7c\x7e]+)`
|
|
||||||
valueDef = `([\x21\x23-\x2b\x2d-\x3a\x3c-\x5B\x5D-\x7e]*)`
|
|
||||||
keyValueDef = `\s*` + keyDef + `\s*` + keyValueDelimiter + `\s*` + valueDef + `\s*`
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
keyRe = regexp.MustCompile(`^` + keyDef + `$`)
|
|
||||||
valueRe = regexp.MustCompile(`^` + valueDef + `$`)
|
|
||||||
propertyRe = regexp.MustCompile(`^(?:\s*` + keyDef + `\s*|` + keyValueDef + `)$`)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -65,9 +44,15 @@ type Property struct {
|
|||||||
|
|
||||||
// NewKeyProperty returns a new Property for key.
|
// NewKeyProperty returns a new Property for key.
|
||||||
//
|
//
|
||||||
|
// The passed key must be valid, non-empty UTF-8 string.
|
||||||
// If key is invalid, an error will be returned.
|
// If key is invalid, an error will be returned.
|
||||||
|
// However, the specific Propagators that are used to transmit baggage entries across
|
||||||
|
// component boundaries may impose their own restrictions on Property key.
|
||||||
|
// For example, the W3C Baggage specification restricts the Property keys to strings that
|
||||||
|
// satisfy the token definition from RFC7230, Section 3.2.6.
|
||||||
|
// For maximum compatibility, alphanumeric value are strongly recommended to be used as Property key.
|
||||||
func NewKeyProperty(key string) (Property, error) {
|
func NewKeyProperty(key string) (Property, error) {
|
||||||
if !keyRe.MatchString(key) {
|
if !validateBaggageName(key) {
|
||||||
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,12 +62,40 @@ func NewKeyProperty(key string) (Property, error) {
|
|||||||
|
|
||||||
// NewKeyValueProperty returns a new Property for key with value.
|
// NewKeyValueProperty returns a new Property for key with value.
|
||||||
//
|
//
|
||||||
// If key or value are invalid, an error will be returned.
|
// The passed key must be compliant with W3C Baggage specification.
|
||||||
|
// The passed value must be percent-encoded as defined in W3C Baggage specification.
|
||||||
|
//
|
||||||
|
// Notice: Consider using [NewKeyValuePropertyRaw] instead
|
||||||
|
// that does not require percent-encoding of the value.
|
||||||
func NewKeyValueProperty(key, value string) (Property, error) {
|
func NewKeyValueProperty(key, value string) (Property, error) {
|
||||||
if !keyRe.MatchString(key) {
|
if !validateKey(key) {
|
||||||
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||||
}
|
}
|
||||||
if !valueRe.MatchString(value) {
|
|
||||||
|
if !validateValue(value) {
|
||||||
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||||
|
}
|
||||||
|
decodedValue, err := url.PathUnescape(value)
|
||||||
|
if err != nil {
|
||||||
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||||
|
}
|
||||||
|
return NewKeyValuePropertyRaw(key, decodedValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewKeyValuePropertyRaw returns a new Property for key with value.
|
||||||
|
//
|
||||||
|
// The passed key must be valid, non-empty UTF-8 string.
|
||||||
|
// The passed value must be valid UTF-8 string.
|
||||||
|
// However, the specific Propagators that are used to transmit baggage entries across
|
||||||
|
// component boundaries may impose their own restrictions on Property key.
|
||||||
|
// For example, the W3C Baggage specification restricts the Property keys to strings that
|
||||||
|
// satisfy the token definition from RFC7230, Section 3.2.6.
|
||||||
|
// For maximum compatibility, alphanumeric value are strongly recommended to be used as Property key.
|
||||||
|
func NewKeyValuePropertyRaw(key, value string) (Property, error) {
|
||||||
|
if !validateBaggageName(key) {
|
||||||
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||||
|
}
|
||||||
|
if !validateBaggageValue(value) {
|
||||||
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,20 +119,11 @@ func parseProperty(property string) (Property, error) {
|
|||||||
return newInvalidProperty(), nil
|
return newInvalidProperty(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
match := propertyRe.FindStringSubmatch(property)
|
p, ok := parsePropertyInternal(property)
|
||||||
if len(match) != 4 {
|
if !ok {
|
||||||
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property)
|
return newInvalidProperty(), fmt.Errorf("%w: %q", errInvalidProperty, property)
|
||||||
}
|
}
|
||||||
|
|
||||||
var p Property
|
|
||||||
if match[1] != "" {
|
|
||||||
p.key = match[1]
|
|
||||||
} else {
|
|
||||||
p.key = match[2]
|
|
||||||
p.value = match[3]
|
|
||||||
p.hasValue = true
|
|
||||||
}
|
|
||||||
|
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,15 +134,15 @@ func (p Property) validate() error {
|
|||||||
return fmt.Errorf("invalid property: %w", err)
|
return fmt.Errorf("invalid property: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !keyRe.MatchString(p.key) {
|
if !validateBaggageName(p.key) {
|
||||||
return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key))
|
return errFunc(fmt.Errorf("%w: %q", errInvalidKey, p.key))
|
||||||
}
|
}
|
||||||
if p.hasValue && !valueRe.MatchString(p.value) {
|
|
||||||
return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value))
|
|
||||||
}
|
|
||||||
if !p.hasValue && p.value != "" {
|
if !p.hasValue && p.value != "" {
|
||||||
return errFunc(errors.New("inconsistent value"))
|
return errFunc(errors.New("inconsistent value"))
|
||||||
}
|
}
|
||||||
|
if p.hasValue && !validateBaggageValue(p.value) {
|
||||||
|
return errFunc(fmt.Errorf("%w: %q", errInvalidValue, p.value))
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,11 +158,19 @@ func (p Property) Value() (string, bool) {
|
|||||||
return p.value, p.hasValue
|
return p.value, p.hasValue
|
||||||
}
|
}
|
||||||
|
|
||||||
// String encodes Property into a string compliant with the W3C Baggage
|
// String encodes Property into a header string compliant with the W3C Baggage
|
||||||
// specification.
|
// specification.
|
||||||
|
// It would return empty string if the key is invalid with the W3C Baggage
|
||||||
|
// specification. This could happen for a UTF-8 key, as it may contain
|
||||||
|
// invalid characters.
|
||||||
func (p Property) String() string {
|
func (p Property) String() string {
|
||||||
|
// W3C Baggage specification does not allow percent-encoded keys.
|
||||||
|
if !validateKey(p.key) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
if p.hasValue {
|
if p.hasValue {
|
||||||
return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, p.value)
|
return fmt.Sprintf("%s%s%v", p.key, keyValueDelimiter, valueEscape(p.value))
|
||||||
}
|
}
|
||||||
return p.key
|
return p.key
|
||||||
}
|
}
|
||||||
@ -218,12 +230,17 @@ func (p properties) validate() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// String encodes properties into a string compliant with the W3C Baggage
|
// String encodes properties into a header string compliant with the W3C Baggage
|
||||||
// specification.
|
// specification.
|
||||||
func (p properties) String() string {
|
func (p properties) String() string {
|
||||||
props := make([]string, len(p))
|
props := make([]string, 0, len(p))
|
||||||
for i, prop := range p {
|
for _, prop := range p {
|
||||||
props[i] = prop.String()
|
s := prop.String()
|
||||||
|
|
||||||
|
// Ignored empty properties.
|
||||||
|
if s != "" {
|
||||||
|
props = append(props, s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return strings.Join(props, propertyDelimiter)
|
return strings.Join(props, propertyDelimiter)
|
||||||
}
|
}
|
||||||
@ -240,11 +257,38 @@ type Member struct {
|
|||||||
hasData bool
|
hasData bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMember returns a new Member from the passed arguments. The key will be
|
// NewMember returns a new Member from the passed arguments.
|
||||||
// used directly while the value will be url decoded after validation. An error
|
//
|
||||||
// is returned if the created Member would be invalid according to the W3C
|
// The passed key must be compliant with W3C Baggage specification.
|
||||||
// Baggage specification.
|
// The passed value must be percent-encoded as defined in W3C Baggage specification.
|
||||||
|
//
|
||||||
|
// Notice: Consider using [NewMemberRaw] instead
|
||||||
|
// that does not require percent-encoding of the value.
|
||||||
func NewMember(key, value string, props ...Property) (Member, error) {
|
func NewMember(key, value string, props ...Property) (Member, error) {
|
||||||
|
if !validateKey(key) {
|
||||||
|
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !validateValue(value) {
|
||||||
|
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||||
|
}
|
||||||
|
decodedValue, err := url.PathUnescape(value)
|
||||||
|
if err != nil {
|
||||||
|
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||||
|
}
|
||||||
|
return NewMemberRaw(key, decodedValue, props...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMemberRaw returns a new Member from the passed arguments.
|
||||||
|
//
|
||||||
|
// The passed key must be valid, non-empty UTF-8 string.
|
||||||
|
// The passed value must be valid UTF-8 string.
|
||||||
|
// However, the specific Propagators that are used to transmit baggage entries across
|
||||||
|
// component boundaries may impose their own restrictions on baggage key.
|
||||||
|
// For example, the W3C Baggage specification restricts the baggage keys to strings that
|
||||||
|
// satisfy the token definition from RFC7230, Section 3.2.6.
|
||||||
|
// For maximum compatibility, alphanumeric value are strongly recommended to be used as baggage key.
|
||||||
|
func NewMemberRaw(key, value string, props ...Property) (Member, error) {
|
||||||
m := Member{
|
m := Member{
|
||||||
key: key,
|
key: key,
|
||||||
value: value,
|
value: value,
|
||||||
@ -254,11 +298,6 @@ func NewMember(key, value string, props ...Property) (Member, error) {
|
|||||||
if err := m.validate(); err != nil {
|
if err := m.validate(); err != nil {
|
||||||
return newInvalidMember(), err
|
return newInvalidMember(), err
|
||||||
}
|
}
|
||||||
decodedValue, err := url.PathUnescape(value)
|
|
||||||
if err != nil {
|
|
||||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
|
||||||
}
|
|
||||||
m.value = decodedValue
|
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,11 +313,7 @@ func parseMember(member string) (Member, error) {
|
|||||||
return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n)
|
return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n)
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var props properties
|
||||||
key, value string
|
|
||||||
props properties
|
|
||||||
)
|
|
||||||
|
|
||||||
keyValue, properties, found := strings.Cut(member, propertyDelimiter)
|
keyValue, properties, found := strings.Cut(member, propertyDelimiter)
|
||||||
if found {
|
if found {
|
||||||
// Parse the member properties.
|
// Parse the member properties.
|
||||||
@ -299,34 +334,61 @@ func parseMember(member string) (Member, error) {
|
|||||||
}
|
}
|
||||||
// "Leading and trailing whitespaces are allowed but MUST be trimmed
|
// "Leading and trailing whitespaces are allowed but MUST be trimmed
|
||||||
// when converting the header into a data structure."
|
// when converting the header into a data structure."
|
||||||
key = strings.TrimSpace(k)
|
key := strings.TrimSpace(k)
|
||||||
var err error
|
if !validateKey(key) {
|
||||||
value, err = url.PathUnescape(strings.TrimSpace(v))
|
|
||||||
if err != nil {
|
|
||||||
return newInvalidMember(), fmt.Errorf("%w: %q", err, value)
|
|
||||||
}
|
|
||||||
if !keyRe.MatchString(key) {
|
|
||||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||||
}
|
}
|
||||||
if !valueRe.MatchString(value) {
|
|
||||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
rawVal := strings.TrimSpace(v)
|
||||||
|
if !validateValue(rawVal) {
|
||||||
|
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decode a percent-encoded value.
|
||||||
|
unescapeVal, err := url.PathUnescape(rawVal)
|
||||||
|
if err != nil {
|
||||||
|
return newInvalidMember(), fmt.Errorf("%w: %w", errInvalidValue, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal)
|
||||||
return Member{key: key, value: value, properties: props, hasData: true}, nil
|
return Member{key: key, value: value, properties: props, hasData: true}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// replaceInvalidUTF8Sequences replaces invalid UTF-8 sequences with '<27>'.
|
||||||
|
func replaceInvalidUTF8Sequences(cap int, unescapeVal string) string {
|
||||||
|
if utf8.ValidString(unescapeVal) {
|
||||||
|
return unescapeVal
|
||||||
|
}
|
||||||
|
// W3C baggage spec:
|
||||||
|
// https://github.com/w3c/baggage/blob/8c215efbeebd3fa4b1aceb937a747e56444f22f3/baggage/HTTP_HEADER_FORMAT.md?plain=1#L69
|
||||||
|
|
||||||
|
var b strings.Builder
|
||||||
|
b.Grow(cap)
|
||||||
|
for i := 0; i < len(unescapeVal); {
|
||||||
|
r, size := utf8.DecodeRuneInString(unescapeVal[i:])
|
||||||
|
if r == utf8.RuneError && size == 1 {
|
||||||
|
// Invalid UTF-8 sequence found, replace it with '<27>'
|
||||||
|
_, _ = b.WriteString("<22>")
|
||||||
|
} else {
|
||||||
|
_, _ = b.WriteRune(r)
|
||||||
|
}
|
||||||
|
i += size
|
||||||
|
}
|
||||||
|
|
||||||
|
return b.String()
|
||||||
|
}
|
||||||
|
|
||||||
// validate ensures m conforms to the W3C Baggage specification.
|
// validate ensures m conforms to the W3C Baggage specification.
|
||||||
// A key is just an ASCII string, but a value must be URL encoded UTF-8,
|
// A key must be an ASCII string, returning an error otherwise.
|
||||||
// returning an error otherwise.
|
|
||||||
func (m Member) validate() error {
|
func (m Member) validate() error {
|
||||||
if !m.hasData {
|
if !m.hasData {
|
||||||
return fmt.Errorf("%w: %q", errInvalidMember, m)
|
return fmt.Errorf("%w: %q", errInvalidMember, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !keyRe.MatchString(m.key) {
|
if !validateBaggageName(m.key) {
|
||||||
return fmt.Errorf("%w: %q", errInvalidKey, m.key)
|
return fmt.Errorf("%w: %q", errInvalidKey, m.key)
|
||||||
}
|
}
|
||||||
if !valueRe.MatchString(m.value) {
|
if !validateBaggageValue(m.value) {
|
||||||
return fmt.Errorf("%w: %q", errInvalidValue, m.value)
|
return fmt.Errorf("%w: %q", errInvalidValue, m.value)
|
||||||
}
|
}
|
||||||
return m.properties.validate()
|
return m.properties.validate()
|
||||||
@ -341,13 +403,20 @@ func (m Member) Value() string { return m.value }
|
|||||||
// Properties returns a copy of the Member properties.
|
// Properties returns a copy of the Member properties.
|
||||||
func (m Member) Properties() []Property { return m.properties.Copy() }
|
func (m Member) Properties() []Property { return m.properties.Copy() }
|
||||||
|
|
||||||
// String encodes Member into a string compliant with the W3C Baggage
|
// String encodes Member into a header string compliant with the W3C Baggage
|
||||||
// specification.
|
// specification.
|
||||||
|
// It would return empty string if the key is invalid with the W3C Baggage
|
||||||
|
// specification. This could happen for a UTF-8 key, as it may contain
|
||||||
|
// invalid characters.
|
||||||
func (m Member) String() string {
|
func (m Member) String() string {
|
||||||
// A key is just an ASCII string, but a value is URL encoded UTF-8.
|
// W3C Baggage specification does not allow percent-encoded keys.
|
||||||
s := fmt.Sprintf("%s%s%s", m.key, keyValueDelimiter, url.QueryEscape(m.value))
|
if !validateKey(m.key) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
s := m.key + keyValueDelimiter + valueEscape(m.value)
|
||||||
if len(m.properties) > 0 {
|
if len(m.properties) > 0 {
|
||||||
s = fmt.Sprintf("%s%s%s", s, propertyDelimiter, m.properties.String())
|
s += propertyDelimiter + m.properties.String()
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
@ -458,7 +527,7 @@ func (b Baggage) Member(key string) Member {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Members returns all the baggage list-members.
|
// Members returns all the baggage list-members.
|
||||||
// The order of the returned list-members does not have significance.
|
// The order of the returned list-members is not significant.
|
||||||
//
|
//
|
||||||
// The returned members are not validated, as we assume the validation happened
|
// The returned members are not validated, as we assume the validation happened
|
||||||
// when they were added to the Baggage.
|
// when they were added to the Baggage.
|
||||||
@ -479,8 +548,8 @@ func (b Baggage) Members() []Member {
|
|||||||
return members
|
return members
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMember returns a copy the Baggage with the member included. If the
|
// SetMember returns a copy of the Baggage with the member included. If the
|
||||||
// baggage contains a Member with the same key the existing Member is
|
// baggage contains a Member with the same key, the existing Member is
|
||||||
// replaced.
|
// replaced.
|
||||||
//
|
//
|
||||||
// If member is invalid according to the W3C Baggage specification, an error
|
// If member is invalid according to the W3C Baggage specification, an error
|
||||||
@ -536,17 +605,414 @@ func (b Baggage) Len() int {
|
|||||||
return len(b.list)
|
return len(b.list)
|
||||||
}
|
}
|
||||||
|
|
||||||
// String encodes Baggage into a string compliant with the W3C Baggage
|
// String encodes Baggage into a header string compliant with the W3C Baggage
|
||||||
// specification. The returned string will be invalid if the Baggage contains
|
// specification.
|
||||||
// any invalid list-members.
|
// It would ignore members where the member key is invalid with the W3C Baggage
|
||||||
|
// specification. This could happen for a UTF-8 key, as it may contain
|
||||||
|
// invalid characters.
|
||||||
func (b Baggage) String() string {
|
func (b Baggage) String() string {
|
||||||
members := make([]string, 0, len(b.list))
|
members := make([]string, 0, len(b.list))
|
||||||
for k, v := range b.list {
|
for k, v := range b.list {
|
||||||
members = append(members, Member{
|
s := Member{
|
||||||
key: k,
|
key: k,
|
||||||
value: v.Value,
|
value: v.Value,
|
||||||
properties: fromInternalProperties(v.Properties),
|
properties: fromInternalProperties(v.Properties),
|
||||||
}.String())
|
}.String()
|
||||||
|
|
||||||
|
// Ignored empty members.
|
||||||
|
if s != "" {
|
||||||
|
members = append(members, s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return strings.Join(members, listDelimiter)
|
return strings.Join(members, listDelimiter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parsePropertyInternal attempts to decode a Property from the passed string.
|
||||||
|
// It follows the spec at https://www.w3.org/TR/baggage/#definition.
|
||||||
|
func parsePropertyInternal(s string) (p Property, ok bool) {
|
||||||
|
// For the entire function we will use " key = value " as an example.
|
||||||
|
// Attempting to parse the key.
|
||||||
|
// First skip spaces at the beginning "< >key = value " (they could be empty).
|
||||||
|
index := skipSpace(s, 0)
|
||||||
|
|
||||||
|
// Parse the key: " <key> = value ".
|
||||||
|
keyStart := index
|
||||||
|
keyEnd := index
|
||||||
|
for _, c := range s[keyStart:] {
|
||||||
|
if !validateKeyChar(c) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
keyEnd++
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we couldn't find any valid key character,
|
||||||
|
// it means the key is either empty or invalid.
|
||||||
|
if keyStart == keyEnd {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip spaces after the key: " key< >= value ".
|
||||||
|
index = skipSpace(s, keyEnd)
|
||||||
|
|
||||||
|
if index == len(s) {
|
||||||
|
// A key can have no value, like: " key ".
|
||||||
|
ok = true
|
||||||
|
p.key = s[keyStart:keyEnd]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have not reached the end and we can't find the '=' delimiter,
|
||||||
|
// it means the property is invalid.
|
||||||
|
if s[index] != keyValueDelimiter[0] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempting to parse the value.
|
||||||
|
// Match: " key =< >value ".
|
||||||
|
index = skipSpace(s, index+1)
|
||||||
|
|
||||||
|
// Match the value string: " key = <value> ".
|
||||||
|
// A valid property can be: " key =".
|
||||||
|
// Therefore, we don't have to check if the value is empty.
|
||||||
|
valueStart := index
|
||||||
|
valueEnd := index
|
||||||
|
for _, c := range s[valueStart:] {
|
||||||
|
if !validateValueChar(c) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
valueEnd++
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip all trailing whitespaces: " key = value< >".
|
||||||
|
index = skipSpace(s, valueEnd)
|
||||||
|
|
||||||
|
// If after looking for the value and skipping whitespaces
|
||||||
|
// we have not reached the end, it means the property is
|
||||||
|
// invalid, something like: " key = value value1".
|
||||||
|
if index != len(s) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Decode a percent-encoded value.
|
||||||
|
rawVal := s[valueStart:valueEnd]
|
||||||
|
unescapeVal, err := url.PathUnescape(rawVal)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal)
|
||||||
|
|
||||||
|
ok = true
|
||||||
|
p.key = s[keyStart:keyEnd]
|
||||||
|
p.hasValue = true
|
||||||
|
|
||||||
|
p.value = value
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func skipSpace(s string, offset int) int {
|
||||||
|
i := offset
|
||||||
|
for ; i < len(s); i++ {
|
||||||
|
c := s[i]
|
||||||
|
if c != ' ' && c != '\t' {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
|
var safeKeyCharset = [utf8.RuneSelf]bool{
|
||||||
|
// 0x23 to 0x27
|
||||||
|
'#': true,
|
||||||
|
'$': true,
|
||||||
|
'%': true,
|
||||||
|
'&': true,
|
||||||
|
'\'': true,
|
||||||
|
|
||||||
|
// 0x30 to 0x39
|
||||||
|
'0': true,
|
||||||
|
'1': true,
|
||||||
|
'2': true,
|
||||||
|
'3': true,
|
||||||
|
'4': true,
|
||||||
|
'5': true,
|
||||||
|
'6': true,
|
||||||
|
'7': true,
|
||||||
|
'8': true,
|
||||||
|
'9': true,
|
||||||
|
|
||||||
|
// 0x41 to 0x5a
|
||||||
|
'A': true,
|
||||||
|
'B': true,
|
||||||
|
'C': true,
|
||||||
|
'D': true,
|
||||||
|
'E': true,
|
||||||
|
'F': true,
|
||||||
|
'G': true,
|
||||||
|
'H': true,
|
||||||
|
'I': true,
|
||||||
|
'J': true,
|
||||||
|
'K': true,
|
||||||
|
'L': true,
|
||||||
|
'M': true,
|
||||||
|
'N': true,
|
||||||
|
'O': true,
|
||||||
|
'P': true,
|
||||||
|
'Q': true,
|
||||||
|
'R': true,
|
||||||
|
'S': true,
|
||||||
|
'T': true,
|
||||||
|
'U': true,
|
||||||
|
'V': true,
|
||||||
|
'W': true,
|
||||||
|
'X': true,
|
||||||
|
'Y': true,
|
||||||
|
'Z': true,
|
||||||
|
|
||||||
|
// 0x5e to 0x7a
|
||||||
|
'^': true,
|
||||||
|
'_': true,
|
||||||
|
'`': true,
|
||||||
|
'a': true,
|
||||||
|
'b': true,
|
||||||
|
'c': true,
|
||||||
|
'd': true,
|
||||||
|
'e': true,
|
||||||
|
'f': true,
|
||||||
|
'g': true,
|
||||||
|
'h': true,
|
||||||
|
'i': true,
|
||||||
|
'j': true,
|
||||||
|
'k': true,
|
||||||
|
'l': true,
|
||||||
|
'm': true,
|
||||||
|
'n': true,
|
||||||
|
'o': true,
|
||||||
|
'p': true,
|
||||||
|
'q': true,
|
||||||
|
'r': true,
|
||||||
|
's': true,
|
||||||
|
't': true,
|
||||||
|
'u': true,
|
||||||
|
'v': true,
|
||||||
|
'w': true,
|
||||||
|
'x': true,
|
||||||
|
'y': true,
|
||||||
|
'z': true,
|
||||||
|
|
||||||
|
// remainder
|
||||||
|
'!': true,
|
||||||
|
'*': true,
|
||||||
|
'+': true,
|
||||||
|
'-': true,
|
||||||
|
'.': true,
|
||||||
|
'|': true,
|
||||||
|
'~': true,
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateBaggageName checks if the string is a valid OpenTelemetry Baggage name.
|
||||||
|
// Baggage name is a valid, non-empty UTF-8 string.
|
||||||
|
func validateBaggageName(s string) bool {
|
||||||
|
if len(s) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return utf8.ValidString(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateBaggageValue checks if the string is a valid OpenTelemetry Baggage value.
|
||||||
|
// Baggage value is a valid UTF-8 strings.
|
||||||
|
// Empty string is also a valid UTF-8 string.
|
||||||
|
func validateBaggageValue(s string) bool {
|
||||||
|
return utf8.ValidString(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateKey checks if the string is a valid W3C Baggage key.
|
||||||
|
func validateKey(s string) bool {
|
||||||
|
if len(s) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, c := range s {
|
||||||
|
if !validateKeyChar(c) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateKeyChar(c int32) bool {
|
||||||
|
return c >= 0 && c < int32(utf8.RuneSelf) && safeKeyCharset[c]
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateValue checks if the string is a valid W3C Baggage value.
|
||||||
|
func validateValue(s string) bool {
|
||||||
|
for _, c := range s {
|
||||||
|
if !validateValueChar(c) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
var safeValueCharset = [utf8.RuneSelf]bool{
|
||||||
|
'!': true, // 0x21
|
||||||
|
|
||||||
|
// 0x23 to 0x2b
|
||||||
|
'#': true,
|
||||||
|
'$': true,
|
||||||
|
'%': true,
|
||||||
|
'&': true,
|
||||||
|
'\'': true,
|
||||||
|
'(': true,
|
||||||
|
')': true,
|
||||||
|
'*': true,
|
||||||
|
'+': true,
|
||||||
|
|
||||||
|
// 0x2d to 0x3a
|
||||||
|
'-': true,
|
||||||
|
'.': true,
|
||||||
|
'/': true,
|
||||||
|
'0': true,
|
||||||
|
'1': true,
|
||||||
|
'2': true,
|
||||||
|
'3': true,
|
||||||
|
'4': true,
|
||||||
|
'5': true,
|
||||||
|
'6': true,
|
||||||
|
'7': true,
|
||||||
|
'8': true,
|
||||||
|
'9': true,
|
||||||
|
':': true,
|
||||||
|
|
||||||
|
// 0x3c to 0x5b
|
||||||
|
'<': true, // 0x3C
|
||||||
|
'=': true, // 0x3D
|
||||||
|
'>': true, // 0x3E
|
||||||
|
'?': true, // 0x3F
|
||||||
|
'@': true, // 0x40
|
||||||
|
'A': true, // 0x41
|
||||||
|
'B': true, // 0x42
|
||||||
|
'C': true, // 0x43
|
||||||
|
'D': true, // 0x44
|
||||||
|
'E': true, // 0x45
|
||||||
|
'F': true, // 0x46
|
||||||
|
'G': true, // 0x47
|
||||||
|
'H': true, // 0x48
|
||||||
|
'I': true, // 0x49
|
||||||
|
'J': true, // 0x4A
|
||||||
|
'K': true, // 0x4B
|
||||||
|
'L': true, // 0x4C
|
||||||
|
'M': true, // 0x4D
|
||||||
|
'N': true, // 0x4E
|
||||||
|
'O': true, // 0x4F
|
||||||
|
'P': true, // 0x50
|
||||||
|
'Q': true, // 0x51
|
||||||
|
'R': true, // 0x52
|
||||||
|
'S': true, // 0x53
|
||||||
|
'T': true, // 0x54
|
||||||
|
'U': true, // 0x55
|
||||||
|
'V': true, // 0x56
|
||||||
|
'W': true, // 0x57
|
||||||
|
'X': true, // 0x58
|
||||||
|
'Y': true, // 0x59
|
||||||
|
'Z': true, // 0x5A
|
||||||
|
'[': true, // 0x5B
|
||||||
|
|
||||||
|
// 0x5d to 0x7e
|
||||||
|
']': true, // 0x5D
|
||||||
|
'^': true, // 0x5E
|
||||||
|
'_': true, // 0x5F
|
||||||
|
'`': true, // 0x60
|
||||||
|
'a': true, // 0x61
|
||||||
|
'b': true, // 0x62
|
||||||
|
'c': true, // 0x63
|
||||||
|
'd': true, // 0x64
|
||||||
|
'e': true, // 0x65
|
||||||
|
'f': true, // 0x66
|
||||||
|
'g': true, // 0x67
|
||||||
|
'h': true, // 0x68
|
||||||
|
'i': true, // 0x69
|
||||||
|
'j': true, // 0x6A
|
||||||
|
'k': true, // 0x6B
|
||||||
|
'l': true, // 0x6C
|
||||||
|
'm': true, // 0x6D
|
||||||
|
'n': true, // 0x6E
|
||||||
|
'o': true, // 0x6F
|
||||||
|
'p': true, // 0x70
|
||||||
|
'q': true, // 0x71
|
||||||
|
'r': true, // 0x72
|
||||||
|
's': true, // 0x73
|
||||||
|
't': true, // 0x74
|
||||||
|
'u': true, // 0x75
|
||||||
|
'v': true, // 0x76
|
||||||
|
'w': true, // 0x77
|
||||||
|
'x': true, // 0x78
|
||||||
|
'y': true, // 0x79
|
||||||
|
'z': true, // 0x7A
|
||||||
|
'{': true, // 0x7B
|
||||||
|
'|': true, // 0x7C
|
||||||
|
'}': true, // 0x7D
|
||||||
|
'~': true, // 0x7E
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateValueChar(c int32) bool {
|
||||||
|
return c >= 0 && c < int32(utf8.RuneSelf) && safeValueCharset[c]
|
||||||
|
}
|
||||||
|
|
||||||
|
// valueEscape escapes the string so it can be safely placed inside a baggage value,
|
||||||
|
// replacing special characters with %XX sequences as needed.
|
||||||
|
//
|
||||||
|
// The implementation is based on:
|
||||||
|
// https://github.com/golang/go/blob/f6509cf5cdbb5787061b784973782933c47f1782/src/net/url/url.go#L285.
|
||||||
|
func valueEscape(s string) string {
|
||||||
|
hexCount := 0
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
c := s[i]
|
||||||
|
if shouldEscape(c) {
|
||||||
|
hexCount++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if hexCount == 0 {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
var buf [64]byte
|
||||||
|
var t []byte
|
||||||
|
|
||||||
|
required := len(s) + 2*hexCount
|
||||||
|
if required <= len(buf) {
|
||||||
|
t = buf[:required]
|
||||||
|
} else {
|
||||||
|
t = make([]byte, required)
|
||||||
|
}
|
||||||
|
|
||||||
|
j := 0
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
c := s[i]
|
||||||
|
if shouldEscape(s[i]) {
|
||||||
|
const upperhex = "0123456789ABCDEF"
|
||||||
|
t[j] = '%'
|
||||||
|
t[j+1] = upperhex[c>>4]
|
||||||
|
t[j+2] = upperhex[c&15]
|
||||||
|
j += 3
|
||||||
|
} else {
|
||||||
|
t[j] = c
|
||||||
|
j++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
// shouldEscape returns true if the specified byte should be escaped when
|
||||||
|
// appearing in a baggage value string.
|
||||||
|
func shouldEscape(c byte) bool {
|
||||||
|
if c == '%' {
|
||||||
|
// The percent character must be encoded so that percent-encoding can work.
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return !validateValueChar(int32(c))
|
||||||
|
}
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/baggage/context.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/baggage/context.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package baggage // import "go.opentelemetry.io/otel/baggage"
|
package baggage // import "go.opentelemetry.io/otel/baggage"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/baggage/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/baggage/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package baggage provides functionality for storing and retrieving
|
Package baggage provides functionality for storing and retrieving
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/codes/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/codes/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Codes
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/codes)
|
||||||
15
vendor/go.opentelemetry.io/otel/codes/codes.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/codes/codes.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package codes // import "go.opentelemetry.io/otel/codes"
|
package codes // import "go.opentelemetry.io/otel/codes"
|
||||||
|
|
||||||
@ -94,7 +83,7 @@ func (c *Code) UnmarshalJSON(b []byte) error {
|
|||||||
return fmt.Errorf("invalid code: %q", ci)
|
return fmt.Errorf("invalid code: %q", ci)
|
||||||
}
|
}
|
||||||
|
|
||||||
*c = Code(ci)
|
*c = Code(ci) // nolint: gosec // Bit size of 32 check above.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return fmt.Errorf("invalid code: %q", string(b))
|
return fmt.Errorf("invalid code: %q", string(b))
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/codes/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/codes/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package codes defines the canonical error codes used by OpenTelemetry.
|
Package codes defines the canonical error codes used by OpenTelemetry.
|
||||||
|
|||||||
17
vendor/go.opentelemetry.io/otel/doc.go
generated
vendored
17
vendor/go.opentelemetry.io/otel/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package otel provides global access to the OpenTelemetry API. The subpackages of
|
Package otel provides global access to the OpenTelemetry API. The subpackages of
|
||||||
@ -22,12 +11,14 @@ transmitted anywhere. An implementation of the OpenTelemetry SDK, like the
|
|||||||
default SDK implementation (go.opentelemetry.io/otel/sdk), and associated
|
default SDK implementation (go.opentelemetry.io/otel/sdk), and associated
|
||||||
exporters are used to process and transport this data.
|
exporters are used to process and transport this data.
|
||||||
|
|
||||||
To read the getting started guide, see https://opentelemetry.io/docs/go/getting-started/.
|
To read the getting started guide, see https://opentelemetry.io/docs/languages/go/getting-started/.
|
||||||
|
|
||||||
To read more about tracing, see go.opentelemetry.io/otel/trace.
|
To read more about tracing, see go.opentelemetry.io/otel/trace.
|
||||||
|
|
||||||
To read more about metrics, see go.opentelemetry.io/otel/metric.
|
To read more about metrics, see go.opentelemetry.io/otel/metric.
|
||||||
|
|
||||||
|
To read more about logs, see go.opentelemetry.io/otel/log.
|
||||||
|
|
||||||
To read more about propagation, see go.opentelemetry.io/otel/propagation and
|
To read more about propagation, see go.opentelemetry.io/otel/propagation and
|
||||||
go.opentelemetry.io/otel/baggage.
|
go.opentelemetry.io/otel/baggage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/error_handler.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/error_handler.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package otel // import "go.opentelemetry.io/otel"
|
package otel // import "go.opentelemetry.io/otel"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/get_main_pkgs.sh
generated
vendored
13
vendor/go.opentelemetry.io/otel/get_main_pkgs.sh
generated
vendored
@ -1,18 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright The OpenTelemetry Authors
|
# Copyright The OpenTelemetry Authors
|
||||||
#
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|||||||
25
vendor/go.opentelemetry.io/otel/handler.go
generated
vendored
25
vendor/go.opentelemetry.io/otel/handler.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package otel // import "go.opentelemetry.io/otel"
|
package otel // import "go.opentelemetry.io/otel"
|
||||||
|
|
||||||
@ -18,12 +7,8 @@ import (
|
|||||||
"go.opentelemetry.io/otel/internal/global"
|
"go.opentelemetry.io/otel/internal/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
// Compile-time check global.ErrDelegator implements ErrorHandler.
|
||||||
// Compile-time check global.ErrDelegator implements ErrorHandler.
|
var _ ErrorHandler = (*global.ErrDelegator)(nil)
|
||||||
_ ErrorHandler = (*global.ErrDelegator)(nil)
|
|
||||||
// Compile-time check global.ErrLogger implements ErrorHandler.
|
|
||||||
_ ErrorHandler = (*global.ErrLogger)(nil)
|
|
||||||
)
|
|
||||||
|
|
||||||
// GetErrorHandler returns the global ErrorHandler instance.
|
// GetErrorHandler returns the global ErrorHandler instance.
|
||||||
//
|
//
|
||||||
@ -44,5 +29,5 @@ func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() }
|
|||||||
// delegate errors to h.
|
// delegate errors to h.
|
||||||
func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) }
|
func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) }
|
||||||
|
|
||||||
// Handle is a convenience function for ErrorHandler().Handle(err).
|
// Handle is a convenience function for GetErrorHandler().Handle(err).
|
||||||
func Handle(err error) { global.Handle(err) }
|
func Handle(err error) { global.GetErrorHandler().Handle(err) }
|
||||||
|
|||||||
37
vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go
generated
vendored
37
vendor/go.opentelemetry.io/otel/internal/attribute/attribute.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package attribute provide several helper functions for some commonly used
|
Package attribute provide several helper functions for some commonly used
|
||||||
@ -25,33 +14,33 @@ import (
|
|||||||
// BoolSliceValue converts a bool slice into an array with same elements as slice.
|
// BoolSliceValue converts a bool slice into an array with same elements as slice.
|
||||||
func BoolSliceValue(v []bool) interface{} {
|
func BoolSliceValue(v []bool) interface{} {
|
||||||
var zero bool
|
var zero bool
|
||||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero)))
|
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||||
copy(cp.Elem().Slice(0, len(v)).Interface().([]bool), v)
|
reflect.Copy(cp, reflect.ValueOf(v))
|
||||||
return cp.Elem().Interface()
|
return cp.Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Int64SliceValue converts an int64 slice into an array with same elements as slice.
|
// Int64SliceValue converts an int64 slice into an array with same elements as slice.
|
||||||
func Int64SliceValue(v []int64) interface{} {
|
func Int64SliceValue(v []int64) interface{} {
|
||||||
var zero int64
|
var zero int64
|
||||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero)))
|
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||||
copy(cp.Elem().Slice(0, len(v)).Interface().([]int64), v)
|
reflect.Copy(cp, reflect.ValueOf(v))
|
||||||
return cp.Elem().Interface()
|
return cp.Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float64SliceValue converts a float64 slice into an array with same elements as slice.
|
// Float64SliceValue converts a float64 slice into an array with same elements as slice.
|
||||||
func Float64SliceValue(v []float64) interface{} {
|
func Float64SliceValue(v []float64) interface{} {
|
||||||
var zero float64
|
var zero float64
|
||||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero)))
|
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||||
copy(cp.Elem().Slice(0, len(v)).Interface().([]float64), v)
|
reflect.Copy(cp, reflect.ValueOf(v))
|
||||||
return cp.Elem().Interface()
|
return cp.Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
// StringSliceValue converts a string slice into an array with same elements as slice.
|
// StringSliceValue converts a string slice into an array with same elements as slice.
|
||||||
func StringSliceValue(v []string) interface{} {
|
func StringSliceValue(v []string) interface{} {
|
||||||
var zero string
|
var zero string
|
||||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero)))
|
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||||
copy(cp.Elem().Slice(0, len(v)).Interface().([]string), v)
|
reflect.Copy(cp, reflect.ValueOf(v))
|
||||||
return cp.Elem().Interface()
|
return cp.Interface()
|
||||||
}
|
}
|
||||||
|
|
||||||
// AsBoolSlice converts a bool array into a slice into with same elements as array.
|
// AsBoolSlice converts a bool array into a slice into with same elements as array.
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/internal/baggage/baggage.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package baggage provides base types and functionality to store and retrieve
|
Package baggage provides base types and functionality to store and retrieve
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/internal/baggage/context.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/internal/baggage/context.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package baggage // import "go.opentelemetry.io/otel/internal/baggage"
|
package baggage // import "go.opentelemetry.io/otel/internal/baggage"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/internal/gen.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/internal/gen.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package internal // import "go.opentelemetry.io/otel/internal"
|
package internal // import "go.opentelemetry.io/otel/internal"
|
||||||
|
|
||||||
|
|||||||
84
vendor/go.opentelemetry.io/otel/internal/global/handler.go
generated
vendored
84
vendor/go.opentelemetry.io/otel/internal/global/handler.go
generated
vendored
@ -1,38 +1,13 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
// GlobalErrorHandler provides an ErrorHandler that can be used
|
|
||||||
// throughout an OpenTelemetry instrumented project. When a user
|
|
||||||
// specified ErrorHandler is registered (`SetErrorHandler`) all calls to
|
|
||||||
// `Handle` and will be delegated to the registered ErrorHandler.
|
|
||||||
GlobalErrorHandler = defaultErrorHandler()
|
|
||||||
|
|
||||||
// Compile-time check that delegator implements ErrorHandler.
|
|
||||||
_ ErrorHandler = (*ErrDelegator)(nil)
|
|
||||||
// Compile-time check that errLogger implements ErrorHandler.
|
|
||||||
_ ErrorHandler = (*ErrLogger)(nil)
|
|
||||||
)
|
|
||||||
|
|
||||||
// ErrorHandler handles irremediable events.
|
// ErrorHandler handles irremediable events.
|
||||||
type ErrorHandler interface {
|
type ErrorHandler interface {
|
||||||
// Handle handles any error deemed irremediable by an OpenTelemetry
|
// Handle handles any error deemed irremediable by an OpenTelemetry
|
||||||
@ -44,59 +19,18 @@ type ErrDelegator struct {
|
|||||||
delegate atomic.Pointer[ErrorHandler]
|
delegate atomic.Pointer[ErrorHandler]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ErrDelegator) Handle(err error) {
|
// Compile-time check that delegator implements ErrorHandler.
|
||||||
d.getDelegate().Handle(err)
|
var _ ErrorHandler = (*ErrDelegator)(nil)
|
||||||
}
|
|
||||||
|
|
||||||
func (d *ErrDelegator) getDelegate() ErrorHandler {
|
func (d *ErrDelegator) Handle(err error) {
|
||||||
return *d.delegate.Load()
|
if eh := d.delegate.Load(); eh != nil {
|
||||||
|
(*eh).Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Print(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setDelegate sets the ErrorHandler delegate.
|
// setDelegate sets the ErrorHandler delegate.
|
||||||
func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
|
func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
|
||||||
d.delegate.Store(&eh)
|
d.delegate.Store(&eh)
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultErrorHandler() *ErrDelegator {
|
|
||||||
d := &ErrDelegator{}
|
|
||||||
d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)})
|
|
||||||
return d
|
|
||||||
}
|
|
||||||
|
|
||||||
// ErrLogger logs errors if no delegate is set, otherwise they are delegated.
|
|
||||||
type ErrLogger struct {
|
|
||||||
l *log.Logger
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle logs err if no delegate is set, otherwise it is delegated.
|
|
||||||
func (h *ErrLogger) Handle(err error) {
|
|
||||||
h.l.Print(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetErrorHandler returns the global ErrorHandler instance.
|
|
||||||
//
|
|
||||||
// The default ErrorHandler instance returned will log all errors to STDERR
|
|
||||||
// until an override ErrorHandler is set with SetErrorHandler. All
|
|
||||||
// ErrorHandler returned prior to this will automatically forward errors to
|
|
||||||
// the set instance instead of logging.
|
|
||||||
//
|
|
||||||
// Subsequent calls to SetErrorHandler after the first will not forward errors
|
|
||||||
// to the new ErrorHandler for prior returned instances.
|
|
||||||
func GetErrorHandler() ErrorHandler {
|
|
||||||
return GlobalErrorHandler
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetErrorHandler sets the global ErrorHandler to h.
|
|
||||||
//
|
|
||||||
// The first time this is called all ErrorHandler previously returned from
|
|
||||||
// GetErrorHandler will send errors to h instead of the default logging
|
|
||||||
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
|
|
||||||
// delegate errors to h.
|
|
||||||
func SetErrorHandler(h ErrorHandler) {
|
|
||||||
GlobalErrorHandler.setDelegate(h)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle is a convenience function for ErrorHandler().Handle(err).
|
|
||||||
func Handle(err error) {
|
|
||||||
GetErrorHandler().Handle(err)
|
|
||||||
}
|
|
||||||
|
|||||||
65
vendor/go.opentelemetry.io/otel/internal/global/instruments.go
generated
vendored
65
vendor/go.opentelemetry.io/otel/internal/global/instruments.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
@ -292,6 +281,32 @@ func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.Reco
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type sfGauge struct {
|
||||||
|
embedded.Float64Gauge
|
||||||
|
|
||||||
|
name string
|
||||||
|
opts []metric.Float64GaugeOption
|
||||||
|
|
||||||
|
delegate atomic.Value // metric.Float64Gauge
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ metric.Float64Gauge = (*sfGauge)(nil)
|
||||||
|
|
||||||
|
func (i *sfGauge) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.Float64Gauge(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
GetErrorHandler().Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfGauge) Record(ctx context.Context, x float64, opts ...metric.RecordOption) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(metric.Float64Gauge).Record(ctx, x, opts...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type siCounter struct {
|
type siCounter struct {
|
||||||
embedded.Int64Counter
|
embedded.Int64Counter
|
||||||
|
|
||||||
@ -369,3 +384,29 @@ func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.Record
|
|||||||
ctr.(metric.Int64Histogram).Record(ctx, x, opts...)
|
ctr.(metric.Int64Histogram).Record(ctx, x, opts...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type siGauge struct {
|
||||||
|
embedded.Int64Gauge
|
||||||
|
|
||||||
|
name string
|
||||||
|
opts []metric.Int64GaugeOption
|
||||||
|
|
||||||
|
delegate atomic.Value // metric.Int64Gauge
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ metric.Int64Gauge = (*siGauge)(nil)
|
||||||
|
|
||||||
|
func (i *siGauge) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.Int64Gauge(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
GetErrorHandler().Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siGauge) Record(ctx context.Context, x int64, opts ...metric.RecordOption) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(metric.Int64Gauge).Record(ctx, x, opts...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
39
vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
generated
vendored
39
vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
@ -23,17 +12,20 @@ import (
|
|||||||
"github.com/go-logr/stdr"
|
"github.com/go-logr/stdr"
|
||||||
)
|
)
|
||||||
|
|
||||||
// globalLogger is the logging interface used within the otel api and sdk provide details of the internals.
|
// globalLogger holds a reference to the [logr.Logger] used within
|
||||||
|
// go.opentelemetry.io/otel.
|
||||||
//
|
//
|
||||||
// The default logger uses stdr which is backed by the standard `log.Logger`
|
// The default logger uses stdr which is backed by the standard `log.Logger`
|
||||||
// interface. This logger will only show messages at the Error Level.
|
// interface. This logger will only show messages at the Error Level.
|
||||||
var globalLogger atomic.Pointer[logr.Logger]
|
var globalLogger = func() *atomic.Pointer[logr.Logger] {
|
||||||
|
l := stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))
|
||||||
|
|
||||||
func init() {
|
p := new(atomic.Pointer[logr.Logger])
|
||||||
SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)))
|
p.Store(&l)
|
||||||
}
|
return p
|
||||||
|
}()
|
||||||
|
|
||||||
// SetLogger overrides the globalLogger with l.
|
// SetLogger sets the global Logger to l.
|
||||||
//
|
//
|
||||||
// To see Warn messages use a logger with `l.V(1).Enabled() == true`
|
// To see Warn messages use a logger with `l.V(1).Enabled() == true`
|
||||||
// To see Info messages use a logger with `l.V(4).Enabled() == true`
|
// To see Info messages use a logger with `l.V(4).Enabled() == true`
|
||||||
@ -42,28 +34,29 @@ func SetLogger(l logr.Logger) {
|
|||||||
globalLogger.Store(&l)
|
globalLogger.Store(&l)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getLogger() logr.Logger {
|
// GetLogger returns the global logger.
|
||||||
|
func GetLogger() logr.Logger {
|
||||||
return *globalLogger.Load()
|
return *globalLogger.Load()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Info prints messages about the general state of the API or SDK.
|
// Info prints messages about the general state of the API or SDK.
|
||||||
// This should usually be less than 5 messages a minute.
|
// This should usually be less than 5 messages a minute.
|
||||||
func Info(msg string, keysAndValues ...interface{}) {
|
func Info(msg string, keysAndValues ...interface{}) {
|
||||||
getLogger().V(4).Info(msg, keysAndValues...)
|
GetLogger().V(4).Info(msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error prints messages about exceptional states of the API or SDK.
|
// Error prints messages about exceptional states of the API or SDK.
|
||||||
func Error(err error, msg string, keysAndValues ...interface{}) {
|
func Error(err error, msg string, keysAndValues ...interface{}) {
|
||||||
getLogger().Error(err, msg, keysAndValues...)
|
GetLogger().Error(err, msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug prints messages about all internal changes in the API or SDK.
|
// Debug prints messages about all internal changes in the API or SDK.
|
||||||
func Debug(msg string, keysAndValues ...interface{}) {
|
func Debug(msg string, keysAndValues ...interface{}) {
|
||||||
getLogger().V(8).Info(msg, keysAndValues...)
|
GetLogger().V(8).Info(msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warn prints messages about warnings in the API or SDK.
|
// Warn prints messages about warnings in the API or SDK.
|
||||||
// Not an error but is likely more important than an informational event.
|
// Not an error but is likely more important than an informational event.
|
||||||
func Warn(msg string, keysAndValues ...interface{}) {
|
func Warn(msg string, keysAndValues ...interface{}) {
|
||||||
getLogger().V(1).Info(msg, keysAndValues...)
|
GetLogger().V(1).Info(msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
|||||||
341
vendor/go.opentelemetry.io/otel/internal/global/meter.go
generated
vendored
341
vendor/go.opentelemetry.io/otel/internal/global/meter.go
generated
vendored
@ -1,23 +1,12 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"container/list"
|
"container/list"
|
||||||
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/metric"
|
"go.opentelemetry.io/otel/metric"
|
||||||
"go.opentelemetry.io/otel/metric/embedded"
|
"go.opentelemetry.io/otel/metric/embedded"
|
||||||
@ -76,6 +65,7 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me
|
|||||||
key := il{
|
key := il{
|
||||||
name: name,
|
name: name,
|
||||||
version: c.InstrumentationVersion(),
|
version: c.InstrumentationVersion(),
|
||||||
|
schema: c.SchemaURL(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.meters == nil {
|
if p.meters == nil {
|
||||||
@ -86,7 +76,7 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me
|
|||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
t := &meter{name: name, opts: opts}
|
t := &meter{name: name, opts: opts, instruments: make(map[instID]delegatedInstrument)}
|
||||||
p.meters[key] = t
|
p.meters[key] = t
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
@ -102,17 +92,29 @@ type meter struct {
|
|||||||
opts []metric.MeterOption
|
opts []metric.MeterOption
|
||||||
|
|
||||||
mtx sync.Mutex
|
mtx sync.Mutex
|
||||||
instruments []delegatedInstrument
|
instruments map[instID]delegatedInstrument
|
||||||
|
|
||||||
registry list.List
|
registry list.List
|
||||||
|
|
||||||
delegate atomic.Value // metric.Meter
|
delegate metric.Meter
|
||||||
}
|
}
|
||||||
|
|
||||||
type delegatedInstrument interface {
|
type delegatedInstrument interface {
|
||||||
setDelegate(metric.Meter)
|
setDelegate(metric.Meter)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// instID are the identifying properties of a instrument.
|
||||||
|
type instID struct {
|
||||||
|
// name is the name of the stream.
|
||||||
|
name string
|
||||||
|
// description is the description of the stream.
|
||||||
|
description string
|
||||||
|
// kind defines the functional group of the instrument.
|
||||||
|
kind reflect.Type
|
||||||
|
// unit is the unit of the stream.
|
||||||
|
unit string
|
||||||
|
}
|
||||||
|
|
||||||
// setDelegate configures m to delegate all Meter functionality to Meters
|
// setDelegate configures m to delegate all Meter functionality to Meters
|
||||||
// created by provider.
|
// created by provider.
|
||||||
//
|
//
|
||||||
@ -120,19 +122,21 @@ type delegatedInstrument interface {
|
|||||||
//
|
//
|
||||||
// It is guaranteed by the caller that this happens only once.
|
// It is guaranteed by the caller that this happens only once.
|
||||||
func (m *meter) setDelegate(provider metric.MeterProvider) {
|
func (m *meter) setDelegate(provider metric.MeterProvider) {
|
||||||
meter := provider.Meter(m.name, m.opts...)
|
|
||||||
m.delegate.Store(meter)
|
|
||||||
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
meter := provider.Meter(m.name, m.opts...)
|
||||||
|
m.delegate = meter
|
||||||
|
|
||||||
for _, inst := range m.instruments {
|
for _, inst := range m.instruments {
|
||||||
inst.setDelegate(meter)
|
inst.setDelegate(meter)
|
||||||
}
|
}
|
||||||
|
|
||||||
for e := m.registry.Front(); e != nil; e = e.Next() {
|
var n *list.Element
|
||||||
|
for e := m.registry.Front(); e != nil; e = n {
|
||||||
r := e.Value.(*registration)
|
r := e.Value.(*registration)
|
||||||
r.setDelegate(meter)
|
r.setDelegate(meter)
|
||||||
|
n = e.Next()
|
||||||
m.registry.Remove(e)
|
m.registry.Remove(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,147 +145,337 @@ func (m *meter) setDelegate(provider metric.MeterProvider) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) {
|
func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Int64Counter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64Counter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64CounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*siCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64Counter), nil
|
||||||
|
}
|
||||||
i := &siCounter{name: name, opts: options}
|
i := &siCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) {
|
func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Int64UpDownCounter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64UpDownCounter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64UpDownCounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*siUpDownCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64UpDownCounter), nil
|
||||||
|
}
|
||||||
i := &siUpDownCounter{name: name, opts: options}
|
i := &siUpDownCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
|
func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Int64Histogram(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64Histogram(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64HistogramConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*siHistogram)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64Histogram), nil
|
||||||
|
}
|
||||||
i := &siHistogram{name: name, opts: options}
|
i := &siHistogram{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *meter) Int64Gauge(name string, options ...metric.Int64GaugeOption) (metric.Int64Gauge, error) {
|
||||||
|
m.mtx.Lock()
|
||||||
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64Gauge(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64GaugeConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*siGauge)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64Gauge), nil
|
||||||
|
}
|
||||||
|
i := &siGauge{name: name, opts: options}
|
||||||
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) {
|
func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Int64ObservableCounter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64ObservableCounter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64ObservableCounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*aiCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64ObservableCounter), nil
|
||||||
|
}
|
||||||
i := &aiCounter{name: name, opts: options}
|
i := &aiCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) {
|
func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Int64ObservableUpDownCounter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64ObservableUpDownCounter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64ObservableUpDownCounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*aiUpDownCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64ObservableUpDownCounter), nil
|
||||||
|
}
|
||||||
i := &aiUpDownCounter{name: name, opts: options}
|
i := &aiUpDownCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) {
|
func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Int64ObservableGauge(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Int64ObservableGauge(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewInt64ObservableGaugeConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*aiGauge)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Int64ObservableGauge), nil
|
||||||
|
}
|
||||||
i := &aiGauge{name: name, opts: options}
|
i := &aiGauge{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) {
|
func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Float64Counter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64Counter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64CounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*sfCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64Counter), nil
|
||||||
|
}
|
||||||
i := &sfCounter{name: name, opts: options}
|
i := &sfCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) {
|
func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Float64UpDownCounter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64UpDownCounter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64UpDownCounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*sfUpDownCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64UpDownCounter), nil
|
||||||
|
}
|
||||||
i := &sfUpDownCounter{name: name, opts: options}
|
i := &sfUpDownCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) {
|
func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Float64Histogram(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64Histogram(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64HistogramConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*sfHistogram)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64Histogram), nil
|
||||||
|
}
|
||||||
i := &sfHistogram{name: name, opts: options}
|
i := &sfHistogram{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
|
return i, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *meter) Float64Gauge(name string, options ...metric.Float64GaugeOption) (metric.Float64Gauge, error) {
|
||||||
|
m.mtx.Lock()
|
||||||
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64Gauge(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64GaugeConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*sfGauge)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64Gauge), nil
|
||||||
|
}
|
||||||
|
i := &sfGauge{name: name, opts: options}
|
||||||
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) {
|
func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Float64ObservableCounter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64ObservableCounter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64ObservableCounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*afCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64ObservableCounter), nil
|
||||||
|
}
|
||||||
i := &afCounter{name: name, opts: options}
|
i := &afCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) {
|
func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Float64ObservableUpDownCounter(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64ObservableUpDownCounter(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*afUpDownCounter)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64ObservableUpDownCounter), nil
|
||||||
|
}
|
||||||
i := &afUpDownCounter{name: name, opts: options}
|
i := &afUpDownCounter{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) {
|
func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
return del.Float64ObservableGauge(name, options...)
|
|
||||||
}
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
return m.delegate.Float64ObservableGauge(name, options...)
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg := metric.NewFloat64ObservableGaugeConfig(options...)
|
||||||
|
id := instID{
|
||||||
|
name: name,
|
||||||
|
kind: reflect.TypeOf((*afGauge)(nil)),
|
||||||
|
description: cfg.Description(),
|
||||||
|
unit: cfg.Unit(),
|
||||||
|
}
|
||||||
|
if f, ok := m.instruments[id]; ok {
|
||||||
|
return f.(metric.Float64ObservableGauge), nil
|
||||||
|
}
|
||||||
i := &afGauge{name: name, opts: options}
|
i := &afGauge{name: name, opts: options}
|
||||||
m.instruments = append(m.instruments, i)
|
m.instruments[id] = i
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterCallback captures the function that will be called during Collect.
|
// RegisterCallback captures the function that will be called during Collect.
|
||||||
func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) {
|
func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) {
|
||||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
|
||||||
insts = unwrapInstruments(insts)
|
|
||||||
return del.RegisterCallback(f, insts...)
|
|
||||||
}
|
|
||||||
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
if m.delegate != nil {
|
||||||
|
insts = unwrapInstruments(insts)
|
||||||
|
return m.delegate.RegisterCallback(f, insts...)
|
||||||
|
}
|
||||||
|
|
||||||
reg := ®istration{instruments: insts, function: f}
|
reg := ®istration{instruments: insts, function: f}
|
||||||
e := m.registry.PushBack(reg)
|
e := m.registry.PushBack(reg)
|
||||||
reg.unreg = func() error {
|
reg.unreg = func() error {
|
||||||
@ -335,6 +529,7 @@ func (c *registration) setDelegate(m metric.Meter) {
|
|||||||
reg, err := m.RegisterCallback(c.function, insts...)
|
reg, err := m.RegisterCallback(c.function, insts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
GetErrorHandler().Handle(err)
|
GetErrorHandler().Handle(err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.unreg = reg.Unregister
|
c.unreg = reg.Unregister
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/internal/global/propagator.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/internal/global/propagator.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
|
|||||||
73
vendor/go.opentelemetry.io/otel/internal/global/state.go
generated
vendored
73
vendor/go.opentelemetry.io/otel/internal/global/state.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
@ -25,6 +14,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
errorHandlerHolder struct {
|
||||||
|
eh ErrorHandler
|
||||||
|
}
|
||||||
|
|
||||||
tracerProviderHolder struct {
|
tracerProviderHolder struct {
|
||||||
tp trace.TracerProvider
|
tp trace.TracerProvider
|
||||||
}
|
}
|
||||||
@ -39,15 +32,59 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
globalErrorHandler = defaultErrorHandler()
|
||||||
globalTracer = defaultTracerValue()
|
globalTracer = defaultTracerValue()
|
||||||
globalPropagators = defaultPropagatorsValue()
|
globalPropagators = defaultPropagatorsValue()
|
||||||
globalMeterProvider = defaultMeterProvider()
|
globalMeterProvider = defaultMeterProvider()
|
||||||
|
|
||||||
|
delegateErrorHandlerOnce sync.Once
|
||||||
delegateTraceOnce sync.Once
|
delegateTraceOnce sync.Once
|
||||||
delegateTextMapPropagatorOnce sync.Once
|
delegateTextMapPropagatorOnce sync.Once
|
||||||
delegateMeterOnce sync.Once
|
delegateMeterOnce sync.Once
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// GetErrorHandler returns the global ErrorHandler instance.
|
||||||
|
//
|
||||||
|
// The default ErrorHandler instance returned will log all errors to STDERR
|
||||||
|
// until an override ErrorHandler is set with SetErrorHandler. All
|
||||||
|
// ErrorHandler returned prior to this will automatically forward errors to
|
||||||
|
// the set instance instead of logging.
|
||||||
|
//
|
||||||
|
// Subsequent calls to SetErrorHandler after the first will not forward errors
|
||||||
|
// to the new ErrorHandler for prior returned instances.
|
||||||
|
func GetErrorHandler() ErrorHandler {
|
||||||
|
return globalErrorHandler.Load().(errorHandlerHolder).eh
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetErrorHandler sets the global ErrorHandler to h.
|
||||||
|
//
|
||||||
|
// The first time this is called all ErrorHandler previously returned from
|
||||||
|
// GetErrorHandler will send errors to h instead of the default logging
|
||||||
|
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
|
||||||
|
// delegate errors to h.
|
||||||
|
func SetErrorHandler(h ErrorHandler) {
|
||||||
|
current := GetErrorHandler()
|
||||||
|
|
||||||
|
if _, cOk := current.(*ErrDelegator); cOk {
|
||||||
|
if _, ehOk := h.(*ErrDelegator); ehOk && current == h {
|
||||||
|
// Do not assign to the delegate of the default ErrDelegator to be
|
||||||
|
// itself.
|
||||||
|
Error(
|
||||||
|
errors.New("no ErrorHandler delegate configured"),
|
||||||
|
"ErrorHandler remains its current value.",
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delegateErrorHandlerOnce.Do(func() {
|
||||||
|
if def, ok := current.(*ErrDelegator); ok {
|
||||||
|
def.setDelegate(h)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
globalErrorHandler.Store(errorHandlerHolder{eh: h})
|
||||||
|
}
|
||||||
|
|
||||||
// TracerProvider is the internal implementation for global.TracerProvider.
|
// TracerProvider is the internal implementation for global.TracerProvider.
|
||||||
func TracerProvider() trace.TracerProvider {
|
func TracerProvider() trace.TracerProvider {
|
||||||
return globalTracer.Load().(tracerProviderHolder).tp
|
return globalTracer.Load().(tracerProviderHolder).tp
|
||||||
@ -63,7 +100,7 @@ func SetTracerProvider(tp trace.TracerProvider) {
|
|||||||
// to itself.
|
// to itself.
|
||||||
Error(
|
Error(
|
||||||
errors.New("no delegate configured in tracer provider"),
|
errors.New("no delegate configured in tracer provider"),
|
||||||
"Setting tracer provider to it's current value. No delegate will be configured",
|
"Setting tracer provider to its current value. No delegate will be configured",
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -92,7 +129,7 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) {
|
|||||||
// delegate to itself.
|
// delegate to itself.
|
||||||
Error(
|
Error(
|
||||||
errors.New("no delegate configured in text map propagator"),
|
errors.New("no delegate configured in text map propagator"),
|
||||||
"Setting text map propagator to it's current value. No delegate will be configured",
|
"Setting text map propagator to its current value. No delegate will be configured",
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -123,7 +160,7 @@ func SetMeterProvider(mp metric.MeterProvider) {
|
|||||||
// to itself.
|
// to itself.
|
||||||
Error(
|
Error(
|
||||||
errors.New("no delegate configured in meter provider"),
|
errors.New("no delegate configured in meter provider"),
|
||||||
"Setting meter provider to it's current value. No delegate will be configured",
|
"Setting meter provider to its current value. No delegate will be configured",
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -137,6 +174,12 @@ func SetMeterProvider(mp metric.MeterProvider) {
|
|||||||
globalMeterProvider.Store(meterProviderHolder{mp: mp})
|
globalMeterProvider.Store(meterProviderHolder{mp: mp})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func defaultErrorHandler() *atomic.Value {
|
||||||
|
v := &atomic.Value{}
|
||||||
|
v.Store(errorHandlerHolder{eh: &ErrDelegator{}})
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
func defaultTracerValue() *atomic.Value {
|
func defaultTracerValue() *atomic.Value {
|
||||||
v := &atomic.Value{}
|
v := &atomic.Value{}
|
||||||
v.Store(tracerProviderHolder{tp: &tracerProvider{}})
|
v.Store(tracerProviderHolder{tp: &tracerProvider{}})
|
||||||
|
|||||||
22
vendor/go.opentelemetry.io/otel/internal/global/trace.go
generated
vendored
22
vendor/go.opentelemetry.io/otel/internal/global/trace.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||||
|
|
||||||
@ -97,6 +86,7 @@ func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
|
|||||||
key := il{
|
key := il{
|
||||||
name: name,
|
name: name,
|
||||||
version: c.InstrumentationVersion(),
|
version: c.InstrumentationVersion(),
|
||||||
|
schema: c.SchemaURL(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.tracers == nil {
|
if p.tracers == nil {
|
||||||
@ -112,10 +102,7 @@ func (p *tracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
|
|||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
type il struct {
|
type il struct{ name, version, schema string }
|
||||||
name string
|
|
||||||
version string
|
|
||||||
}
|
|
||||||
|
|
||||||
// tracer is a placeholder for a trace.Tracer.
|
// tracer is a placeholder for a trace.Tracer.
|
||||||
//
|
//
|
||||||
@ -193,6 +180,9 @@ func (nonRecordingSpan) RecordError(error, ...trace.EventOption) {}
|
|||||||
// AddEvent does nothing.
|
// AddEvent does nothing.
|
||||||
func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {}
|
func (nonRecordingSpan) AddEvent(string, ...trace.EventOption) {}
|
||||||
|
|
||||||
|
// AddLink does nothing.
|
||||||
|
func (nonRecordingSpan) AddLink(trace.Link) {}
|
||||||
|
|
||||||
// SetName does nothing.
|
// SetName does nothing.
|
||||||
func (nonRecordingSpan) SetName(string) {}
|
func (nonRecordingSpan) SetName(string) {}
|
||||||
|
|
||||||
|
|||||||
25
vendor/go.opentelemetry.io/otel/internal/rawhelpers.go
generated
vendored
25
vendor/go.opentelemetry.io/otel/internal/rawhelpers.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package internal // import "go.opentelemetry.io/otel/internal"
|
package internal // import "go.opentelemetry.io/otel/internal"
|
||||||
|
|
||||||
@ -31,11 +20,13 @@ func RawToBool(r uint64) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Int64ToRaw(i int64) uint64 {
|
func Int64ToRaw(i int64) uint64 {
|
||||||
return uint64(i)
|
// Assumes original was a valid int64 (overflow not checked).
|
||||||
|
return uint64(i) // nolint: gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
func RawToInt64(r uint64) int64 {
|
func RawToInt64(r uint64) int64 {
|
||||||
return int64(r)
|
// Assumes original was a valid int64 (overflow not checked).
|
||||||
|
return int64(r) // nolint: gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
func Float64ToRaw(f float64) uint64 {
|
func Float64ToRaw(f float64) uint64 {
|
||||||
@ -47,9 +38,11 @@ func RawToFloat64(r uint64) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RawPtrToFloat64Ptr(r *uint64) *float64 {
|
func RawPtrToFloat64Ptr(r *uint64) *float64 {
|
||||||
return (*float64)(unsafe.Pointer(r))
|
// Assumes original was a valid *float64 (overflow not checked).
|
||||||
|
return (*float64)(unsafe.Pointer(r)) // nolint: gosec
|
||||||
}
|
}
|
||||||
|
|
||||||
func RawPtrToInt64Ptr(r *uint64) *int64 {
|
func RawPtrToInt64Ptr(r *uint64) *int64 {
|
||||||
return (*int64)(unsafe.Pointer(r))
|
// Assumes original was a valid *int64 (overflow not checked).
|
||||||
|
return (*int64)(unsafe.Pointer(r)) // nolint: gosec
|
||||||
}
|
}
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/internal_logging.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/internal_logging.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package otel // import "go.opentelemetry.io/otel"
|
package otel // import "go.opentelemetry.io/otel"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/metric.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/metric.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package otel // import "go.opentelemetry.io/otel"
|
package otel // import "go.opentelemetry.io/otel"
|
||||||
|
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/metric/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/metric/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Metric API
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/metric)
|
||||||
21
vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go
generated
vendored
21
vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
@ -50,7 +39,7 @@ type Float64ObservableCounter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Float64ObservableCounterConfig contains options for asynchronous counter
|
// Float64ObservableCounterConfig contains options for asynchronous counter
|
||||||
// instruments that record int64 values.
|
// instruments that record float64 values.
|
||||||
type Float64ObservableCounterConfig struct {
|
type Float64ObservableCounterConfig struct {
|
||||||
description string
|
description string
|
||||||
unit string
|
unit string
|
||||||
@ -108,7 +97,7 @@ type Float64ObservableUpDownCounter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Float64ObservableUpDownCounterConfig contains options for asynchronous
|
// Float64ObservableUpDownCounterConfig contains options for asynchronous
|
||||||
// counter instruments that record int64 values.
|
// counter instruments that record float64 values.
|
||||||
type Float64ObservableUpDownCounterConfig struct {
|
type Float64ObservableUpDownCounterConfig struct {
|
||||||
description string
|
description string
|
||||||
unit string
|
unit string
|
||||||
@ -165,7 +154,7 @@ type Float64ObservableGauge interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Float64ObservableGaugeConfig contains options for asynchronous counter
|
// Float64ObservableGaugeConfig contains options for asynchronous counter
|
||||||
// instruments that record int64 values.
|
// instruments that record float64 values.
|
||||||
type Float64ObservableGaugeConfig struct {
|
type Float64ObservableGaugeConfig struct {
|
||||||
description string
|
description string
|
||||||
unit string
|
unit string
|
||||||
@ -224,7 +213,7 @@ type Float64Observer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Float64Callback is a function registered with a Meter that makes
|
// Float64Callback is a function registered with a Meter that makes
|
||||||
// observations for a Float64Observerable instrument it is registered with.
|
// observations for a Float64Observable instrument it is registered with.
|
||||||
// Calls to the Float64Observer record measurement values for the
|
// Calls to the Float64Observer record measurement values for the
|
||||||
// Float64Observable.
|
// Float64Observable.
|
||||||
//
|
//
|
||||||
|
|||||||
15
vendor/go.opentelemetry.io/otel/metric/asyncint64.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/metric/asyncint64.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
@ -223,7 +212,7 @@ type Int64Observer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Int64Callback is a function registered with a Meter that makes observations
|
// Int64Callback is a function registered with a Meter that makes observations
|
||||||
// for an Int64Observerable instrument it is registered with. Calls to the
|
// for an Int64Observable instrument it is registered with. Calls to the
|
||||||
// Int64Observer record measurement values for the Int64Observable.
|
// Int64Observer record measurement values for the Int64Observable.
|
||||||
//
|
//
|
||||||
// The function needs to complete in a finite amount of time and the deadline
|
// The function needs to complete in a finite amount of time and the deadline
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
|
|||||||
31
vendor/go.opentelemetry.io/otel/metric/doc.go
generated
vendored
31
vendor/go.opentelemetry.io/otel/metric/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package metric provides the OpenTelemetry API used to measure metrics about
|
Package metric provides the OpenTelemetry API used to measure metrics about
|
||||||
@ -68,6 +57,23 @@ asynchronous measurement, a Gauge ([Int64ObservableGauge] and
|
|||||||
See the [OpenTelemetry documentation] for more information about instruments
|
See the [OpenTelemetry documentation] for more information about instruments
|
||||||
and their intended use.
|
and their intended use.
|
||||||
|
|
||||||
|
# Instrument Name
|
||||||
|
|
||||||
|
OpenTelemetry defines an [instrument name syntax] that restricts what
|
||||||
|
instrument names are allowed.
|
||||||
|
|
||||||
|
Instrument names should ...
|
||||||
|
|
||||||
|
- Not be empty.
|
||||||
|
- Have an alphabetic character as their first letter.
|
||||||
|
- Have any letter after the first be an alphanumeric character, ‘_’, ‘.’,
|
||||||
|
‘-’, or ‘/’.
|
||||||
|
- Have a maximum length of 255 letters.
|
||||||
|
|
||||||
|
To ensure compatibility with observability platforms, all instruments created
|
||||||
|
need to conform to this syntax. Not all implementations of the API will validate
|
||||||
|
these names, it is the callers responsibility to ensure compliance.
|
||||||
|
|
||||||
# Measurements
|
# Measurements
|
||||||
|
|
||||||
Measurements are made by recording values and information about the values with
|
Measurements are made by recording values and information about the values with
|
||||||
@ -164,6 +170,7 @@ It is strongly recommended that authors only embed
|
|||||||
That implementation is the only one OpenTelemetry authors can guarantee will
|
That implementation is the only one OpenTelemetry authors can guarantee will
|
||||||
fully implement all the API interfaces when a user updates their API.
|
fully implement all the API interfaces when a user updates their API.
|
||||||
|
|
||||||
|
[instrument name syntax]: https://opentelemetry.io/docs/specs/otel/metrics/api/#instrument-name-syntax
|
||||||
[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/
|
[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/
|
||||||
[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider
|
[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider
|
||||||
*/
|
*/
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/metric/embedded/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/metric/embedded/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Metric Embedded
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/metric/embedded)
|
||||||
33
vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go
generated
vendored
33
vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// Package embedded provides interfaces embedded within the [OpenTelemetry
|
// Package embedded provides interfaces embedded within the [OpenTelemetry
|
||||||
// metric API].
|
// metric API].
|
||||||
@ -113,6 +102,16 @@ type Float64Counter interface{ float64Counter() }
|
|||||||
// the API package).
|
// the API package).
|
||||||
type Float64Histogram interface{ float64Histogram() }
|
type Float64Histogram interface{ float64Histogram() }
|
||||||
|
|
||||||
|
// Float64Gauge is embedded in [go.opentelemetry.io/otel/metric.Float64Gauge].
|
||||||
|
//
|
||||||
|
// Embed this interface in your implementation of the
|
||||||
|
// [go.opentelemetry.io/otel/metric.Float64Gauge] if you want users to
|
||||||
|
// experience a compilation error, signaling they need to update to your latest
|
||||||
|
// implementation, when the [go.opentelemetry.io/otel/metric.Float64Gauge]
|
||||||
|
// interface is extended (which is something that can happen without a major
|
||||||
|
// version bump of the API package).
|
||||||
|
type Float64Gauge interface{ float64Gauge() }
|
||||||
|
|
||||||
// Float64ObservableCounter is embedded in
|
// Float64ObservableCounter is embedded in
|
||||||
// [go.opentelemetry.io/otel/metric.Float64ObservableCounter].
|
// [go.opentelemetry.io/otel/metric.Float64ObservableCounter].
|
||||||
//
|
//
|
||||||
@ -185,6 +184,16 @@ type Int64Counter interface{ int64Counter() }
|
|||||||
// the API package).
|
// the API package).
|
||||||
type Int64Histogram interface{ int64Histogram() }
|
type Int64Histogram interface{ int64Histogram() }
|
||||||
|
|
||||||
|
// Int64Gauge is embedded in [go.opentelemetry.io/otel/metric.Int64Gauge].
|
||||||
|
//
|
||||||
|
// Embed this interface in your implementation of the
|
||||||
|
// [go.opentelemetry.io/otel/metric.Int64Gauge] if you want users to experience
|
||||||
|
// a compilation error, signaling they need to update to your latest
|
||||||
|
// implementation, when the [go.opentelemetry.io/otel/metric.Int64Gauge]
|
||||||
|
// interface is extended (which is something that can happen without a major
|
||||||
|
// version bump of the API package).
|
||||||
|
type Int64Gauge interface{ int64Gauge() }
|
||||||
|
|
||||||
// Int64ObservableCounter is embedded in
|
// Int64ObservableCounter is embedded in
|
||||||
// [go.opentelemetry.io/otel/metric.Int64ObservableCounter].
|
// [go.opentelemetry.io/otel/metric.Int64ObservableCounter].
|
||||||
//
|
//
|
||||||
|
|||||||
37
vendor/go.opentelemetry.io/otel/metric/instrument.go
generated
vendored
37
vendor/go.opentelemetry.io/otel/metric/instrument.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
@ -27,6 +16,7 @@ type InstrumentOption interface {
|
|||||||
Int64CounterOption
|
Int64CounterOption
|
||||||
Int64UpDownCounterOption
|
Int64UpDownCounterOption
|
||||||
Int64HistogramOption
|
Int64HistogramOption
|
||||||
|
Int64GaugeOption
|
||||||
Int64ObservableCounterOption
|
Int64ObservableCounterOption
|
||||||
Int64ObservableUpDownCounterOption
|
Int64ObservableUpDownCounterOption
|
||||||
Int64ObservableGaugeOption
|
Int64ObservableGaugeOption
|
||||||
@ -34,6 +24,7 @@ type InstrumentOption interface {
|
|||||||
Float64CounterOption
|
Float64CounterOption
|
||||||
Float64UpDownCounterOption
|
Float64UpDownCounterOption
|
||||||
Float64HistogramOption
|
Float64HistogramOption
|
||||||
|
Float64GaugeOption
|
||||||
Float64ObservableCounterOption
|
Float64ObservableCounterOption
|
||||||
Float64ObservableUpDownCounterOption
|
Float64ObservableUpDownCounterOption
|
||||||
Float64ObservableGaugeOption
|
Float64ObservableGaugeOption
|
||||||
@ -62,6 +53,11 @@ func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64Histogra
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o descOpt) applyFloat64Gauge(c Float64GaugeConfig) Float64GaugeConfig {
|
||||||
|
c.description = string(o)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
||||||
c.description = string(o)
|
c.description = string(o)
|
||||||
return c
|
return c
|
||||||
@ -92,6 +88,11 @@ func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfi
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o descOpt) applyInt64Gauge(c Int64GaugeConfig) Int64GaugeConfig {
|
||||||
|
c.description = string(o)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
||||||
c.description = string(o)
|
c.description = string(o)
|
||||||
return c
|
return c
|
||||||
@ -127,6 +128,11 @@ func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64Histogra
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o unitOpt) applyFloat64Gauge(c Float64GaugeConfig) Float64GaugeConfig {
|
||||||
|
c.unit = string(o)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
||||||
c.unit = string(o)
|
c.unit = string(o)
|
||||||
return c
|
return c
|
||||||
@ -157,6 +163,11 @@ func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfi
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (o unitOpt) applyInt64Gauge(c Int64GaugeConfig) Int64GaugeConfig {
|
||||||
|
c.unit = string(o)
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
||||||
c.unit = string(o)
|
c.unit = string(o)
|
||||||
return c
|
return c
|
||||||
@ -340,7 +351,7 @@ func WithAttributeSet(attributes attribute.Set) MeasurementOption {
|
|||||||
//
|
//
|
||||||
// cp := make([]attribute.KeyValue, len(attributes))
|
// cp := make([]attribute.KeyValue, len(attributes))
|
||||||
// copy(cp, attributes)
|
// copy(cp, attributes)
|
||||||
// WithAttributes(attribute.NewSet(cp...))
|
// WithAttributeSet(attribute.NewSet(cp...))
|
||||||
//
|
//
|
||||||
// [attribute.NewSet] may modify the passed attributes so this will make a copy
|
// [attribute.NewSet] may modify the passed attributes so this will make a copy
|
||||||
// of attributes before creating a set in order to ensure this function is
|
// of attributes before creating a set in order to ensure this function is
|
||||||
|
|||||||
90
vendor/go.opentelemetry.io/otel/metric/meter.go
generated
vendored
90
vendor/go.opentelemetry.io/otel/metric/meter.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
@ -58,17 +47,41 @@ type Meter interface {
|
|||||||
// Int64Counter returns a new Int64Counter instrument identified by name
|
// Int64Counter returns a new Int64Counter instrument identified by name
|
||||||
// and configured with options. The instrument is used to synchronously
|
// and configured with options. The instrument is used to synchronously
|
||||||
// record increasing int64 measurements during a computational operation.
|
// record increasing int64 measurements during a computational operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
|
Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
|
||||||
|
|
||||||
// Int64UpDownCounter returns a new Int64UpDownCounter instrument
|
// Int64UpDownCounter returns a new Int64UpDownCounter instrument
|
||||||
// identified by name and configured with options. The instrument is used
|
// identified by name and configured with options. The instrument is used
|
||||||
// to synchronously record int64 measurements during a computational
|
// to synchronously record int64 measurements during a computational
|
||||||
// operation.
|
// operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
|
Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
|
||||||
|
|
||||||
// Int64Histogram returns a new Int64Histogram instrument identified by
|
// Int64Histogram returns a new Int64Histogram instrument identified by
|
||||||
// name and configured with options. The instrument is used to
|
// name and configured with options. The instrument is used to
|
||||||
// synchronously record the distribution of int64 measurements during a
|
// synchronously record the distribution of int64 measurements during a
|
||||||
// computational operation.
|
// computational operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
|
Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
|
||||||
|
|
||||||
|
// Int64Gauge returns a new Int64Gauge instrument identified by name and
|
||||||
|
// configured with options. The instrument is used to synchronously record
|
||||||
|
// instantaneous int64 measurements during a computational operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
|
Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error)
|
||||||
|
|
||||||
// Int64ObservableCounter returns a new Int64ObservableCounter identified
|
// Int64ObservableCounter returns a new Int64ObservableCounter identified
|
||||||
// by name and configured with options. The instrument is used to
|
// by name and configured with options. The instrument is used to
|
||||||
// asynchronously record increasing int64 measurements once per a
|
// asynchronously record increasing int64 measurements once per a
|
||||||
@ -78,7 +91,12 @@ type Meter interface {
|
|||||||
// the WithInt64Callback option to register the callback here, or use the
|
// the WithInt64Callback option to register the callback here, or use the
|
||||||
// RegisterCallback method of this Meter to register one later. See the
|
// RegisterCallback method of this Meter to register one later. See the
|
||||||
// Measurements section of the package documentation for more information.
|
// Measurements section of the package documentation for more information.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
|
Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
|
||||||
|
|
||||||
// Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter
|
// Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter
|
||||||
// instrument identified by name and configured with options. The
|
// instrument identified by name and configured with options. The
|
||||||
// instrument is used to asynchronously record int64 measurements once per
|
// instrument is used to asynchronously record int64 measurements once per
|
||||||
@ -88,7 +106,12 @@ type Meter interface {
|
|||||||
// the WithInt64Callback option to register the callback here, or use the
|
// the WithInt64Callback option to register the callback here, or use the
|
||||||
// RegisterCallback method of this Meter to register one later. See the
|
// RegisterCallback method of this Meter to register one later. See the
|
||||||
// Measurements section of the package documentation for more information.
|
// Measurements section of the package documentation for more information.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
|
Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
|
||||||
|
|
||||||
// Int64ObservableGauge returns a new Int64ObservableGauge instrument
|
// Int64ObservableGauge returns a new Int64ObservableGauge instrument
|
||||||
// identified by name and configured with options. The instrument is used
|
// identified by name and configured with options. The instrument is used
|
||||||
// to asynchronously record instantaneous int64 measurements once per a
|
// to asynchronously record instantaneous int64 measurements once per a
|
||||||
@ -98,23 +121,51 @@ type Meter interface {
|
|||||||
// the WithInt64Callback option to register the callback here, or use the
|
// the WithInt64Callback option to register the callback here, or use the
|
||||||
// RegisterCallback method of this Meter to register one later. See the
|
// RegisterCallback method of this Meter to register one later. See the
|
||||||
// Measurements section of the package documentation for more information.
|
// Measurements section of the package documentation for more information.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
|
Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
|
||||||
|
|
||||||
// Float64Counter returns a new Float64Counter instrument identified by
|
// Float64Counter returns a new Float64Counter instrument identified by
|
||||||
// name and configured with options. The instrument is used to
|
// name and configured with options. The instrument is used to
|
||||||
// synchronously record increasing float64 measurements during a
|
// synchronously record increasing float64 measurements during a
|
||||||
// computational operation.
|
// computational operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error)
|
Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error)
|
||||||
|
|
||||||
// Float64UpDownCounter returns a new Float64UpDownCounter instrument
|
// Float64UpDownCounter returns a new Float64UpDownCounter instrument
|
||||||
// identified by name and configured with options. The instrument is used
|
// identified by name and configured with options. The instrument is used
|
||||||
// to synchronously record float64 measurements during a computational
|
// to synchronously record float64 measurements during a computational
|
||||||
// operation.
|
// operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
|
Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
|
||||||
|
|
||||||
// Float64Histogram returns a new Float64Histogram instrument identified by
|
// Float64Histogram returns a new Float64Histogram instrument identified by
|
||||||
// name and configured with options. The instrument is used to
|
// name and configured with options. The instrument is used to
|
||||||
// synchronously record the distribution of float64 measurements during a
|
// synchronously record the distribution of float64 measurements during a
|
||||||
// computational operation.
|
// computational operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
|
Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
|
||||||
|
|
||||||
|
// Float64Gauge returns a new Float64Gauge instrument identified by name and
|
||||||
|
// configured with options. The instrument is used to synchronously record
|
||||||
|
// instantaneous float64 measurements during a computational operation.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
|
Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error)
|
||||||
|
|
||||||
// Float64ObservableCounter returns a new Float64ObservableCounter
|
// Float64ObservableCounter returns a new Float64ObservableCounter
|
||||||
// instrument identified by name and configured with options. The
|
// instrument identified by name and configured with options. The
|
||||||
// instrument is used to asynchronously record increasing float64
|
// instrument is used to asynchronously record increasing float64
|
||||||
@ -124,7 +175,12 @@ type Meter interface {
|
|||||||
// the WithFloat64Callback option to register the callback here, or use the
|
// the WithFloat64Callback option to register the callback here, or use the
|
||||||
// RegisterCallback method of this Meter to register one later. See the
|
// RegisterCallback method of this Meter to register one later. See the
|
||||||
// Measurements section of the package documentation for more information.
|
// Measurements section of the package documentation for more information.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
|
Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
|
||||||
|
|
||||||
// Float64ObservableUpDownCounter returns a new
|
// Float64ObservableUpDownCounter returns a new
|
||||||
// Float64ObservableUpDownCounter instrument identified by name and
|
// Float64ObservableUpDownCounter instrument identified by name and
|
||||||
// configured with options. The instrument is used to asynchronously record
|
// configured with options. The instrument is used to asynchronously record
|
||||||
@ -134,7 +190,12 @@ type Meter interface {
|
|||||||
// the WithFloat64Callback option to register the callback here, or use the
|
// the WithFloat64Callback option to register the callback here, or use the
|
||||||
// RegisterCallback method of this Meter to register one later. See the
|
// RegisterCallback method of this Meter to register one later. See the
|
||||||
// Measurements section of the package documentation for more information.
|
// Measurements section of the package documentation for more information.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
|
Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
|
||||||
|
|
||||||
// Float64ObservableGauge returns a new Float64ObservableGauge instrument
|
// Float64ObservableGauge returns a new Float64ObservableGauge instrument
|
||||||
// identified by name and configured with options. The instrument is used
|
// identified by name and configured with options. The instrument is used
|
||||||
// to asynchronously record instantaneous float64 measurements once per a
|
// to asynchronously record instantaneous float64 measurements once per a
|
||||||
@ -144,6 +205,10 @@ type Meter interface {
|
|||||||
// the WithFloat64Callback option to register the callback here, or use the
|
// the WithFloat64Callback option to register the callback here, or use the
|
||||||
// RegisterCallback method of this Meter to register one later. See the
|
// RegisterCallback method of this Meter to register one later. See the
|
||||||
// Measurements section of the package documentation for more information.
|
// Measurements section of the package documentation for more information.
|
||||||
|
//
|
||||||
|
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||||
|
// See the Instrument Name section of the package documentation for more
|
||||||
|
// information.
|
||||||
Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
|
Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
|
||||||
|
|
||||||
// RegisterCallback registers f to be called during the collection of a
|
// RegisterCallback registers f to be called during the collection of a
|
||||||
@ -189,6 +254,7 @@ type Observer interface {
|
|||||||
|
|
||||||
// ObserveFloat64 records the float64 value for obsrv.
|
// ObserveFloat64 records the float64 value for obsrv.
|
||||||
ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
|
ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
|
||||||
|
|
||||||
// ObserveInt64 records the int64 value for obsrv.
|
// ObserveInt64 records the int64 value for obsrv.
|
||||||
ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
|
ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
|
||||||
}
|
}
|
||||||
|
|||||||
73
vendor/go.opentelemetry.io/otel/metric/syncfloat64.go
generated
vendored
73
vendor/go.opentelemetry.io/otel/metric/syncfloat64.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
@ -39,7 +28,7 @@ type Float64Counter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Float64CounterConfig contains options for synchronous counter instruments that
|
// Float64CounterConfig contains options for synchronous counter instruments that
|
||||||
// record int64 values.
|
// record float64 values.
|
||||||
type Float64CounterConfig struct {
|
type Float64CounterConfig struct {
|
||||||
description string
|
description string
|
||||||
unit string
|
unit string
|
||||||
@ -92,7 +81,7 @@ type Float64UpDownCounter interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Float64UpDownCounterConfig contains options for synchronous counter
|
// Float64UpDownCounterConfig contains options for synchronous counter
|
||||||
// instruments that record int64 values.
|
// instruments that record float64 values.
|
||||||
type Float64UpDownCounterConfig struct {
|
type Float64UpDownCounterConfig struct {
|
||||||
description string
|
description string
|
||||||
unit string
|
unit string
|
||||||
@ -144,8 +133,8 @@ type Float64Histogram interface {
|
|||||||
Record(ctx context.Context, incr float64, options ...RecordOption)
|
Record(ctx context.Context, incr float64, options ...RecordOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float64HistogramConfig contains options for synchronous counter instruments
|
// Float64HistogramConfig contains options for synchronous histogram
|
||||||
// that record int64 values.
|
// instruments that record float64 values.
|
||||||
type Float64HistogramConfig struct {
|
type Float64HistogramConfig struct {
|
||||||
description string
|
description string
|
||||||
unit string
|
unit string
|
||||||
@ -183,3 +172,55 @@ func (c Float64HistogramConfig) ExplicitBucketBoundaries() []float64 {
|
|||||||
type Float64HistogramOption interface {
|
type Float64HistogramOption interface {
|
||||||
applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig
|
applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Float64Gauge is an instrument that records instantaneous float64 values.
|
||||||
|
//
|
||||||
|
// Warning: Methods may be added to this interface in minor releases. See
|
||||||
|
// package documentation on API implementation for information on how to set
|
||||||
|
// default behavior for unimplemented methods.
|
||||||
|
type Float64Gauge interface {
|
||||||
|
// Users of the interface can ignore this. This embedded type is only used
|
||||||
|
// by implementations of this interface. See the "API Implementations"
|
||||||
|
// section of the package documentation for more information.
|
||||||
|
embedded.Float64Gauge
|
||||||
|
|
||||||
|
// Record records the instantaneous value.
|
||||||
|
//
|
||||||
|
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||||
|
// the WithAttributes) option to include measurement attributes.
|
||||||
|
Record(ctx context.Context, value float64, options ...RecordOption)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64GaugeConfig contains options for synchronous gauge instruments that
|
||||||
|
// record float64 values.
|
||||||
|
type Float64GaugeConfig struct {
|
||||||
|
description string
|
||||||
|
unit string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewFloat64GaugeConfig returns a new [Float64GaugeConfig] with all opts
|
||||||
|
// applied.
|
||||||
|
func NewFloat64GaugeConfig(opts ...Float64GaugeOption) Float64GaugeConfig {
|
||||||
|
var config Float64GaugeConfig
|
||||||
|
for _, o := range opts {
|
||||||
|
config = o.applyFloat64Gauge(config)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description returns the configured description.
|
||||||
|
func (c Float64GaugeConfig) Description() string {
|
||||||
|
return c.description
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unit returns the configured unit.
|
||||||
|
func (c Float64GaugeConfig) Unit() string {
|
||||||
|
return c.unit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Float64GaugeOption applies options to a [Float64GaugeConfig]. See
|
||||||
|
// [InstrumentOption] for other options that can be used as a
|
||||||
|
// Float64GaugeOption.
|
||||||
|
type Float64GaugeOption interface {
|
||||||
|
applyFloat64Gauge(Float64GaugeConfig) Float64GaugeConfig
|
||||||
|
}
|
||||||
|
|||||||
67
vendor/go.opentelemetry.io/otel/metric/syncint64.go
generated
vendored
67
vendor/go.opentelemetry.io/otel/metric/syncint64.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package metric // import "go.opentelemetry.io/otel/metric"
|
package metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
@ -144,7 +133,7 @@ type Int64Histogram interface {
|
|||||||
Record(ctx context.Context, incr int64, options ...RecordOption)
|
Record(ctx context.Context, incr int64, options ...RecordOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Int64HistogramConfig contains options for synchronous counter instruments
|
// Int64HistogramConfig contains options for synchronous histogram instruments
|
||||||
// that record int64 values.
|
// that record int64 values.
|
||||||
type Int64HistogramConfig struct {
|
type Int64HistogramConfig struct {
|
||||||
description string
|
description string
|
||||||
@ -183,3 +172,55 @@ func (c Int64HistogramConfig) ExplicitBucketBoundaries() []float64 {
|
|||||||
type Int64HistogramOption interface {
|
type Int64HistogramOption interface {
|
||||||
applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig
|
applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Int64Gauge is an instrument that records instantaneous int64 values.
|
||||||
|
//
|
||||||
|
// Warning: Methods may be added to this interface in minor releases. See
|
||||||
|
// package documentation on API implementation for information on how to set
|
||||||
|
// default behavior for unimplemented methods.
|
||||||
|
type Int64Gauge interface {
|
||||||
|
// Users of the interface can ignore this. This embedded type is only used
|
||||||
|
// by implementations of this interface. See the "API Implementations"
|
||||||
|
// section of the package documentation for more information.
|
||||||
|
embedded.Int64Gauge
|
||||||
|
|
||||||
|
// Record records the instantaneous value.
|
||||||
|
//
|
||||||
|
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||||
|
// the WithAttributes) option to include measurement attributes.
|
||||||
|
Record(ctx context.Context, value int64, options ...RecordOption)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64GaugeConfig contains options for synchronous gauge instruments that
|
||||||
|
// record int64 values.
|
||||||
|
type Int64GaugeConfig struct {
|
||||||
|
description string
|
||||||
|
unit string
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInt64GaugeConfig returns a new [Int64GaugeConfig] with all opts
|
||||||
|
// applied.
|
||||||
|
func NewInt64GaugeConfig(opts ...Int64GaugeOption) Int64GaugeConfig {
|
||||||
|
var config Int64GaugeConfig
|
||||||
|
for _, o := range opts {
|
||||||
|
config = o.applyInt64Gauge(config)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description returns the configured description.
|
||||||
|
func (c Int64GaugeConfig) Description() string {
|
||||||
|
return c.description
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unit returns the configured unit.
|
||||||
|
func (c Int64GaugeConfig) Unit() string {
|
||||||
|
return c.unit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Int64GaugeOption applies options to a [Int64GaugeConfig]. See
|
||||||
|
// [InstrumentOption] for other options that can be used as a
|
||||||
|
// Int64GaugeOption.
|
||||||
|
type Int64GaugeOption interface {
|
||||||
|
applyInt64Gauge(Int64GaugeConfig) Int64GaugeConfig
|
||||||
|
}
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/propagation.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/propagation.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package otel // import "go.opentelemetry.io/otel"
|
package otel // import "go.opentelemetry.io/otel"
|
||||||
|
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/propagation/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/propagation/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Propagation
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/propagation)
|
||||||
13
vendor/go.opentelemetry.io/otel/propagation/baggage.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/propagation/baggage.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package propagation // import "go.opentelemetry.io/otel/propagation"
|
package propagation // import "go.opentelemetry.io/otel/propagation"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/propagation/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/propagation/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Package propagation contains OpenTelemetry context propagators.
|
Package propagation contains OpenTelemetry context propagators.
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/propagation/propagation.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/propagation/propagation.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package propagation // import "go.opentelemetry.io/otel/propagation"
|
package propagation // import "go.opentelemetry.io/otel/propagation"
|
||||||
|
|
||||||
|
|||||||
111
vendor/go.opentelemetry.io/otel/propagation/trace_context.go
generated
vendored
111
vendor/go.opentelemetry.io/otel/propagation/trace_context.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package propagation // import "go.opentelemetry.io/otel/propagation"
|
package propagation // import "go.opentelemetry.io/otel/propagation"
|
||||||
|
|
||||||
@ -18,7 +7,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"strings"
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
)
|
)
|
||||||
@ -28,6 +17,7 @@ const (
|
|||||||
maxVersion = 254
|
maxVersion = 254
|
||||||
traceparentHeader = "traceparent"
|
traceparentHeader = "traceparent"
|
||||||
tracestateHeader = "tracestate"
|
tracestateHeader = "tracestate"
|
||||||
|
delimiter = "-"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TraceContext is a propagator that supports the W3C Trace Context format
|
// TraceContext is a propagator that supports the W3C Trace Context format
|
||||||
@ -41,11 +31,11 @@ const (
|
|||||||
type TraceContext struct{}
|
type TraceContext struct{}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
_ TextMapPropagator = TraceContext{}
|
_ TextMapPropagator = TraceContext{}
|
||||||
traceCtxRegExp = regexp.MustCompile("^(?P<version>[0-9a-f]{2})-(?P<traceID>[a-f0-9]{32})-(?P<spanID>[a-f0-9]{16})-(?P<traceFlags>[a-f0-9]{2})(?:-.*)?$")
|
versionPart = fmt.Sprintf("%.2X", supportedVersion)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Inject set tracecontext from the Context into the carrier.
|
// Inject injects the trace context from ctx into carrier.
|
||||||
func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
|
func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
|
||||||
sc := trace.SpanContextFromContext(ctx)
|
sc := trace.SpanContextFromContext(ctx)
|
||||||
if !sc.IsValid() {
|
if !sc.IsValid() {
|
||||||
@ -59,12 +49,19 @@ func (tc TraceContext) Inject(ctx context.Context, carrier TextMapCarrier) {
|
|||||||
// Clear all flags other than the trace-context supported sampling bit.
|
// Clear all flags other than the trace-context supported sampling bit.
|
||||||
flags := sc.TraceFlags() & trace.FlagsSampled
|
flags := sc.TraceFlags() & trace.FlagsSampled
|
||||||
|
|
||||||
h := fmt.Sprintf("%.2x-%s-%s-%s",
|
var sb strings.Builder
|
||||||
supportedVersion,
|
sb.Grow(2 + 32 + 16 + 2 + 3)
|
||||||
sc.TraceID(),
|
_, _ = sb.WriteString(versionPart)
|
||||||
sc.SpanID(),
|
traceID := sc.TraceID()
|
||||||
flags)
|
spanID := sc.SpanID()
|
||||||
carrier.Set(traceparentHeader, h)
|
flagByte := [1]byte{byte(flags)}
|
||||||
|
var buf [32]byte
|
||||||
|
for _, src := range [][]byte{traceID[:], spanID[:], flagByte[:]} {
|
||||||
|
_ = sb.WriteByte(delimiter[0])
|
||||||
|
n := hex.Encode(buf[:], src)
|
||||||
|
_, _ = sb.Write(buf[:n])
|
||||||
|
}
|
||||||
|
carrier.Set(traceparentHeader, sb.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract reads tracecontext from the carrier into a returned Context.
|
// Extract reads tracecontext from the carrier into a returned Context.
|
||||||
@ -86,21 +83,8 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
|||||||
return trace.SpanContext{}
|
return trace.SpanContext{}
|
||||||
}
|
}
|
||||||
|
|
||||||
matches := traceCtxRegExp.FindStringSubmatch(h)
|
var ver [1]byte
|
||||||
|
if !extractPart(ver[:], &h, 2) {
|
||||||
if len(matches) == 0 {
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(matches) < 5 { // four subgroups plus the overall match
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(matches[1]) != 2 {
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
ver, err := hex.DecodeString(matches[1])
|
|
||||||
if err != nil {
|
|
||||||
return trace.SpanContext{}
|
return trace.SpanContext{}
|
||||||
}
|
}
|
||||||
version := int(ver[0])
|
version := int(ver[0])
|
||||||
@ -108,36 +92,24 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
|||||||
return trace.SpanContext{}
|
return trace.SpanContext{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if version == 0 && len(matches) != 5 { // four subgroups plus the overall match
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(matches[2]) != 32 {
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
|
|
||||||
var scc trace.SpanContextConfig
|
var scc trace.SpanContextConfig
|
||||||
|
if !extractPart(scc.TraceID[:], &h, 32) {
|
||||||
scc.TraceID, err = trace.TraceIDFromHex(matches[2][:32])
|
return trace.SpanContext{}
|
||||||
if err != nil {
|
}
|
||||||
|
if !extractPart(scc.SpanID[:], &h, 16) {
|
||||||
return trace.SpanContext{}
|
return trace.SpanContext{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(matches[3]) != 16 {
|
var opts [1]byte
|
||||||
|
if !extractPart(opts[:], &h, 2) {
|
||||||
return trace.SpanContext{}
|
return trace.SpanContext{}
|
||||||
}
|
}
|
||||||
scc.SpanID, err = trace.SpanIDFromHex(matches[3])
|
if version == 0 && (h != "" || opts[0] > 2) {
|
||||||
if err != nil {
|
// version 0 not allow extra
|
||||||
|
// version 0 not allow other flag
|
||||||
return trace.SpanContext{}
|
return trace.SpanContext{}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(matches[4]) != 2 {
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
opts, err := hex.DecodeString(matches[4])
|
|
||||||
if err != nil || len(opts) < 1 || (version == 0 && opts[0] > 2) {
|
|
||||||
return trace.SpanContext{}
|
|
||||||
}
|
|
||||||
// Clear all flags other than the trace-context supported sampling bit.
|
// Clear all flags other than the trace-context supported sampling bit.
|
||||||
scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled
|
scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled
|
||||||
|
|
||||||
@ -155,6 +127,29 @@ func (tc TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
|||||||
return sc
|
return sc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// upperHex detect hex is upper case Unicode characters.
|
||||||
|
func upperHex(v string) bool {
|
||||||
|
for _, c := range v {
|
||||||
|
if c >= 'A' && c <= 'F' {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func extractPart(dst []byte, h *string, n int) bool {
|
||||||
|
part, left, _ := strings.Cut(*h, delimiter)
|
||||||
|
*h = left
|
||||||
|
// hex.Decode decodes unsupported upper-case characters, so exclude explicitly.
|
||||||
|
if len(part) != n || upperHex(part) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if p, err := hex.Decode(dst, []byte(part)); err != nil || p != n/2 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Fields returns the keys who's values are set with Inject.
|
// Fields returns the keys who's values are set with Inject.
|
||||||
func (tc TraceContext) Fields() []string {
|
func (tc TraceContext) Fields() []string {
|
||||||
return []string{traceparentHeader, tracestateHeader}
|
return []string{traceparentHeader, tracestateHeader}
|
||||||
|
|||||||
32
vendor/go.opentelemetry.io/otel/renovate.json
generated
vendored
Normal file
32
vendor/go.opentelemetry.io/otel/renovate.json
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:recommended"
|
||||||
|
],
|
||||||
|
"ignorePaths": [],
|
||||||
|
"labels": ["Skip Changelog", "dependencies"],
|
||||||
|
"postUpdateOptions" : [
|
||||||
|
"gomodTidy"
|
||||||
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchManagers": ["gomod"],
|
||||||
|
"matchDepTypes": ["indirect"],
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchFileNames": ["internal/tools/**"],
|
||||||
|
"matchManagers": ["gomod"],
|
||||||
|
"matchDepTypes": ["indirect"],
|
||||||
|
"enabled": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": ["google.golang.org/genproto/googleapis/**"],
|
||||||
|
"groupName": "googleapis"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchPackageNames": ["golang.org/x/**"],
|
||||||
|
"groupName": "golang.org/x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
2
vendor/go.opentelemetry.io/otel/requirements.txt
generated
vendored
2
vendor/go.opentelemetry.io/otel/requirements.txt
generated
vendored
@ -1 +1 @@
|
|||||||
codespell==2.2.6
|
codespell==2.3.0
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/sdk/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# SDK
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk)
|
||||||
3
vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/instrumentation/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# SDK Instrumentation
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/instrumentation)
|
||||||
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// Package instrumentation provides types to represent the code libraries that
|
// Package instrumentation provides types to represent the code libraries that
|
||||||
// provide OpenTelemetry instrumentation. These types are used in the
|
// provide OpenTelemetry instrumentation. These types are used in the
|
||||||
|
|||||||
16
vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go
generated
vendored
16
vendor/go.opentelemetry.io/otel/sdk/instrumentation/library.go
generated
vendored
@ -1,19 +1,9 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation"
|
package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation"
|
||||||
|
|
||||||
// Library represents the instrumentation library.
|
// Library represents the instrumentation library.
|
||||||
// Deprecated: please use Scope instead.
|
//
|
||||||
|
// Deprecated: use [Scope] instead.
|
||||||
type Library = Scope
|
type Library = Scope
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/instrumentation/scope.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation"
|
package instrumentation // import "go.opentelemetry.io/otel/sdk/instrumentation"
|
||||||
|
|
||||||
|
|||||||
15
vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package env // import "go.opentelemetry.io/otel/sdk/internal/env"
|
package env // import "go.opentelemetry.io/otel/sdk/internal/env"
|
||||||
|
|
||||||
@ -33,7 +22,7 @@ const (
|
|||||||
BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE"
|
BatchSpanProcessorMaxQueueSizeKey = "OTEL_BSP_MAX_QUEUE_SIZE"
|
||||||
// BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e.
|
// BatchSpanProcessorMaxExportBatchSizeKey is the maximum batch size (i.e.
|
||||||
// 512). Note: it must be less than or equal to
|
// 512). Note: it must be less than or equal to
|
||||||
// EnvBatchSpanProcessorMaxQueueSize.
|
// BatchSpanProcessorMaxQueueSize.
|
||||||
BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE"
|
BatchSpanProcessorMaxExportBatchSizeKey = "OTEL_BSP_MAX_EXPORT_BATCH_SIZE"
|
||||||
|
|
||||||
// AttributeValueLengthKey is the maximum allowed attribute value size.
|
// AttributeValueLengthKey is the maximum allowed attribute value size.
|
||||||
|
|||||||
29
vendor/go.opentelemetry.io/otel/sdk/internal/gen.go
generated
vendored
29
vendor/go.opentelemetry.io/otel/sdk/internal/gen.go
generated
vendored
@ -1,29 +0,0 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package internal // import "go.opentelemetry.io/otel/sdk/internal"
|
|
||||||
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/matchers/expectation.go.tmpl "--data={}" --out=matchers/expectation.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/matchers/expecter.go.tmpl "--data={}" --out=matchers/expecter.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/matchers/temporal_matcher.go.tmpl "--data={}" --out=matchers/temporal_matcher.go
|
|
||||||
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/alignment.go.tmpl "--data={}" --out=internaltest/alignment.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/env.go.tmpl "--data={}" --out=internaltest/env.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/env_test.go.tmpl "--data={}" --out=internaltest/env_test.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/errors.go.tmpl "--data={}" --out=internaltest/errors.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/harness.go.tmpl "--data={\"matchersImportPath\": \"go.opentelemetry.io/otel/sdk/internal/matchers\"}" --out=internaltest/harness.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier.go.tmpl "--data={}" --out=internaltest/text_map_carrier.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_carrier_test.go.tmpl "--data={}" --out=internaltest/text_map_carrier_test.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator.go.tmpl "--data={}" --out=internaltest/text_map_propagator.go
|
|
||||||
//go:generate gotmpl --body=../../internal/shared/internaltest/text_map_propagator_test.go.tmpl "--data={}" --out=internaltest/text_map_propagator_test.go
|
|
||||||
28
vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
generated
vendored
28
vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
generated
vendored
@ -1,28 +0,0 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package internal // import "go.opentelemetry.io/otel/sdk/internal"
|
|
||||||
|
|
||||||
import "time"
|
|
||||||
|
|
||||||
// MonotonicEndTime returns the end time at present
|
|
||||||
// but offset from start, monotonically.
|
|
||||||
//
|
|
||||||
// The monotonic clock is used in subtractions hence
|
|
||||||
// the duration since start added back to start gives
|
|
||||||
// end as a monotonic time.
|
|
||||||
// See https://golang.org/pkg/time/#hdr-Monotonic_Clocks
|
|
||||||
func MonotonicEndTime(start time.Time) time.Time {
|
|
||||||
return start.Add(time.Since(start))
|
|
||||||
}
|
|
||||||
46
vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md
generated
vendored
Normal file
46
vendor/go.opentelemetry.io/otel/sdk/internal/x/README.md
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# Experimental Features
|
||||||
|
|
||||||
|
The SDK contains features that have not yet stabilized in the OpenTelemetry specification.
|
||||||
|
These features are added to the OpenTelemetry Go SDK prior to stabilization in the specification so that users can start experimenting with them and provide feedback.
|
||||||
|
|
||||||
|
These feature may change in backwards incompatible ways as feedback is applied.
|
||||||
|
See the [Compatibility and Stability](#compatibility-and-stability) section for more information.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- [Resource](#resource)
|
||||||
|
|
||||||
|
### Resource
|
||||||
|
|
||||||
|
[OpenTelemetry resource semantic conventions] include many attribute definitions that are defined as experimental.
|
||||||
|
To have experimental semantic conventions be added by [resource detectors] set the `OTEL_GO_X_RESOURCE` environment variable.
|
||||||
|
The value set must be the case-insensitive string of `"true"` to enable the feature.
|
||||||
|
All other values are ignored.
|
||||||
|
|
||||||
|
<!-- TODO: document what attributes are added by which detector -->
|
||||||
|
|
||||||
|
[OpenTelemetry resource semantic conventions]: https://opentelemetry.io/docs/specs/semconv/resource/
|
||||||
|
[resource detectors]: https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource#Detector
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
|
||||||
|
Enable experimental resource semantic conventions.
|
||||||
|
|
||||||
|
```console
|
||||||
|
export OTEL_GO_X_RESOURCE=true
|
||||||
|
```
|
||||||
|
|
||||||
|
Disable experimental resource semantic conventions.
|
||||||
|
|
||||||
|
```console
|
||||||
|
unset OTEL_GO_X_RESOURCE
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compatibility and Stability
|
||||||
|
|
||||||
|
Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../../VERSIONING.md).
|
||||||
|
These features may be removed or modified in successive version releases, including patch versions.
|
||||||
|
|
||||||
|
When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release.
|
||||||
|
There is no guarantee that any environment variable feature flags that enabled the experimental feature will be supported by the stable version.
|
||||||
|
If they are supported, they may be accompanied with a deprecation notice stating a timeline for the removal of that support.
|
||||||
66
vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go
generated
vendored
Normal file
66
vendor/go.opentelemetry.io/otel/sdk/internal/x/x.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// Copyright The OpenTelemetry Authors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
// Package x contains support for OTel SDK experimental features.
|
||||||
|
//
|
||||||
|
// This package should only be used for features defined in the specification.
|
||||||
|
// It should not be used for experiments or new project ideas.
|
||||||
|
package x // import "go.opentelemetry.io/otel/sdk/internal/x"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Resource is an experimental feature flag that defines if resource detectors
|
||||||
|
// should be included experimental semantic conventions.
|
||||||
|
//
|
||||||
|
// To enable this feature set the OTEL_GO_X_RESOURCE environment variable
|
||||||
|
// to the case-insensitive string value of "true" (i.e. "True" and "TRUE"
|
||||||
|
// will also enable this).
|
||||||
|
var Resource = newFeature("RESOURCE", func(v string) (string, bool) {
|
||||||
|
if strings.ToLower(v) == "true" {
|
||||||
|
return v, true
|
||||||
|
}
|
||||||
|
return "", false
|
||||||
|
})
|
||||||
|
|
||||||
|
// Feature is an experimental feature control flag. It provides a uniform way
|
||||||
|
// to interact with these feature flags and parse their values.
|
||||||
|
type Feature[T any] struct {
|
||||||
|
key string
|
||||||
|
parse func(v string) (T, bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
func newFeature[T any](suffix string, parse func(string) (T, bool)) Feature[T] {
|
||||||
|
const envKeyRoot = "OTEL_GO_X_"
|
||||||
|
return Feature[T]{
|
||||||
|
key: envKeyRoot + suffix,
|
||||||
|
parse: parse,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Key returns the environment variable key that needs to be set to enable the
|
||||||
|
// feature.
|
||||||
|
func (f Feature[T]) Key() string { return f.key }
|
||||||
|
|
||||||
|
// Lookup returns the user configured value for the feature and true if the
|
||||||
|
// user has enabled the feature. Otherwise, if the feature is not enabled, a
|
||||||
|
// zero-value and false are returned.
|
||||||
|
func (f Feature[T]) Lookup() (v T, ok bool) {
|
||||||
|
// https://github.com/open-telemetry/opentelemetry-specification/blob/62effed618589a0bec416a87e559c0a9d96289bb/specification/configuration/sdk-environment-variables.md#parsing-empty-value
|
||||||
|
//
|
||||||
|
// > The SDK MUST interpret an empty value of an environment variable the
|
||||||
|
// > same way as when the variable is unset.
|
||||||
|
vRaw := os.Getenv(f.key)
|
||||||
|
if vRaw == "" {
|
||||||
|
return v, ok
|
||||||
|
}
|
||||||
|
return f.parse(vRaw)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enabled returns if the feature is enabled.
|
||||||
|
func (f Feature[T]) Enabled() bool {
|
||||||
|
_, ok := f.Lookup()
|
||||||
|
return ok
|
||||||
|
}
|
||||||
3
vendor/go.opentelemetry.io/otel/sdk/resource/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/resource/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# SDK Resource
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/resource)
|
||||||
38
vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
generated
vendored
38
vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -41,8 +30,20 @@ type Detector interface {
|
|||||||
// must never be done outside of a new major release.
|
// must never be done outside of a new major release.
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect calls all input detectors sequentially and merges each result with the previous one.
|
// Detect returns a new [Resource] merged from all the Resources each of the
|
||||||
// It returns the merged error too.
|
// detectors produces. Each of the detectors are called sequentially, in the
|
||||||
|
// order they are passed, merging the produced resource into the previous.
|
||||||
|
//
|
||||||
|
// This may return a partial Resource along with an error containing
|
||||||
|
// [ErrPartialResource] if that error is returned from a detector. It may also
|
||||||
|
// return a merge-conflicting Resource along with an error containing
|
||||||
|
// [ErrSchemaURLConflict] if merging Resources from different detectors results
|
||||||
|
// in a schema URL conflict. It is up to the caller to determine if this
|
||||||
|
// returned Resource should be used or not.
|
||||||
|
//
|
||||||
|
// If one of the detectors returns an error that is not [ErrPartialResource],
|
||||||
|
// the resource produced by the detector will not be merged and the returned
|
||||||
|
// error will wrap that detector's error.
|
||||||
func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
|
func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
|
||||||
r := new(Resource)
|
r := new(Resource)
|
||||||
return r, detect(ctx, r, detectors)
|
return r, detect(ctx, r, detectors)
|
||||||
@ -50,6 +51,10 @@ func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
|
|||||||
|
|
||||||
// detect runs all detectors using ctx and merges the result into res. This
|
// detect runs all detectors using ctx and merges the result into res. This
|
||||||
// assumes res is allocated and not nil, it will panic otherwise.
|
// assumes res is allocated and not nil, it will panic otherwise.
|
||||||
|
//
|
||||||
|
// If the detectors or merging resources produces any errors (i.e.
|
||||||
|
// [ErrPartialResource] [ErrSchemaURLConflict]), a single error wrapping all of
|
||||||
|
// these errors will be returned. Otherwise, nil is returned.
|
||||||
func detect(ctx context.Context, res *Resource, detectors []Detector) error {
|
func detect(ctx context.Context, res *Resource, detectors []Detector) error {
|
||||||
var (
|
var (
|
||||||
r *Resource
|
r *Resource
|
||||||
@ -78,6 +83,11 @@ func detect(ctx context.Context, res *Resource, detectors []Detector) error {
|
|||||||
if len(errs) == 0 {
|
if len(errs) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if errors.Is(errs, ErrSchemaURLConflict) {
|
||||||
|
// If there has been a merge conflict, ensure the resource has no
|
||||||
|
// schema URL.
|
||||||
|
res.schemaURL = ""
|
||||||
|
}
|
||||||
return errs
|
return errs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
36
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -20,9 +9,11 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/sdk"
|
"go.opentelemetry.io/otel/sdk"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -47,6 +38,8 @@ type (
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultServiceNameDetector struct{}
|
defaultServiceNameDetector struct{}
|
||||||
|
|
||||||
|
defaultServiceInstanceIDDetector struct{}
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -54,6 +47,7 @@ var (
|
|||||||
_ Detector = host{}
|
_ Detector = host{}
|
||||||
_ Detector = stringDetector{}
|
_ Detector = stringDetector{}
|
||||||
_ Detector = defaultServiceNameDetector{}
|
_ Detector = defaultServiceNameDetector{}
|
||||||
|
_ Detector = defaultServiceInstanceIDDetector{}
|
||||||
)
|
)
|
||||||
|
|
||||||
// Detect returns a *Resource that describes the OpenTelemetry SDK used.
|
// Detect returns a *Resource that describes the OpenTelemetry SDK used.
|
||||||
@ -106,3 +100,19 @@ func (defaultServiceNameDetector) Detect(ctx context.Context) (*Resource, error)
|
|||||||
},
|
},
|
||||||
).Detect(ctx)
|
).Detect(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Detect implements Detector.
|
||||||
|
func (defaultServiceInstanceIDDetector) Detect(ctx context.Context) (*Resource, error) {
|
||||||
|
return StringDetector(
|
||||||
|
semconv.SchemaURL,
|
||||||
|
semconv.ServiceInstanceIDKey,
|
||||||
|
func() (string, error) {
|
||||||
|
version4Uuid, err := uuid.NewRandom()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return version4Uuid.String(), nil
|
||||||
|
},
|
||||||
|
).Detect(ctx)
|
||||||
|
}
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/config.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/config.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
|
|||||||
17
vendor/go.opentelemetry.io/otel/sdk/resource/container.go
generated
vendored
17
vendor/go.opentelemetry.io/otel/sdk/resource/container.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -22,14 +11,14 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type containerIDProvider func() (string, error)
|
type containerIDProvider func() (string, error)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
containerID containerIDProvider = getContainerIDFromCGroup
|
containerID containerIDProvider = getContainerIDFromCGroup
|
||||||
cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*-)?([0-9a-f]+)(?:\.|\s*$)`)
|
cgroupContainerIDRe = regexp.MustCompile(`^.*/(?:.*[-:])?([0-9a-f]+)(?:\.|\s*$)`)
|
||||||
)
|
)
|
||||||
|
|
||||||
type cgroupContainerIDDetector struct{}
|
type cgroupContainerIDDetector struct{}
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// Package resource provides detecting and representing resources.
|
// Package resource provides detecting and representing resources.
|
||||||
//
|
//
|
||||||
|
|||||||
15
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -23,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
15
vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -19,7 +8,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type hostIDProvider func() (string, error)
|
type hostIDProvider func() (string, error)
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build dragonfly || freebsd || netbsd || openbsd || solaris
|
//go:build dragonfly || freebsd || netbsd || openbsd || solaris
|
||||||
// +build dragonfly freebsd netbsd openbsd solaris
|
// +build dragonfly freebsd netbsd openbsd solaris
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris
|
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build linux
|
//go:build linux
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris
|
//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris
|
||||||
|
|
||||||
|
|||||||
23
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
generated
vendored
23
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
generated
vendored
@ -1,25 +1,8 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// +build !darwin
|
//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows
|
||||||
// +build !dragonfly
|
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
|
||||||
// +build !freebsd
|
|
||||||
// +build !linux
|
|
||||||
// +build !netbsd
|
|
||||||
// +build !openbsd
|
|
||||||
// +build !solaris
|
|
||||||
// +build !windows
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
|
|||||||
20
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
generated
vendored
20
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_windows.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build windows
|
//go:build windows
|
||||||
// +build windows
|
// +build windows
|
||||||
@ -21,17 +10,16 @@ import (
|
|||||||
"golang.org/x/sys/windows/registry"
|
"golang.org/x/sys/windows/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
// implements hostIDReader
|
// implements hostIDReader.
|
||||||
type hostIDReaderWindows struct{}
|
type hostIDReaderWindows struct{}
|
||||||
|
|
||||||
// read reads MachineGuid from the windows registry key:
|
// read reads MachineGuid from the Windows registry key:
|
||||||
// SOFTWARE\Microsoft\Cryptography
|
// SOFTWARE\Microsoft\Cryptography.
|
||||||
func (*hostIDReaderWindows) read() (string, error) {
|
func (*hostIDReaderWindows) read() (string, error) {
|
||||||
k, err := registry.OpenKey(
|
k, err := registry.OpenKey(
|
||||||
registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`,
|
registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`,
|
||||||
registry.QUERY_VALUE|registry.WOW64_64KEY,
|
registry.QUERY_VALUE|registry.WOW64_64KEY,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
15
vendor/go.opentelemetry.io/otel/sdk/resource/os.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/os.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -19,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type osDescriptionProvider func() (string, error)
|
type osDescriptionProvider func() (string, error)
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_darwin.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_release_unix.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix dragonfly freebsd linux netbsd openbsd solaris zos
|
// +build aix dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|||||||
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/sdk/resource/os_unix.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|||||||
25
vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go
generated
vendored
25
vendor/go.opentelemetry.io/otel/sdk/resource/os_unsupported.go
generated
vendored
@ -1,27 +1,8 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
// +build !aix
|
//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris && !windows && !zos
|
||||||
// +build !darwin
|
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows,!zos
|
||||||
// +build !dragonfly
|
|
||||||
// +build !freebsd
|
|
||||||
// +build !linux
|
|
||||||
// +build !netbsd
|
|
||||||
// +build !openbsd
|
|
||||||
// +build !solaris
|
|
||||||
// +build !windows
|
|
||||||
// +build !zos
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
|
|||||||
14
vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go
generated
vendored
14
vendor/go.opentelemetry.io/otel/sdk/resource/os_windows.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -28,7 +17,6 @@ import (
|
|||||||
func platformOSDescription() (string, error) {
|
func platformOSDescription() (string, error) {
|
||||||
k, err := registry.OpenKey(
|
k, err := registry.OpenKey(
|
||||||
registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, registry.QUERY_VALUE)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|||||||
15
vendor/go.opentelemetry.io/otel/sdk/resource/process.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/resource/process.go
generated
vendored
@ -1,16 +1,5 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
@ -22,7 +11,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.21.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
|||||||
103
vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
generated
vendored
103
vendor/go.opentelemetry.io/otel/sdk/resource/resource.go
generated
vendored
@ -1,26 +1,17 @@
|
|||||||
// Copyright The OpenTelemetry Authors
|
// Copyright The OpenTelemetry Authors
|
||||||
//
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/sdk/internal/x"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Resource describes an entity about which identifying information
|
// Resource describes an entity about which identifying information
|
||||||
@ -40,9 +31,20 @@ var (
|
|||||||
defaultResourceOnce sync.Once
|
defaultResourceOnce sync.Once
|
||||||
)
|
)
|
||||||
|
|
||||||
var errMergeConflictSchemaURL = errors.New("cannot merge resource due to conflicting Schema URL")
|
// ErrSchemaURLConflict is an error returned when two Resources are merged
|
||||||
|
// together that contain different, non-empty, schema URLs.
|
||||||
|
var ErrSchemaURLConflict = errors.New("conflicting Schema URL")
|
||||||
|
|
||||||
// New returns a Resource combined from the user-provided detectors.
|
// New returns a [Resource] built using opts.
|
||||||
|
//
|
||||||
|
// This may return a partial Resource along with an error containing
|
||||||
|
// [ErrPartialResource] if options that provide a [Detector] are used and that
|
||||||
|
// error is returned from one or more of the Detectors. It may also return a
|
||||||
|
// merge-conflict Resource along with an error containing
|
||||||
|
// [ErrSchemaURLConflict] if merging Resources from the opts results in a
|
||||||
|
// schema URL conflict (see [Resource.Merge] for more information). It is up to
|
||||||
|
// the caller to determine if this returned Resource should be used or not
|
||||||
|
// based on these errors.
|
||||||
func New(ctx context.Context, opts ...Option) (*Resource, error) {
|
func New(ctx context.Context, opts ...Option) (*Resource, error) {
|
||||||
cfg := config{}
|
cfg := config{}
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
@ -98,7 +100,7 @@ func (r *Resource) String() string {
|
|||||||
return r.attrs.Encoded(attribute.DefaultEncoder())
|
return r.attrs.Encoded(attribute.DefaultEncoder())
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarshalLog is the marshaling function used by the logging system to represent this exporter.
|
// MarshalLog is the marshaling function used by the logging system to represent this Resource.
|
||||||
func (r *Resource) MarshalLog() interface{} {
|
func (r *Resource) MarshalLog() interface{} {
|
||||||
return struct {
|
return struct {
|
||||||
Attributes attribute.Set
|
Attributes attribute.Set
|
||||||
@ -146,16 +148,29 @@ func (r *Resource) Equal(eq *Resource) bool {
|
|||||||
return r.Equivalent() == eq.Equivalent()
|
return r.Equivalent() == eq.Equivalent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge creates a new resource by combining resource a and b.
|
// Merge creates a new [Resource] by merging a and b.
|
||||||
//
|
//
|
||||||
// If there are common keys between resource a and b, then the value
|
// If there are common keys between a and b, then the value from b will
|
||||||
// from resource b will overwrite the value from resource a, even
|
// overwrite the value from a, even if b's value is empty.
|
||||||
// if resource b's value is empty.
|
|
||||||
//
|
//
|
||||||
// The SchemaURL of the resources will be merged according to the spec rules:
|
// The SchemaURL of the resources will be merged according to the
|
||||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge
|
// [OpenTelemetry specification rules]:
|
||||||
// If the resources have different non-empty schemaURL an empty resource and an error
|
//
|
||||||
// will be returned.
|
// - If a's schema URL is empty then the returned Resource's schema URL will
|
||||||
|
// be set to the schema URL of b,
|
||||||
|
// - Else if b's schema URL is empty then the returned Resource's schema URL
|
||||||
|
// will be set to the schema URL of a,
|
||||||
|
// - Else if the schema URLs of a and b are the same then that will be the
|
||||||
|
// schema URL of the returned Resource,
|
||||||
|
// - Else this is a merging error. If the resources have different,
|
||||||
|
// non-empty, schema URLs an error containing [ErrSchemaURLConflict] will
|
||||||
|
// be returned with the merged Resource. The merged Resource will have an
|
||||||
|
// empty schema URL. It may be the case that some unintended attributes
|
||||||
|
// have been overwritten or old semantic conventions persisted in the
|
||||||
|
// returned Resource. It is up to the caller to determine if this returned
|
||||||
|
// Resource should be used or not.
|
||||||
|
//
|
||||||
|
// [OpenTelemetry specification rules]: https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/resource/sdk.md#merge
|
||||||
func Merge(a, b *Resource) (*Resource, error) {
|
func Merge(a, b *Resource) (*Resource, error) {
|
||||||
if a == nil && b == nil {
|
if a == nil && b == nil {
|
||||||
return Empty(), nil
|
return Empty(), nil
|
||||||
@ -167,19 +182,6 @@ func Merge(a, b *Resource) (*Resource, error) {
|
|||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge the schema URL.
|
|
||||||
var schemaURL string
|
|
||||||
switch true {
|
|
||||||
case a.schemaURL == "":
|
|
||||||
schemaURL = b.schemaURL
|
|
||||||
case b.schemaURL == "":
|
|
||||||
schemaURL = a.schemaURL
|
|
||||||
case a.schemaURL == b.schemaURL:
|
|
||||||
schemaURL = a.schemaURL
|
|
||||||
default:
|
|
||||||
return Empty(), errMergeConflictSchemaURL
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: 'b' attributes will overwrite 'a' with last-value-wins in attribute.Key()
|
// Note: 'b' attributes will overwrite 'a' with last-value-wins in attribute.Key()
|
||||||
// Meaning this is equivalent to: append(a.Attributes(), b.Attributes()...)
|
// Meaning this is equivalent to: append(a.Attributes(), b.Attributes()...)
|
||||||
mi := attribute.NewMergeIterator(b.Set(), a.Set())
|
mi := attribute.NewMergeIterator(b.Set(), a.Set())
|
||||||
@ -187,8 +189,23 @@ func Merge(a, b *Resource) (*Resource, error) {
|
|||||||
for mi.Next() {
|
for mi.Next() {
|
||||||
combine = append(combine, mi.Attribute())
|
combine = append(combine, mi.Attribute())
|
||||||
}
|
}
|
||||||
merged := NewWithAttributes(schemaURL, combine...)
|
|
||||||
return merged, nil
|
switch {
|
||||||
|
case a.schemaURL == "":
|
||||||
|
return NewWithAttributes(b.schemaURL, combine...), nil
|
||||||
|
case b.schemaURL == "":
|
||||||
|
return NewWithAttributes(a.schemaURL, combine...), nil
|
||||||
|
case a.schemaURL == b.schemaURL:
|
||||||
|
return NewWithAttributes(a.schemaURL, combine...), nil
|
||||||
|
}
|
||||||
|
// Return the merged resource with an appropriate error. It is up to
|
||||||
|
// the user to decide if the returned resource can be used or not.
|
||||||
|
return NewSchemaless(combine...), fmt.Errorf(
|
||||||
|
"%w: %s and %s",
|
||||||
|
ErrSchemaURLConflict,
|
||||||
|
a.schemaURL,
|
||||||
|
b.schemaURL,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Empty returns an instance of Resource with no attributes. It is
|
// Empty returns an instance of Resource with no attributes. It is
|
||||||
@ -202,11 +219,17 @@ func Empty() *Resource {
|
|||||||
func Default() *Resource {
|
func Default() *Resource {
|
||||||
defaultResourceOnce.Do(func() {
|
defaultResourceOnce.Do(func() {
|
||||||
var err error
|
var err error
|
||||||
defaultResource, err = Detect(
|
defaultDetectors := []Detector{
|
||||||
context.Background(),
|
|
||||||
defaultServiceNameDetector{},
|
defaultServiceNameDetector{},
|
||||||
fromEnv{},
|
fromEnv{},
|
||||||
telemetrySDK{},
|
telemetrySDK{},
|
||||||
|
}
|
||||||
|
if x.Resource.Enabled() {
|
||||||
|
defaultDetectors = append([]Detector{defaultServiceInstanceIDDetector{}}, defaultDetectors...)
|
||||||
|
}
|
||||||
|
defaultResource, err = Detect(
|
||||||
|
context.Background(),
|
||||||
|
defaultDetectors...,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
otel.Handle(err)
|
otel.Handle(err)
|
||||||
|
|||||||
3
vendor/go.opentelemetry.io/otel/sdk/trace/README.md
generated
vendored
Normal file
3
vendor/go.opentelemetry.io/otel/sdk/trace/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# SDK Trace
|
||||||
|
|
||||||
|
[](https://pkg.go.dev/go.opentelemetry.io/otel/sdk/trace)
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user