go.mod: go.opentelemetry.io/otel v1.12.0
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
parent
967979efdc
commit
5082fb3958
22
go.mod
22
go.mod
@ -60,17 +60,17 @@ require (
|
|||||||
github.com/urfave/cli v1.22.10
|
github.com/urfave/cli v1.22.10
|
||||||
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
|
github.com/vishvananda/netlink v1.1.1-0.20210330154013-f5de75959ad5
|
||||||
go.etcd.io/bbolt v1.3.6
|
go.etcd.io/bbolt v1.3.6
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0
|
||||||
go.opentelemetry.io/otel v1.11.1
|
go.opentelemetry.io/otel v1.12.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.1
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.12.0
|
||||||
go.opentelemetry.io/otel/sdk v1.11.1
|
go.opentelemetry.io/otel/sdk v1.12.0
|
||||||
go.opentelemetry.io/otel/trace v1.11.1
|
go.opentelemetry.io/otel/trace v1.12.0
|
||||||
golang.org/x/sync v0.1.0
|
golang.org/x/sync v0.1.0
|
||||||
golang.org/x/sys v0.3.0
|
golang.org/x/sys v0.3.0
|
||||||
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6
|
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6
|
||||||
google.golang.org/grpc v1.51.0
|
google.golang.org/grpc v1.52.0
|
||||||
google.golang.org/protobuf v1.28.1
|
google.golang.org/protobuf v1.28.1
|
||||||
k8s.io/api v0.25.4
|
k8s.io/api v0.25.4
|
||||||
k8s.io/apimachinery v0.25.4
|
k8s.io/apimachinery v0.25.4
|
||||||
@ -83,7 +83,6 @@ require (
|
|||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go/compute/metadata v0.2.1 // indirect
|
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
|
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
|
||||||
@ -122,12 +121,13 @@ require (
|
|||||||
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
|
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
|
||||||
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 // indirect
|
go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
go.opencensus.io v0.24.0 // indirect
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 // indirect
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 // indirect
|
||||||
|
go.opentelemetry.io/otel/metric v0.34.0 // indirect
|
||||||
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
||||||
golang.org/x/crypto v0.1.0 // indirect
|
golang.org/x/crypto v0.1.0 // indirect
|
||||||
golang.org/x/mod v0.6.0 // indirect
|
golang.org/x/mod v0.6.0 // indirect
|
||||||
golang.org/x/net v0.4.0 // indirect
|
golang.org/x/net v0.4.0 // indirect
|
||||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
|
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
|
||||||
golang.org/x/term v0.3.0 // indirect
|
golang.org/x/term v0.3.0 // indirect
|
||||||
golang.org/x/text v0.5.0 // indirect
|
golang.org/x/text v0.5.0 // indirect
|
||||||
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
|
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
|
||||||
|
42
go.sum
42
go.sum
@ -29,7 +29,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g
|
|||||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||||
cloud.google.com/go/compute v1.13.0 h1:AYrLkB8NPdDRslNp4Jxmzrhdr03fUAIDbiGFjLWowoU=
|
cloud.google.com/go/compute v1.13.0 h1:AYrLkB8NPdDRslNp4Jxmzrhdr03fUAIDbiGFjLWowoU=
|
||||||
cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48=
|
cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48=
|
||||||
cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM=
|
|
||||||
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/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||||
@ -993,38 +992,40 @@ go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
|||||||
go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc=
|
go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0/go.mod h1:vEhqr0m4eTc+DWxfsXoXue2GBgV2uUwVznkGIHW/e5w=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0/go.mod h1:vEhqr0m4eTc+DWxfsXoXue2GBgV2uUwVznkGIHW/e5w=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4 h1:PRXhsszxTt5bbPriTjmaweWUsAnJYeWBhUMLRetUgBU=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0 h1:+uFejS4DCfNH6d3xODVIGsdhzgzhh45p9gpbHQMbdZI=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4/go.mod h1:05eWWy6ZWzmpeImD3UowLTB3VjDMU1yxQ+ENuVWDM3c=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0/go.mod h1:HSmzQvagH8pS2/xrK7ScWsk0vAMtRTGbMFgInXCi8Tc=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4=
|
||||||
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
|
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
|
||||||
go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
|
go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
|
||||||
go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4=
|
go.opentelemetry.io/otel v1.12.0 h1:IgfC7kqQrRccIKuB7Cl+SRUmsKbEwSGPr0Eu+/ht1SQ=
|
||||||
go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE=
|
go.opentelemetry.io/otel v1.12.0/go.mod h1:geaoz0L0r1BEOR81k7/n9W4TCXYCJ7bPO7K374jQHG0=
|
||||||
go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM=
|
go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4=
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1 h1:X2GndnMCsUPh6CiY2a+frAbNsXaPLbB0soHRYhAZ5Ig=
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0 h1:UfDENi+LTcLjQ/JhaXimjlIgn7wWjwbEMmdREm2Gyng=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1/go.mod h1:i8vjiSzbiUC7wOQplijSXMYUpNM93DtlS5CbUT+C6oQ=
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1 h1:MEQNafcNCB0uQIti/oHgU7CZpUMYQ7qigBwMVKycHvc=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0 h1:ZVqtSAxrR4+ofzayuww0/EKamCjjnwnXTMRZzMudJoU=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1/go.mod h1:19O5I2U5iys38SsmT2uDJja/300woyzE1KPIQxEUBUc=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0/go.mod h1:IlaGLENJkAl9+Xoo3J0unkdOwtL+rmqZ3ryMjUtYA94=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1 h1:LYyG/f1W/jzAix16jbksJfMQFpOH/Ma6T639pVPMgfI=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0 h1:+tsVdWosoqDfX6cdHAeacZozjQS94ySBd+aUXFwnNKA=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1/go.mod h1:QrRRQiY3kzAoYPNLP0W/Ikg0gR6V3LMc+ODSxr7yyvg=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0/go.mod h1:jSqjV+Knu1Jyvh+l3fx7V210Ev3HHgNQAi8YqpXaQP8=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0/go.mod h1:QNX1aly8ehqqX1LEa6YniTU7VY9I6R3X/oPxhGdTceE=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0/go.mod h1:QNX1aly8ehqqX1LEa6YniTU7VY9I6R3X/oPxhGdTceE=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.1 h1:tFl63cpAAcD9TOU6U8kZU7KyXuSRYAZlbx1C61aaB74=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.12.0 h1:L23MzcHDznr05xOM1Ng1F98L0nVd7hm/S7y2jW9IRB4=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.1/go.mod h1:X620Jww3RajCJXw/unA+8IRTgxkdS7pi+ZwK9b7KUJk=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.12.0/go.mod h1:C+onYX2j5QH653b3wGJwowYr8jLMjBJw35QcaCQQK0U=
|
||||||
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
|
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
|
||||||
|
go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8=
|
||||||
|
go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8=
|
||||||
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
||||||
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
|
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
|
||||||
go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
|
go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
|
||||||
go.opentelemetry.io/otel/sdk v1.11.1 h1:F7KmQgoHljhUuJyA+9BiU+EkJfyX5nVVF4wyzWZpKxs=
|
go.opentelemetry.io/otel/sdk v1.12.0 h1:8npliVYV7qc0t1FKdpU08eMnOjgPFMnriPhn0HH4q3o=
|
||||||
go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys=
|
go.opentelemetry.io/otel/sdk v1.12.0/go.mod h1:WYcvtgquYvgODEvxOry5owO2y9MyciW7JqMz6cpXShE=
|
||||||
go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE=
|
go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE=
|
||||||
go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE=
|
go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE=
|
||||||
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
|
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
|
||||||
go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
|
go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
|
||||||
go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ=
|
go.opentelemetry.io/otel/trace v1.12.0 h1:p28in++7Kd0r2d8gSt931O57fdjUyWxkVbESuILAeUc=
|
||||||
go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk=
|
go.opentelemetry.io/otel/trace v1.12.0/go.mod h1:pHlgBynn6s25qJ2szD+Bv+iwKJttjHSI3lUAyf0GNuQ=
|
||||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||||
go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ=
|
go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ=
|
||||||
go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
|
go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
|
||||||
@ -1168,8 +1169,9 @@ golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ
|
|||||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||||
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||||
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b h1:clP8eMhB30EHdc0bd2Twtq6kgU7yl5ub2cQLSdrv1Dg=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk=
|
||||||
|
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
@ -1495,8 +1497,8 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ
|
|||||||
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
|
||||||
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
|
||||||
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
|
google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk=
|
||||||
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
|
google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
|
||||||
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=
|
||||||
|
@ -52,15 +52,15 @@ require (
|
|||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
go.opencensus.io v0.24.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.11.1 // indirect
|
go.opentelemetry.io/otel v1.12.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.11.1 // indirect
|
go.opentelemetry.io/otel/trace v1.12.0 // indirect
|
||||||
golang.org/x/mod v0.6.0 // indirect
|
golang.org/x/mod v0.6.0 // indirect
|
||||||
golang.org/x/net v0.4.0 // indirect
|
golang.org/x/net v0.4.0 // indirect
|
||||||
golang.org/x/sync v0.1.0 // indirect
|
golang.org/x/sync v0.1.0 // indirect
|
||||||
golang.org/x/text v0.5.0 // indirect
|
golang.org/x/text v0.5.0 // indirect
|
||||||
golang.org/x/tools v0.2.0 // indirect
|
golang.org/x/tools v0.2.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect
|
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect
|
||||||
google.golang.org/grpc v1.51.0 // indirect
|
google.golang.org/grpc v1.52.0 // indirect
|
||||||
google.golang.org/protobuf v1.28.1 // indirect
|
google.golang.org/protobuf v1.28.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
@ -1176,33 +1176,36 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
|||||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||||
go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc=
|
go.opentelemetry.io/contrib v0.20.0/go.mod h1:G/EtFaa6qaN7+LxqfIAT3GiZa7Wv5DTBUzl5H4LY0Kc=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0/go.mod h1:oVGt1LRbBOBq1A5BQLlUg9UaU/54aiHw8cgjV3aWZ/E=
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4/go.mod h1:05eWWy6ZWzmpeImD3UowLTB3VjDMU1yxQ+ENuVWDM3c=
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0/go.mod h1:HSmzQvagH8pS2/xrK7ScWsk0vAMtRTGbMFgInXCi8Tc=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0/go.mod h1:2AboqHi0CiIZU0qwhtUfCYD1GeUzvvIXWNkhDt7ZMG4=
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0/go.mod h1:5eCOqeGphOyz6TsY3ZDNjE33SM/TFAK3RGuCL2naTgY=
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.32.0/go.mod h1:5eCOqeGphOyz6TsY3ZDNjE33SM/TFAK3RGuCL2naTgY=
|
||||||
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
|
go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzoxm/dooo=
|
||||||
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
|
go.opentelemetry.io/otel v1.7.0/go.mod h1:5BdUoMIz5WEs0vt0CUEMtSSaTSHBBVwrhnz7+nrD5xk=
|
||||||
go.opentelemetry.io/otel v1.11.1 h1:4WLLAmcfkmDk2ukNXJyq3/kiz/3UzCaYq6PskJsaou4=
|
go.opentelemetry.io/otel v1.11.2/go.mod h1:7p4EUV+AqgdlNV9gL97IgUZiVR3yrFXYo53f9BM3tRI=
|
||||||
go.opentelemetry.io/otel v1.11.1/go.mod h1:1nNhXBbWSD0nsL38H6btgnFN2k4i0sNLHNNMZMSbUGE=
|
go.opentelemetry.io/otel v1.12.0 h1:IgfC7kqQrRccIKuB7Cl+SRUmsKbEwSGPr0Eu+/ht1SQ=
|
||||||
|
go.opentelemetry.io/otel v1.12.0/go.mod h1:geaoz0L0r1BEOR81k7/n9W4TCXYCJ7bPO7K374jQHG0=
|
||||||
go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM=
|
go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0/go.mod h1:M1hVZHNxcbkAlcvrOMlpQ4YOO3Awf+4N2dxkZL3xm04=
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0/go.mod h1:M1hVZHNxcbkAlcvrOMlpQ4YOO3Awf+4N2dxkZL3xm04=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1/go.mod h1:i8vjiSzbiUC7wOQplijSXMYUpNM93DtlS5CbUT+C6oQ=
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0/go.mod h1:rqbht/LlhVBgn5+k3M5QK96K5Xb0DvXpMJ5SFQpY6uw=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0/go.mod h1:ceUgdyfNv4h4gLxHR0WNfDiiVmZFodZhZSbOLhpxqXE=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0/go.mod h1:ceUgdyfNv4h4gLxHR0WNfDiiVmZFodZhZSbOLhpxqXE=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1/go.mod h1:19O5I2U5iys38SsmT2uDJja/300woyzE1KPIQxEUBUc=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0/go.mod h1:IlaGLENJkAl9+Xoo3J0unkdOwtL+rmqZ3ryMjUtYA94=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0/go.mod h1:E+/KKhwOSw8yoPxSSuUHG6vKppkvhN+S1Jc7Nib3k3o=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.7.0/go.mod h1:E+/KKhwOSw8yoPxSSuUHG6vKppkvhN+S1Jc7Nib3k3o=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1/go.mod h1:QrRRQiY3kzAoYPNLP0W/Ikg0gR6V3LMc+ODSxr7yyvg=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0/go.mod h1:jSqjV+Knu1Jyvh+l3fx7V210Ev3HHgNQAi8YqpXaQP8=
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.1/go.mod h1:X620Jww3RajCJXw/unA+8IRTgxkdS7pi+ZwK9b7KUJk=
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.12.0/go.mod h1:C+onYX2j5QH653b3wGJwowYr8jLMjBJw35QcaCQQK0U=
|
||||||
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
|
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
|
||||||
go.opentelemetry.io/otel/metric v0.30.0/go.mod h1:/ShZ7+TS4dHzDFmfi1kSXMhMVubNoP0oIaBp70J6UXU=
|
go.opentelemetry.io/otel/metric v0.30.0/go.mod h1:/ShZ7+TS4dHzDFmfi1kSXMhMVubNoP0oIaBp70J6UXU=
|
||||||
|
go.opentelemetry.io/otel/metric v0.34.0/go.mod h1:ZFuI4yQGNCupurTXCwkeD/zHBt+C2bR7bw5JqUm/AP8=
|
||||||
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
||||||
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
|
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
|
||||||
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
|
go.opentelemetry.io/otel/sdk v1.7.0/go.mod h1:uTEOTwaqIVuTGiJN7ii13Ibp75wJmYUDe374q6cZwUU=
|
||||||
go.opentelemetry.io/otel/sdk v1.11.1/go.mod h1:/l3FE4SupHJ12TduVjUkZtlfFqDCQJlOlithYrdktys=
|
go.opentelemetry.io/otel/sdk v1.12.0/go.mod h1:WYcvtgquYvgODEvxOry5owO2y9MyciW7JqMz6cpXShE=
|
||||||
go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE=
|
go.opentelemetry.io/otel/sdk/export/metric v0.20.0/go.mod h1:h7RBNMsDJ5pmI1zExLi+bJK+Dr8NQCh0qGhm1KDnNlE=
|
||||||
go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE=
|
go.opentelemetry.io/otel/sdk/metric v0.20.0/go.mod h1:knxiS8Xd4E/N+ZqKmUPf3gTTZ4/0TjTXukfxjzSTpHE=
|
||||||
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
|
go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16gUEi0Nf1iBdgw=
|
||||||
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
|
go.opentelemetry.io/otel/trace v1.7.0/go.mod h1:fzLSB9nqR2eXzxPXb2JW9IKE+ScyXA48yyE4TNvoHqU=
|
||||||
go.opentelemetry.io/otel/trace v1.11.1 h1:ofxdnzsNrGBYXbP7t7zpUK281+go5rF7dvdIZXF8gdQ=
|
go.opentelemetry.io/otel/trace v1.11.2/go.mod h1:4N+yC7QEz7TTsG9BSRLNAa63eg5E06ObSbKPmxQ/pKA=
|
||||||
go.opentelemetry.io/otel/trace v1.11.1/go.mod h1:f/Q9G7vzk5u91PhbmKbg1Qn0rzH1LJ4vbPHFGkTPtOk=
|
go.opentelemetry.io/otel/trace v1.12.0 h1:p28in++7Kd0r2d8gSt931O57fdjUyWxkVbESuILAeUc=
|
||||||
|
go.opentelemetry.io/otel/trace v1.12.0/go.mod h1:pHlgBynn6s25qJ2szD+Bv+iwKJttjHSI3lUAyf0GNuQ=
|
||||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||||
go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
|
go.opentelemetry.io/proto/otlp v0.16.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
|
||||||
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
|
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
|
||||||
@ -1826,8 +1829,9 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu
|
|||||||
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
|
||||||
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
|
|
||||||
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
|
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
|
||||||
|
google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk=
|
||||||
|
google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
|
||||||
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
|
||||||
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=
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
"go.opentelemetry.io/otel/sdk/resource"
|
"go.opentelemetry.io/otel/sdk/resource"
|
||||||
"go.opentelemetry.io/otel/sdk/trace"
|
"go.opentelemetry.io/otel/sdk/trace"
|
||||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
const exporterPlugin = "otlp"
|
const exporterPlugin = "otlp"
|
||||||
|
@ -23,7 +23,8 @@ import (
|
|||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/codes"
|
"go.opentelemetry.io/otel/codes"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
|
httpconv "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ func WithHTTPRequest(request *http.Request) SpanOpt {
|
|||||||
return func(config *StartConfig) {
|
return func(config *StartConfig) {
|
||||||
config.spanOpts = append(config.spanOpts,
|
config.spanOpts = append(config.spanOpts,
|
||||||
trace.WithSpanKind(trace.SpanKindClient), // A client making a request to a server
|
trace.WithSpanKind(trace.SpanKindClient), // A client making a request to a server
|
||||||
trace.WithAttributes(semconv.HTTPClientAttributesFromHTTPRequest(request)...), // Add HTTP attributes
|
trace.WithAttributes(httpconv.ClientRequest(request)...), // Add HTTP attributes
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,5 +113,5 @@ func Attribute(k string, v interface{}) attribute.KeyValue {
|
|||||||
// HTTPStatusCodeAttributes generates attributes of the HTTP namespace as specified by the OpenTelemetry
|
// HTTPStatusCodeAttributes generates attributes of the HTTP namespace as specified by the OpenTelemetry
|
||||||
// specification for a span.
|
// specification for a span.
|
||||||
func HTTPStatusCodeAttributes(code int) []attribute.KeyValue {
|
func HTTPStatusCodeAttributes(code int) []attribute.KeyValue {
|
||||||
return semconv.HTTPAttributesFromHTTPStatusCode(code)
|
return []attribute.KeyValue{semconv.HTTPStatusCodeKey.Int(code)}
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,15 @@
|
|||||||
package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
|
|
||||||
"google.golang.org/grpc/metadata"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
"go.opentelemetry.io/otel/baggage"
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
"go.opentelemetry.io/otel/metric/global"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
|
"go.opentelemetry.io/otel/metric/unit"
|
||||||
"go.opentelemetry.io/otel/propagation"
|
"go.opentelemetry.io/otel/propagation"
|
||||||
|
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,6 +44,10 @@ type config struct {
|
|||||||
Filter Filter
|
Filter Filter
|
||||||
Propagators propagation.TextMapPropagator
|
Propagators propagation.TextMapPropagator
|
||||||
TracerProvider trace.TracerProvider
|
TracerProvider trace.TracerProvider
|
||||||
|
MeterProvider metric.MeterProvider
|
||||||
|
|
||||||
|
meter metric.Meter
|
||||||
|
rpcServerDuration syncint64.Histogram
|
||||||
}
|
}
|
||||||
|
|
||||||
// Option applies an option value for a config.
|
// Option applies an option value for a config.
|
||||||
@ -55,10 +60,22 @@ func newConfig(opts []Option) *config {
|
|||||||
c := &config{
|
c := &config{
|
||||||
Propagators: otel.GetTextMapPropagator(),
|
Propagators: otel.GetTextMapPropagator(),
|
||||||
TracerProvider: otel.GetTracerProvider(),
|
TracerProvider: otel.GetTracerProvider(),
|
||||||
|
MeterProvider: global.MeterProvider(),
|
||||||
}
|
}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o.apply(c)
|
o.apply(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.meter = c.MeterProvider.Meter(
|
||||||
|
instrumentationName,
|
||||||
|
metric.WithInstrumentationVersion(SemVersion()),
|
||||||
|
metric.WithSchemaURL(semconv.SchemaURL),
|
||||||
|
)
|
||||||
|
var err error
|
||||||
|
if c.rpcServerDuration, err = c.meter.SyncInt64().Histogram("rpc.server.duration", instrument.WithUnit(unit.Milliseconds)); err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
}
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,75 +122,16 @@ func WithTracerProvider(tp trace.TracerProvider) Option {
|
|||||||
return tracerProviderOption{tp: tp}
|
return tracerProviderOption{tp: tp}
|
||||||
}
|
}
|
||||||
|
|
||||||
type metadataSupplier struct {
|
type meterProviderOption struct{ mp metric.MeterProvider }
|
||||||
metadata *metadata.MD
|
|
||||||
|
func (o meterProviderOption) apply(c *config) {
|
||||||
|
if o.mp != nil {
|
||||||
|
c.MeterProvider = o.mp
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// assert that metadataSupplier implements the TextMapCarrier interface.
|
// WithMeterProvider returns an Option to use the MeterProvider when
|
||||||
var _ propagation.TextMapCarrier = &metadataSupplier{}
|
// creating a Meter. If this option is not provide the global MeterProvider will be used.
|
||||||
|
func WithMeterProvider(mp metric.MeterProvider) Option {
|
||||||
func (s *metadataSupplier) Get(key string) string {
|
return meterProviderOption{mp: mp}
|
||||||
values := s.metadata.Get(key)
|
|
||||||
if len(values) == 0 {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return values[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *metadataSupplier) Set(key string, value string) {
|
|
||||||
s.metadata.Set(key, value)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *metadataSupplier) Keys() []string {
|
|
||||||
out := make([]string, 0, len(*s.metadata))
|
|
||||||
for key := range *s.metadata {
|
|
||||||
out = append(out, key)
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// Inject injects correlation context and span context into the gRPC
|
|
||||||
// metadata object. This function is meant to be used on outgoing
|
|
||||||
// requests.
|
|
||||||
// Deprecated: Unnecessary public func.
|
|
||||||
func Inject(ctx context.Context, md *metadata.MD, opts ...Option) {
|
|
||||||
c := newConfig(opts)
|
|
||||||
c.Propagators.Inject(ctx, &metadataSupplier{
|
|
||||||
metadata: md,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func inject(ctx context.Context, propagators propagation.TextMapPropagator) context.Context {
|
|
||||||
md, ok := metadata.FromOutgoingContext(ctx)
|
|
||||||
if !ok {
|
|
||||||
md = metadata.MD{}
|
|
||||||
}
|
|
||||||
propagators.Inject(ctx, &metadataSupplier{
|
|
||||||
metadata: &md,
|
|
||||||
})
|
|
||||||
return metadata.NewOutgoingContext(ctx, md)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract returns the correlation context and span context that
|
|
||||||
// another service encoded in the gRPC metadata object with Inject.
|
|
||||||
// This function is meant to be used on incoming requests.
|
|
||||||
// Deprecated: Unnecessary public func.
|
|
||||||
func Extract(ctx context.Context, md *metadata.MD, opts ...Option) (baggage.Baggage, trace.SpanContext) {
|
|
||||||
c := newConfig(opts)
|
|
||||||
ctx = c.Propagators.Extract(ctx, &metadataSupplier{
|
|
||||||
metadata: md,
|
|
||||||
})
|
|
||||||
|
|
||||||
return baggage.FromContext(ctx), trace.SpanContextFromContext(ctx)
|
|
||||||
}
|
|
||||||
|
|
||||||
func extract(ctx context.Context, propagators propagation.TextMapPropagator) context.Context {
|
|
||||||
md, ok := metadata.FromIncomingContext(ctx)
|
|
||||||
if !ok {
|
|
||||||
md = metadata.MD{}
|
|
||||||
}
|
|
||||||
|
|
||||||
return propagators.Extract(ctx, &metadataSupplier{
|
|
||||||
metadata: &md,
|
|
||||||
})
|
|
||||||
}
|
}
|
@ -20,6 +20,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
grpc_codes "google.golang.org/grpc/codes"
|
grpc_codes "google.golang.org/grpc/codes"
|
||||||
@ -338,13 +339,22 @@ func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor {
|
|||||||
|
|
||||||
messageReceived.Event(ctx, 1, req)
|
messageReceived.Event(ctx, 1, req)
|
||||||
|
|
||||||
|
var statusCode grpc_codes.Code
|
||||||
|
defer func(t time.Time) {
|
||||||
|
elapsedTime := time.Since(t) / time.Millisecond
|
||||||
|
attr = append(attr, semconv.RPCGRPCStatusCodeKey.Int64(int64(statusCode)))
|
||||||
|
cfg.rpcServerDuration.Record(ctx, int64(elapsedTime), attr...)
|
||||||
|
}(time.Now())
|
||||||
|
|
||||||
resp, err := handler(ctx, req)
|
resp, err := handler(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s, _ := status.FromError(err)
|
s, _ := status.FromError(err)
|
||||||
|
statusCode = s.Code()
|
||||||
span.SetStatus(codes.Error, s.Message())
|
span.SetStatus(codes.Error, s.Message())
|
||||||
span.SetAttributes(statusCodeAttr(s.Code()))
|
span.SetAttributes(statusCodeAttr(s.Code()))
|
||||||
messageSent.Event(ctx, 1, s.Proto())
|
messageSent.Event(ctx, 1, s.Proto())
|
||||||
} else {
|
} else {
|
||||||
|
statusCode = grpc_codes.OK
|
||||||
span.SetAttributes(statusCodeAttr(grpc_codes.OK))
|
span.SetAttributes(statusCodeAttr(grpc_codes.OK))
|
||||||
messageSent.Event(ctx, 1, resp)
|
messageSent.Event(ctx, 1, resp)
|
||||||
}
|
}
|
||||||
@ -430,7 +440,6 @@ func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor {
|
|||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
err := handler(srv, wrapServerStream(ctx, ss))
|
err := handler(srv, wrapServerStream(ctx, ss))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s, _ := status.FromError(err)
|
s, _ := status.FromError(err)
|
||||||
span.SetStatus(codes.Error, s.Message())
|
span.SetStatus(codes.Error, s.Message())
|
||||||
|
98
vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go
generated
vendored
Normal file
98
vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
// 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 otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"google.golang.org/grpc/metadata"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/baggage"
|
||||||
|
"go.opentelemetry.io/otel/propagation"
|
||||||
|
"go.opentelemetry.io/otel/trace"
|
||||||
|
)
|
||||||
|
|
||||||
|
type metadataSupplier struct {
|
||||||
|
metadata *metadata.MD
|
||||||
|
}
|
||||||
|
|
||||||
|
// assert that metadataSupplier implements the TextMapCarrier interface.
|
||||||
|
var _ propagation.TextMapCarrier = &metadataSupplier{}
|
||||||
|
|
||||||
|
func (s *metadataSupplier) Get(key string) string {
|
||||||
|
values := s.metadata.Get(key)
|
||||||
|
if len(values) == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return values[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *metadataSupplier) Set(key string, value string) {
|
||||||
|
s.metadata.Set(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *metadataSupplier) Keys() []string {
|
||||||
|
out := make([]string, 0, len(*s.metadata))
|
||||||
|
for key := range *s.metadata {
|
||||||
|
out = append(out, key)
|
||||||
|
}
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inject injects correlation context and span context into the gRPC
|
||||||
|
// metadata object. This function is meant to be used on outgoing
|
||||||
|
// requests.
|
||||||
|
// Deprecated: Unnecessary public func.
|
||||||
|
func Inject(ctx context.Context, md *metadata.MD, opts ...Option) {
|
||||||
|
c := newConfig(opts)
|
||||||
|
c.Propagators.Inject(ctx, &metadataSupplier{
|
||||||
|
metadata: md,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func inject(ctx context.Context, propagators propagation.TextMapPropagator) context.Context {
|
||||||
|
md, ok := metadata.FromOutgoingContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
md = metadata.MD{}
|
||||||
|
}
|
||||||
|
propagators.Inject(ctx, &metadataSupplier{
|
||||||
|
metadata: &md,
|
||||||
|
})
|
||||||
|
return metadata.NewOutgoingContext(ctx, md)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract returns the correlation context and span context that
|
||||||
|
// another service encoded in the gRPC metadata object with Inject.
|
||||||
|
// This function is meant to be used on incoming requests.
|
||||||
|
// Deprecated: Unnecessary public func.
|
||||||
|
func Extract(ctx context.Context, md *metadata.MD, opts ...Option) (baggage.Baggage, trace.SpanContext) {
|
||||||
|
c := newConfig(opts)
|
||||||
|
ctx = c.Propagators.Extract(ctx, &metadataSupplier{
|
||||||
|
metadata: md,
|
||||||
|
})
|
||||||
|
|
||||||
|
return baggage.FromContext(ctx), trace.SpanContextFromContext(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func extract(ctx context.Context, propagators propagation.TextMapPropagator) context.Context {
|
||||||
|
md, ok := metadata.FromIncomingContext(ctx)
|
||||||
|
if !ok {
|
||||||
|
md = metadata.MD{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return propagators.Extract(ctx, &metadataSupplier{
|
||||||
|
metadata: &md,
|
||||||
|
})
|
||||||
|
}
|
@ -16,7 +16,7 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g
|
|||||||
|
|
||||||
// Version is the current release version of the gRPC instrumentation.
|
// Version is the current release version of the gRPC instrumentation.
|
||||||
func Version() string {
|
func Version() string {
|
||||||
return "0.36.4"
|
return "0.37.0"
|
||||||
// This string is updated by the pre_release.sh script during release
|
// This string is updated by the pre_release.sh script during release
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
6
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
@ -9,7 +9,6 @@ linters:
|
|||||||
disable-all: true
|
disable-all: true
|
||||||
# Specifically enable linters we want to use.
|
# Specifically enable linters we want to use.
|
||||||
enable:
|
enable:
|
||||||
- deadcode
|
|
||||||
- depguard
|
- depguard
|
||||||
- errcheck
|
- errcheck
|
||||||
- godot
|
- godot
|
||||||
@ -21,10 +20,8 @@ linters:
|
|||||||
- misspell
|
- misspell
|
||||||
- revive
|
- revive
|
||||||
- staticcheck
|
- staticcheck
|
||||||
- structcheck
|
|
||||||
- typecheck
|
- typecheck
|
||||||
- unused
|
- unused
|
||||||
- varcheck
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
# Maximum issues count per one linter.
|
# Maximum issues count per one linter.
|
||||||
@ -114,8 +111,9 @@ linters-settings:
|
|||||||
- name: constant-logical-expr
|
- name: constant-logical-expr
|
||||||
disabled: false
|
disabled: false
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument
|
||||||
|
# TODO (#3372) reenable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280
|
||||||
- name: context-as-argument
|
- name: context-as-argument
|
||||||
disabled: false
|
disabled: true
|
||||||
arguments:
|
arguments:
|
||||||
allowTypesBefore: "*testing.T"
|
allowTypesBefore: "*testing.T"
|
||||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-keys-type
|
||||||
|
1
vendor/go.opentelemetry.io/otel/.lycheeignore
generated
vendored
1
vendor/go.opentelemetry.io/otel/.lycheeignore
generated
vendored
@ -1,3 +1,4 @@
|
|||||||
http://localhost
|
http://localhost
|
||||||
http://jaeger-collector
|
http://jaeger-collector
|
||||||
https://github.com/open-telemetry/opentelemetry-go/milestone/
|
https://github.com/open-telemetry/opentelemetry-go/milestone/
|
||||||
|
https://github.com/open-telemetry/opentelemetry-go/projects
|
||||||
|
197
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
197
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
@ -8,6 +8,199 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.12.0/0.35.0] 2023-01-28
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- The `WithInt64Callback` option to `go.opentelemetry.io/otel/metric/instrument`.
|
||||||
|
This options is used to configure `int64` Observer callbacks during their creation. (#3507)
|
||||||
|
- The `WithFloat64Callback` option to `go.opentelemetry.io/otel/metric/instrument`.
|
||||||
|
This options is used to configure `float64` Observer callbacks during their creation. (#3507)
|
||||||
|
- The `Producer` interface and `Reader.RegisterProducer(Producer)` to `go.opentelemetry.io/otel/sdk/metric`.
|
||||||
|
These additions are used to enable external metric Producers. (#3524)
|
||||||
|
- The `Callback` function type to `go.opentelemetry.io/otel/metric`.
|
||||||
|
This new named function type is registered with a `Meter`. (#3564)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.13.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.13.0` version of the OpenTelemetry specification. (#3499)
|
||||||
|
- The `EndUserAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientRequest` and `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `HTTPAttributesFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is merged into `ClientResponse` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `HTTPClientAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `HTTPServerAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `HTTPServerMetricAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `NetAttributesFromHTTPRequest` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `Transport` in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` and `ClientRequest` or `ServerRequest` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `SpanStatusFromHTTPStatusCode` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is replaced by `ClientStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `SpanStatusFromHTTPStatusCodeAndSpanKind` function in `go.opentelemetry.io/otel/semconv/v1.12.0` is split into `ClientStatus` and `ServerStatus` in `go.opentelemetry.io/otel/semconv/v1.13.0/httpconv`.
|
||||||
|
- The `Client` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Conn`.
|
||||||
|
- The `Server` function is included in `go.opentelemetry.io/otel/semconv/v1.13.0/netconv` to generate attributes for a `net.Listener`.
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.14.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.14.0` version of the OpenTelemetry specification. (#3566)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.15.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.15.0` version of the OpenTelemetry specification. (#3578)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.16.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.16.0` version of the OpenTelemetry specification. (#3579)
|
||||||
|
- Metric instruments to `go.opentelemetry.io/otel/metric/instrument`.
|
||||||
|
These instruments are use as replacements of the depreacted `go.opentelemetry.io/otel/metric/instrument/{asyncfloat64,asyncint64,syncfloat64,syncint64}` packages.(#3575, #3586)
|
||||||
|
- `Float64ObservableCounter` replaces the `asyncfloat64.Counter`
|
||||||
|
- `Float64ObservableUpDownCounter` replaces the `asyncfloat64.UpDownCounter`
|
||||||
|
- `Float64ObservableGauge` replaces the `asyncfloat64.Gauge`
|
||||||
|
- `Int64ObservableCounter` replaces the `asyncint64.Counter`
|
||||||
|
- `Int64ObservableUpDownCounter` replaces the `asyncint64.UpDownCounter`
|
||||||
|
- `Int64ObservableGauge` replaces the `asyncint64.Gauge`
|
||||||
|
- `Float64Counter` replaces the `syncfloat64.Counter`
|
||||||
|
- `Float64UpDownCounter` replaces the `syncfloat64.UpDownCounter`
|
||||||
|
- `Float64Histogram` replaces the `syncfloat64.Histogram`
|
||||||
|
- `Int64Counter` replaces the `syncint64.Counter`
|
||||||
|
- `Int64UpDownCounter` replaces the `syncint64.UpDownCounter`
|
||||||
|
- `Int64Histogram` replaces the `syncint64.Histogram`
|
||||||
|
- `NewTracerProvider` to `go.opentelemetry.io/otel/bridge/opentracing`.
|
||||||
|
This is used to create `WrapperTracer` instances from a `TracerProvider`. (#3116)
|
||||||
|
- The `Extrema` type to `go.opentelemetry.io/otel/sdk/metric/metricdata`.
|
||||||
|
This type is used to represent min/max values and still be able to distinguish unset and zero values. (#3487)
|
||||||
|
- The `go.opentelemetry.io/otel/semconv/v1.17.0` package.
|
||||||
|
The package contains semantic conventions from the `v1.17.0` version of the OpenTelemetry specification. (#3599)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Jaeger and Zipkin exporter use `github.com/go-logr/logr` as the logging interface, and add the `WithLogr` option. (#3497, #3500)
|
||||||
|
- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and confguration based on the instrument type. (#3507)
|
||||||
|
- Use the added `Int64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncint64`.
|
||||||
|
- Use the added `Float64Option` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/syncfloat64`.
|
||||||
|
- Use the added `Int64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncint64`.
|
||||||
|
- Use the added `Float64ObserverOption` type to configure instruments from `go.opentelemetry.io/otel/metric/instrument/asyncfloat64`.
|
||||||
|
- Return a `Registration` from the `RegisterCallback` method of a `Meter` in the `go.opentelemetry.io/otel/metric` package.
|
||||||
|
This `Registration` can be used to unregister callbacks. (#3522)
|
||||||
|
- Global error handler uses an atomic value instead of a mutex. (#3543)
|
||||||
|
- Add `NewMetricProducer` to `go.opentelemetry.io/otel/bridge/opencensus`, which can be used to pass OpenCensus metrics to an OpenTelemetry Reader. (#3541)
|
||||||
|
- Global logger uses an atomic value instead of a mutex. (#3545)
|
||||||
|
- The `Shutdown` method of the `"go.opentelemetry.io/otel/sdk/trace".TracerProvider` releases all computational resources when called the first time. (#3551)
|
||||||
|
- The `Sampler` returned from `TraceIDRatioBased` `go.opentelemetry.io/otel/sdk/trace` now uses the rightmost bits for sampling decisions.
|
||||||
|
This fixes random sampling when using ID generators like `xray.IDGenerator` and increasing parity with other language implementations. (#3557)
|
||||||
|
- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in erros identifying their signal name.
|
||||||
|
Existing users of the exporters attempting to identify specific errors will need to use `errors.Unwrap()` to get the underlying error. (#3516)
|
||||||
|
- Exporters from `go.opentelemetry.io/otel/exporters/otlp` will print the final retryable error message when attempts to retry time out. (#3514)
|
||||||
|
- The instrument kind names in `go.opentelemetry.io/otel/sdk/metric` are updated to match the API. (#3562)
|
||||||
|
- `InstrumentKindSyncCounter` is renamed to `InstrumentKindCounter`
|
||||||
|
- `InstrumentKindSyncUpDownCounter` is renamed to `InstrumentKindUpDownCounter`
|
||||||
|
- `InstrumentKindSyncHistogram` is renamed to `InstrumentKindHistogram`
|
||||||
|
- `InstrumentKindAsyncCounter` is renamed to `InstrumentKindObservableCounter`
|
||||||
|
- `InstrumentKindAsyncUpDownCounter` is renamed to `InstrumentKindObservableUpDownCounter`
|
||||||
|
- `InstrumentKindAsyncGauge` is renamed to `InstrumentKindObservableGauge`
|
||||||
|
- The `RegisterCallback` method of the `Meter` in `go.opentelemetry.io/otel/metric` changed.
|
||||||
|
- The named `Callback` replaces the inline function parameter. (#3564)
|
||||||
|
- `Callback` is required to return an error. (#3576)
|
||||||
|
- `Callback` accepts the added `Observer` parameter added.
|
||||||
|
This new parameter is used by `Callback` implementations to observe values for asynchronous instruments instead of calling the `Observe` method of the instrument directly. (#3584)
|
||||||
|
- The slice of `instrument.Asynchronous` is now passed as a variadic argument. (#3587)
|
||||||
|
- The exporter from `go.opentelemetry.io/otel/exporters/zipkin` is updated to use the `v1.16.0` version of semantic conventions.
|
||||||
|
This means it no longer uses the removed `net.peer.ip` or `http.host` attributes to determine the remote endpoint.
|
||||||
|
Instead it uses the `net.sock.peer` attributes. (#3581)
|
||||||
|
- The `Min` and `Max` fields of the `HistogramDataPoint` in `go.opentelemetry.io/otel/sdk/metric/metricdata` are now defined with the added `Extrema` type instead of a `*float64`. (#3487)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Asynchronous instruments that use sum aggregators and attribute filters correctly add values from equivalent attribute sets that have been filtered. (#3439, #3549)
|
||||||
|
- The `RegisterCallback` method of the `Meter` from `go.opentelemetry.io/otel/sdk/metric` only registers a callback for instruments created by that meter.
|
||||||
|
Trying to register a callback with instruments from a different meter will result in an error being returned. (#3584)
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
- The `NewMetricExporter` in `go.opentelemetry.io/otel/bridge/opencensus` is deprecated.
|
||||||
|
Use `NewMetricProducer` instead. (#3541)
|
||||||
|
- The `go.opentelemetry.io/otel/metric/instrument/asyncfloat64` package is deprecated.
|
||||||
|
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
|
||||||
|
- The `go.opentelemetry.io/otel/metric/instrument/asyncint64` package is deprecated.
|
||||||
|
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
|
||||||
|
- The `go.opentelemetry.io/otel/metric/instrument/syncfloat64` package is deprecated.
|
||||||
|
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
|
||||||
|
- The `go.opentelemetry.io/otel/metric/instrument/syncint64` package is deprecated.
|
||||||
|
Use the instruments from `go.opentelemetry.io/otel/metric/instrument` instead. (#3575)
|
||||||
|
- The `NewWrappedTracerProvider` in `go.opentelemetry.io/otel/bridge/opentracing` is now deprecated.
|
||||||
|
Use `NewTracerProvider` instead. (#3116)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- The deprecated `go.opentelemetry.io/otel/sdk/metric/view` package is removed. (#3520)
|
||||||
|
- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncint64` is removed.
|
||||||
|
Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530)
|
||||||
|
- The `Counter` method is replaced by `Meter.Int64ObservableCounter`
|
||||||
|
- The `UpDownCounter` method is replaced by `Meter.Int64ObservableUpDownCounter`
|
||||||
|
- The `Gauge` method is replaced by `Meter.Int64ObservableGauge`
|
||||||
|
- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/asyncfloat64` is removed.
|
||||||
|
Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530)
|
||||||
|
- The `Counter` method is replaced by `Meter.Float64ObservableCounter`
|
||||||
|
- The `UpDownCounter` method is replaced by `Meter.Float64ObservableUpDownCounter`
|
||||||
|
- The `Gauge` method is replaced by `Meter.Float64ObservableGauge`
|
||||||
|
- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncint64` is removed.
|
||||||
|
Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530)
|
||||||
|
- The `Counter` method is replaced by `Meter.Int64Counter`
|
||||||
|
- The `UpDownCounter` method is replaced by `Meter.Int64UpDownCounter`
|
||||||
|
- The `Histogram` method is replaced by `Meter.Int64Histogram`
|
||||||
|
- The `InstrumentProvider` from `go.opentelemetry.io/otel/sdk/metric/syncfloat64` is removed.
|
||||||
|
Use the new creation methods of the `Meter` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3530)
|
||||||
|
- The `Counter` method is replaced by `Meter.Float64Counter`
|
||||||
|
- The `UpDownCounter` method is replaced by `Meter.Float64UpDownCounter`
|
||||||
|
- The `Histogram` method is replaced by `Meter.Float64Histogram`
|
||||||
|
|
||||||
|
## [1.11.2/0.34.0] 2022-12-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- The `WithView` `Option` is added to the `go.opentelemetry.io/otel/sdk/metric` package.
|
||||||
|
This option is used to configure the view(s) a `MeterProvider` will use for all `Reader`s that are registered with it. (#3387)
|
||||||
|
- Add Instrumentation Scope and Version as info metric and label in Prometheus exporter.
|
||||||
|
This can be disabled using the `WithoutScopeInfo()` option added to that package.(#3273, #3357)
|
||||||
|
- OTLP exporters now recognize: (#3363)
|
||||||
|
- `OTEL_EXPORTER_OTLP_INSECURE`
|
||||||
|
- `OTEL_EXPORTER_OTLP_TRACES_INSECURE`
|
||||||
|
- `OTEL_EXPORTER_OTLP_METRICS_INSECURE`
|
||||||
|
- `OTEL_EXPORTER_OTLP_CLIENT_KEY`
|
||||||
|
- `OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY`
|
||||||
|
- `OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY`
|
||||||
|
- `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`
|
||||||
|
- `OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE`
|
||||||
|
- `OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE`
|
||||||
|
- The `View` type and related `NewView` function to create a view according to the OpenTelemetry specification are added to `go.opentelemetry.io/otel/sdk/metric`.
|
||||||
|
These additions are replacements for the `View` type and `New` function from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459)
|
||||||
|
- The `Instrument` and `InstrumentKind` type are added to `go.opentelemetry.io/otel/sdk/metric`.
|
||||||
|
These additions are replacements for the `Instrument` and `InstrumentKind` types from `go.opentelemetry.io/otel/sdk/metric/view`. (#3459)
|
||||||
|
- The `Stream` type is added to `go.opentelemetry.io/otel/sdk/metric` to define a metric data stream a view will produce. (#3459)
|
||||||
|
- The `AssertHasAttributes` allows instrument authors to test that datapoints returned have appropriate attributes. (#3487)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- The `"go.opentelemetry.io/otel/sdk/metric".WithReader` option no longer accepts views to associate with the `Reader`.
|
||||||
|
Instead, views are now registered directly with the `MeterProvider` via the new `WithView` option.
|
||||||
|
The views registered with the `MeterProvider` apply to all `Reader`s. (#3387)
|
||||||
|
- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/sdk/metric".Exporter` interface. (#3260)
|
||||||
|
- The `Temporality(view.InstrumentKind) metricdata.Temporality` and `Aggregation(view.InstrumentKind) aggregation.Aggregation` methods are added to the `"go.opentelemetry.io/otel/exporters/otlp/otlpmetric".Client` interface. (#3260)
|
||||||
|
- The `WithTemporalitySelector` and `WithAggregationSelector` `ReaderOption`s have been changed to `ManualReaderOption`s in the `go.opentelemetry.io/otel/sdk/metric` package. (#3260)
|
||||||
|
- The periodic reader in the `go.opentelemetry.io/otel/sdk/metric` package now uses the temporality and aggregation selectors from its configured exporter instead of accepting them as options. (#3260)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- The `go.opentelemetry.io/otel/exporters/prometheus` exporter fixes duplicated `_total` suffixes. (#3369)
|
||||||
|
- Remove comparable requirement for `Reader`s. (#3387)
|
||||||
|
- Cumulative metrics from the OpenCensus bridge (`go.opentelemetry.io/otel/bridge/opencensus`) are defined as monotonic sums, instead of non-monotonic. (#3389)
|
||||||
|
- Asynchronous counters (`Counter` and `UpDownCounter`) from the metric SDK now produce delta sums when configured with delta temporality. (#3398)
|
||||||
|
- 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)
|
||||||
|
- Reenabled 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)
|
||||||
|
- 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)
|
||||||
|
- Prevent duplicate Prometheus description, unit, and type. (#3469)
|
||||||
|
- Prevents panic when using incorrect `attribute.Value.As[Type]Slice()`. (#3489)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.Client` interface is removed. (#3486)
|
||||||
|
- The `go.opentelemetry.io/otel/exporters/otlp/otlpmetric.New` function is removed. Use the `otlpmetric[http|grpc].New` directly. (#3486)
|
||||||
|
|
||||||
|
### Deprecated
|
||||||
|
|
||||||
|
- The `go.opentelemetry.io/otel/sdk/metric/view` package is deprecated.
|
||||||
|
Use `Instrument`, `InstrumentKind`, `View`, and `NewView` in `go.opentelemetry.io/otel/sdk/metric` instead. (#3476)
|
||||||
|
|
||||||
## [1.11.1/0.33.0] 2022-10-19
|
## [1.11.1/0.33.0] 2022-10-19
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@ -2027,7 +2220,9 @@ 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.11.1...HEAD
|
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.12.0...HEAD
|
||||||
|
[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0
|
||||||
|
[1.11.2/0.34.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.2
|
||||||
[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1
|
[1.11.1/0.33.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.1
|
||||||
[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0
|
[1.11.0/0.32.3]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.11.0
|
||||||
[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2
|
[0.32.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/sdk/metric/v0.32.2
|
||||||
|
12
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
12
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
@ -17,7 +17,7 @@ TOOLS_MOD_DIR := ./internal/tools
|
|||||||
ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
|
ALL_DOCS := $(shell find . -name '*.md' -type f | sort)
|
||||||
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
|
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
|
||||||
OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS))
|
OTEL_GO_MOD_DIRS := $(filter-out $(TOOLS_MOD_DIR), $(ALL_GO_MOD_DIRS))
|
||||||
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | egrep -v '^./example|^$(TOOLS_MOD_DIR)' | sort)
|
ALL_COVERAGE_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | grep -E -v '^./example|^$(TOOLS_MOD_DIR)' | sort)
|
||||||
|
|
||||||
GO = go
|
GO = go
|
||||||
TIMEOUT = 60
|
TIMEOUT = 60
|
||||||
@ -208,11 +208,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 specification tag"; exit 1 )
|
[ "$(TAG)" ] || ( echo "TAG unset: missing opentelemetry specification tag"; exit 1 )
|
||||||
@[ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 )
|
[ "$(OTEL_SPEC_REPO)" ] || ( echo "OTEL_SPEC_REPO unset: missing path to opentelemetry specification repo"; exit 1 )
|
||||||
@$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/trace" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
||||||
@$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/resource" -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=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: prerelease
|
.PHONY: prerelease
|
||||||
prerelease: | $(MULTIMOD)
|
prerelease: | $(MULTIMOD)
|
||||||
|
11
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
11
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
@ -6,20 +6,25 @@ New versions of the [OpenTelemetry specification] mean new versions of the `semc
|
|||||||
The `semconv-generate` make target is used for this.
|
The `semconv-generate` make target is used for this.
|
||||||
|
|
||||||
1. Checkout a local copy of the [OpenTelemetry specification] to the desired release tag.
|
1. Checkout a local copy of the [OpenTelemetry specification] to the desired release tag.
|
||||||
2. Run the `make semconv-generate ...` target from this repository.
|
2. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest`
|
||||||
|
3. Run the `make semconv-generate ...` target from this repository.
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
export TAG="v1.7.0" # Change to the release version you are generating.
|
export TAG="v1.13.0" # Change to the release version you are generating.
|
||||||
export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification"
|
export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification"
|
||||||
git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG"
|
git -C "$OTEL_SPEC_REPO" checkout "tags/$TAG" -b "$TAG"
|
||||||
|
docker pull otel/semconvgen:latest
|
||||||
make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO.
|
make semconv-generate # Uses the exported TAG and OTEL_SPEC_REPO.
|
||||||
```
|
```
|
||||||
|
|
||||||
This should create a new sub-package of [`semconv`](./semconv).
|
This should create a new sub-package of [`semconv`](./semconv).
|
||||||
Ensure things look correct before submitting a pull request to include the addition.
|
Ensure things look correct before submitting a pull request to include the addition.
|
||||||
|
|
||||||
|
**Note**, the generation code was changed to generate versions >= 1.13.
|
||||||
|
To generate versions prior to this, checkout the old release of this repository (i.e. [2fe8861](https://github.com/open-telemetry/opentelemetry-go/commit/2fe8861a24e20088c065b116089862caf9e3cd8b)).
|
||||||
|
|
||||||
## 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
|
||||||
|
44
vendor/go.opentelemetry.io/otel/attribute/value.go
generated
vendored
44
vendor/go.opentelemetry.io/otel/attribute/value.go
generated
vendored
@ -142,6 +142,13 @@ func (v Value) AsBool() bool {
|
|||||||
// AsBoolSlice returns the []bool value. Make sure that the Value's type is
|
// AsBoolSlice returns the []bool value. Make sure that the Value's type is
|
||||||
// BOOLSLICE.
|
// BOOLSLICE.
|
||||||
func (v Value) AsBoolSlice() []bool {
|
func (v Value) AsBoolSlice() []bool {
|
||||||
|
if v.vtype != BOOLSLICE {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return v.asBoolSlice()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v Value) asBoolSlice() []bool {
|
||||||
return attribute.AsSlice[bool](v.slice)
|
return attribute.AsSlice[bool](v.slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,6 +161,13 @@ func (v Value) AsInt64() int64 {
|
|||||||
// AsInt64Slice returns the []int64 value. Make sure that the Value's type is
|
// AsInt64Slice returns the []int64 value. Make sure that the Value's type is
|
||||||
// INT64SLICE.
|
// INT64SLICE.
|
||||||
func (v Value) AsInt64Slice() []int64 {
|
func (v Value) AsInt64Slice() []int64 {
|
||||||
|
if v.vtype != INT64SLICE {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return v.asInt64Slice()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v Value) asInt64Slice() []int64 {
|
||||||
return attribute.AsSlice[int64](v.slice)
|
return attribute.AsSlice[int64](v.slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,6 +180,13 @@ func (v Value) AsFloat64() float64 {
|
|||||||
// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is
|
// AsFloat64Slice returns the []float64 value. Make sure that the Value's type is
|
||||||
// FLOAT64SLICE.
|
// FLOAT64SLICE.
|
||||||
func (v Value) AsFloat64Slice() []float64 {
|
func (v Value) AsFloat64Slice() []float64 {
|
||||||
|
if v.vtype != FLOAT64SLICE {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return v.asFloat64Slice()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v Value) asFloat64Slice() []float64 {
|
||||||
return attribute.AsSlice[float64](v.slice)
|
return attribute.AsSlice[float64](v.slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +199,13 @@ func (v Value) AsString() string {
|
|||||||
// AsStringSlice returns the []string value. Make sure that the Value's type is
|
// AsStringSlice returns the []string value. Make sure that the Value's type is
|
||||||
// STRINGSLICE.
|
// STRINGSLICE.
|
||||||
func (v Value) AsStringSlice() []string {
|
func (v Value) AsStringSlice() []string {
|
||||||
|
if v.vtype != STRINGSLICE {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return v.asStringSlice()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (v Value) asStringSlice() []string {
|
||||||
return attribute.AsSlice[string](v.slice)
|
return attribute.AsSlice[string](v.slice)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,19 +217,19 @@ func (v Value) AsInterface() interface{} {
|
|||||||
case BOOL:
|
case BOOL:
|
||||||
return v.AsBool()
|
return v.AsBool()
|
||||||
case BOOLSLICE:
|
case BOOLSLICE:
|
||||||
return v.AsBoolSlice()
|
return v.asBoolSlice()
|
||||||
case INT64:
|
case INT64:
|
||||||
return v.AsInt64()
|
return v.AsInt64()
|
||||||
case INT64SLICE:
|
case INT64SLICE:
|
||||||
return v.AsInt64Slice()
|
return v.asInt64Slice()
|
||||||
case FLOAT64:
|
case FLOAT64:
|
||||||
return v.AsFloat64()
|
return v.AsFloat64()
|
||||||
case FLOAT64SLICE:
|
case FLOAT64SLICE:
|
||||||
return v.AsFloat64Slice()
|
return v.asFloat64Slice()
|
||||||
case STRING:
|
case STRING:
|
||||||
return v.stringly
|
return v.stringly
|
||||||
case STRINGSLICE:
|
case STRINGSLICE:
|
||||||
return v.AsStringSlice()
|
return v.asStringSlice()
|
||||||
}
|
}
|
||||||
return unknownValueType{}
|
return unknownValueType{}
|
||||||
}
|
}
|
||||||
@ -210,19 +238,19 @@ func (v Value) AsInterface() interface{} {
|
|||||||
func (v Value) Emit() string {
|
func (v Value) Emit() string {
|
||||||
switch v.Type() {
|
switch v.Type() {
|
||||||
case BOOLSLICE:
|
case BOOLSLICE:
|
||||||
return fmt.Sprint(v.AsBoolSlice())
|
return fmt.Sprint(v.asBoolSlice())
|
||||||
case BOOL:
|
case BOOL:
|
||||||
return strconv.FormatBool(v.AsBool())
|
return strconv.FormatBool(v.AsBool())
|
||||||
case INT64SLICE:
|
case INT64SLICE:
|
||||||
return fmt.Sprint(v.AsInt64Slice())
|
return fmt.Sprint(v.asInt64Slice())
|
||||||
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())
|
return fmt.Sprint(v.asFloat64Slice())
|
||||||
case FLOAT64:
|
case FLOAT64:
|
||||||
return fmt.Sprint(v.AsFloat64())
|
return fmt.Sprint(v.AsFloat64())
|
||||||
case STRINGSLICE:
|
case STRINGSLICE:
|
||||||
return fmt.Sprint(v.AsStringSlice())
|
return fmt.Sprint(v.asStringSlice())
|
||||||
case STRING:
|
case STRING:
|
||||||
return v.stringly
|
return v.stringly
|
||||||
default:
|
default:
|
||||||
|
10
vendor/go.opentelemetry.io/otel/codes/codes.go
generated
vendored
10
vendor/go.opentelemetry.io/otel/codes/codes.go
generated
vendored
@ -23,10 +23,20 @@ import (
|
|||||||
const (
|
const (
|
||||||
// Unset is the default status code.
|
// Unset is the default status code.
|
||||||
Unset Code = 0
|
Unset Code = 0
|
||||||
|
|
||||||
// Error indicates the operation contains an error.
|
// Error indicates the operation contains an error.
|
||||||
|
//
|
||||||
|
// NOTE: The error code in OTLP is 2.
|
||||||
|
// The value of this enum is only relevant to the internals
|
||||||
|
// of the Go SDK.
|
||||||
Error Code = 1
|
Error Code = 1
|
||||||
|
|
||||||
// Ok indicates operation has been validated by an Application developers
|
// Ok indicates operation has been validated by an Application developers
|
||||||
// or Operator to have completed successfully, or contain no error.
|
// or Operator to have completed successfully, or contain no error.
|
||||||
|
//
|
||||||
|
// NOTE: The Ok code in OTLP is 1.
|
||||||
|
// The value of this enum is only relevant to the internals
|
||||||
|
// of the Go SDK.
|
||||||
Ok Code = 2
|
Ok Code = 2
|
||||||
|
|
||||||
maxCode = 3
|
maxCode = 3
|
||||||
|
77
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go
generated
vendored
77
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go
generated
vendored
@ -23,6 +23,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/internal/global"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConfigFn is the generic function used to set a config.
|
// ConfigFn is the generic function used to set a config.
|
||||||
@ -59,13 +61,26 @@ func WithString(n string, fn func(string)) func(e *EnvOptionsReader) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithBool returns a ConfigFn that reads the environment variable n and if it exists passes its parsed bool value to fn.
|
||||||
|
func WithBool(n string, fn func(bool)) ConfigFn {
|
||||||
|
return func(e *EnvOptionsReader) {
|
||||||
|
if v, ok := e.GetEnvValue(n); ok {
|
||||||
|
b := strings.ToLower(v) == "true"
|
||||||
|
fn(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithDuration retrieves the specified config and passes it to ConfigFn as a duration.
|
// WithDuration retrieves the specified config and passes it to ConfigFn as a duration.
|
||||||
func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) {
|
func WithDuration(n string, fn func(time.Duration)) func(e *EnvOptionsReader) {
|
||||||
return func(e *EnvOptionsReader) {
|
return func(e *EnvOptionsReader) {
|
||||||
if v, ok := e.GetEnvValue(n); ok {
|
if v, ok := e.GetEnvValue(n); ok {
|
||||||
if d, err := strconv.Atoi(v); err == nil {
|
d, err := strconv.Atoi(v)
|
||||||
fn(time.Duration(d) * time.Millisecond)
|
if err != nil {
|
||||||
|
global.Error(err, "parse duration", "input", v)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
fn(time.Duration(d) * time.Millisecond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,23 +98,59 @@ func WithHeaders(n string, fn func(map[string]string)) func(e *EnvOptionsReader)
|
|||||||
func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) {
|
func WithURL(n string, fn func(*url.URL)) func(e *EnvOptionsReader) {
|
||||||
return func(e *EnvOptionsReader) {
|
return func(e *EnvOptionsReader) {
|
||||||
if v, ok := e.GetEnvValue(n); ok {
|
if v, ok := e.GetEnvValue(n); ok {
|
||||||
if u, err := url.Parse(v); err == nil {
|
u, err := url.Parse(v)
|
||||||
|
if err != nil {
|
||||||
|
global.Error(err, "parse url", "input", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
fn(u)
|
fn(u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// WithTLSConfig retrieves the specified config and passes it to ConfigFn as a crypto/tls.Config.
|
// WithCertPool returns a ConfigFn that reads the environment variable n as a filepath to a TLS certificate pool. If it exists, it is parsed as a crypto/x509.CertPool and it is passed to fn.
|
||||||
func WithTLSConfig(n string, fn func(*tls.Config)) func(e *EnvOptionsReader) {
|
func WithCertPool(n string, fn func(*x509.CertPool)) ConfigFn {
|
||||||
return func(e *EnvOptionsReader) {
|
return func(e *EnvOptionsReader) {
|
||||||
if v, ok := e.GetEnvValue(n); ok {
|
if v, ok := e.GetEnvValue(n); ok {
|
||||||
if b, err := e.ReadFile(v); err == nil {
|
b, err := e.ReadFile(v)
|
||||||
if c, err := createTLSConfig(b); err == nil {
|
if err != nil {
|
||||||
|
global.Error(err, "read tls ca cert file", "file", v)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c, err := createCertPool(b)
|
||||||
|
if err != nil {
|
||||||
|
global.Error(err, "create tls cert pool")
|
||||||
|
return
|
||||||
|
}
|
||||||
fn(c)
|
fn(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithClientCert returns a ConfigFn that reads the environment variable nc and nk as filepaths to a client certificate and key pair. If they exists, they are parsed as a crypto/tls.Certificate and it is passed to fn.
|
||||||
|
func WithClientCert(nc, nk string, fn func(tls.Certificate)) ConfigFn {
|
||||||
|
return func(e *EnvOptionsReader) {
|
||||||
|
vc, okc := e.GetEnvValue(nc)
|
||||||
|
vk, okk := e.GetEnvValue(nk)
|
||||||
|
if !okc || !okk {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
cert, err := e.ReadFile(vc)
|
||||||
|
if err != nil {
|
||||||
|
global.Error(err, "read tls client cert", "file", vc)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
key, err := e.ReadFile(vk)
|
||||||
|
if err != nil {
|
||||||
|
global.Error(err, "read tls client key", "file", vk)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
crt, err := tls.X509KeyPair(cert, key)
|
||||||
|
if err != nil {
|
||||||
|
global.Error(err, "create tls client key pair")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fn(crt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,15 +168,18 @@ func stringToHeader(value string) map[string]string {
|
|||||||
for _, header := range headersPairs {
|
for _, header := range headersPairs {
|
||||||
nameValue := strings.SplitN(header, "=", 2)
|
nameValue := strings.SplitN(header, "=", 2)
|
||||||
if len(nameValue) < 2 {
|
if len(nameValue) < 2 {
|
||||||
|
global.Error(errors.New("missing '="), "parse headers", "input", nameValue)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
name, err := url.QueryUnescape(nameValue[0])
|
name, err := url.QueryUnescape(nameValue[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
global.Error(err, "escape header key", "key", nameValue[0])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
trimmedName := strings.TrimSpace(name)
|
trimmedName := strings.TrimSpace(name)
|
||||||
value, err := url.QueryUnescape(nameValue[1])
|
value, err := url.QueryUnescape(nameValue[1])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
global.Error(err, "escape header value", "value", nameValue[1])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
trimmedValue := strings.TrimSpace(value)
|
trimmedValue := strings.TrimSpace(value)
|
||||||
@ -136,13 +190,10 @@ func stringToHeader(value string) map[string]string {
|
|||||||
return headers
|
return headers
|
||||||
}
|
}
|
||||||
|
|
||||||
func createTLSConfig(certBytes []byte) (*tls.Config, error) {
|
func createCertPool(certBytes []byte) (*x509.CertPool, error) {
|
||||||
cp := x509.NewCertPool()
|
cp := x509.NewCertPool()
|
||||||
if ok := cp.AppendCertsFromPEM(certBytes); !ok {
|
if ok := cp.AppendCertsFromPEM(certBytes); !ok {
|
||||||
return nil, errors.New("failed to append certificate to the cert pool")
|
return nil, errors.New("failed to append certificate to the cert pool")
|
||||||
}
|
}
|
||||||
|
return cp, nil
|
||||||
return &tls.Config{
|
|
||||||
RootCAs: cp,
|
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
34
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/partialsuccess.go
generated
vendored
34
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/partialsuccess.go
generated
vendored
@ -16,19 +16,6 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal"
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
// PartialSuccessDropKind indicates the kind of partial success error
|
|
||||||
// received by an OTLP exporter, which corresponds with the signal
|
|
||||||
// being exported.
|
|
||||||
type PartialSuccessDropKind string
|
|
||||||
|
|
||||||
const (
|
|
||||||
// TracingPartialSuccess indicates that some spans were rejected.
|
|
||||||
TracingPartialSuccess PartialSuccessDropKind = "spans"
|
|
||||||
|
|
||||||
// MetricsPartialSuccess indicates that some metric data points were rejected.
|
|
||||||
MetricsPartialSuccess PartialSuccessDropKind = "metric data points"
|
|
||||||
)
|
|
||||||
|
|
||||||
// PartialSuccess represents the underlying error for all handling
|
// PartialSuccess represents the underlying error for all handling
|
||||||
// OTLP partial success messages. Use `errors.Is(err,
|
// OTLP partial success messages. Use `errors.Is(err,
|
||||||
// PartialSuccess{})` to test whether an error passed to the OTel
|
// PartialSuccess{})` to test whether an error passed to the OTel
|
||||||
@ -36,7 +23,7 @@ const (
|
|||||||
type PartialSuccess struct {
|
type PartialSuccess struct {
|
||||||
ErrorMessage string
|
ErrorMessage string
|
||||||
RejectedItems int64
|
RejectedItems int64
|
||||||
RejectedKind PartialSuccessDropKind
|
RejectedKind string
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ error = PartialSuccess{}
|
var _ error = PartialSuccess{}
|
||||||
@ -56,13 +43,22 @@ func (ps PartialSuccess) Is(err error) bool {
|
|||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// PartialSuccessToError produces an error suitable for passing to
|
// TracePartialSuccessError returns an error describing a partial success
|
||||||
// `otel.Handle()` out of the fields in a partial success response,
|
// response for the trace signal.
|
||||||
// independent of which signal produced the outcome.
|
func TracePartialSuccessError(itemsRejected int64, errorMessage string) error {
|
||||||
func PartialSuccessToError(kind PartialSuccessDropKind, itemsRejected int64, errorMessage string) error {
|
|
||||||
return PartialSuccess{
|
return PartialSuccess{
|
||||||
ErrorMessage: errorMessage,
|
ErrorMessage: errorMessage,
|
||||||
RejectedItems: itemsRejected,
|
RejectedItems: itemsRejected,
|
||||||
RejectedKind: kind,
|
RejectedKind: "spans",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MetricPartialSuccessError returns an error describing a partial success
|
||||||
|
// response for the metric signal.
|
||||||
|
func MetricPartialSuccessError(itemsRejected int64, errorMessage string) error {
|
||||||
|
return PartialSuccess{
|
||||||
|
ErrorMessage: errorMessage,
|
||||||
|
RejectedItems: itemsRejected,
|
||||||
|
RejectedKind: "metric data points",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/retry.go
generated
vendored
7
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/retry/retry.go
generated
vendored
@ -119,8 +119,8 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc {
|
|||||||
delay = throttle
|
delay = throttle
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := waitFunc(ctx, delay); err != nil {
|
if ctxErr := waitFunc(ctx, delay); ctxErr != nil {
|
||||||
return err
|
return fmt.Errorf("%w: %s", ctxErr, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,6 +129,9 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc {
|
|||||||
// Allow override for testing.
|
// Allow override for testing.
|
||||||
var waitFunc = wait
|
var waitFunc = wait
|
||||||
|
|
||||||
|
// wait takes the caller's context, and the amount of time to wait. It will
|
||||||
|
// return nil if the timer fires before or at the same time as the context's
|
||||||
|
// deadline. This indicates that the call can be retried.
|
||||||
func wait(ctx context.Context, delay time.Duration) error {
|
func wait(ctx context.Context, delay time.Duration) error {
|
||||||
timer := time.NewTimer(delay)
|
timer := time.NewTimer(delay)
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
|
61
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/wrappederror.go
generated
vendored
Normal file
61
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/wrappederror.go
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// 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/exporters/otlp/internal"
|
||||||
|
|
||||||
|
// ErrorKind is used to identify the kind of export error
|
||||||
|
// being wrapped.
|
||||||
|
type ErrorKind int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// TracesExport indicates the error comes from the OTLP trace exporter.
|
||||||
|
TracesExport ErrorKind = iota
|
||||||
|
)
|
||||||
|
|
||||||
|
// prefix returns a prefix for the Error() string.
|
||||||
|
func (k ErrorKind) prefix() string {
|
||||||
|
switch k {
|
||||||
|
case TracesExport:
|
||||||
|
return "traces export: "
|
||||||
|
default:
|
||||||
|
return "unknown: "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wrappedExportError wraps an OTLP exporter error with the kind of
|
||||||
|
// signal that produced it.
|
||||||
|
type wrappedExportError struct {
|
||||||
|
wrap error
|
||||||
|
kind ErrorKind
|
||||||
|
}
|
||||||
|
|
||||||
|
// WrapTracesError wraps an error from the OTLP exporter for traces.
|
||||||
|
func WrapTracesError(err error) error {
|
||||||
|
return wrappedExportError{
|
||||||
|
wrap: err,
|
||||||
|
kind: TracesExport,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ error = wrappedExportError{}
|
||||||
|
|
||||||
|
// Error attaches a prefix corresponding to the kind of exporter.
|
||||||
|
func (t wrappedExportError) Error() string {
|
||||||
|
return t.kind.prefix() + t.wrap.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unwrap returns the wrapped error.
|
||||||
|
func (t wrappedExportError) Unwrap() error {
|
||||||
|
return t.wrap
|
||||||
|
}
|
4
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md
generated
vendored
4
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/README.md
generated
vendored
@ -12,8 +12,8 @@ go get -u go.opentelemetry.io/otel/exporters/otlp/otlptrace
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
- [Exporter setup and examples](./otlptracehttp/example_test.go)
|
- [HTTP Exporter setup and examples](./otlptracehttp/example_test.go)
|
||||||
- [Full example sending telemetry to a local collector](../../../example/otel-collector)
|
- [Full example of gRPC Exporter sending telemetry to a local collector](../../../example/otel-collector)
|
||||||
|
|
||||||
## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace)
|
## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace)
|
||||||
|
|
||||||
|
7
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go
generated
vendored
7
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go
generated
vendored
@ -19,6 +19,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/exporters/otlp/internal"
|
||||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform"
|
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform"
|
||||||
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
tracesdk "go.opentelemetry.io/otel/sdk/trace"
|
||||||
)
|
)
|
||||||
@ -45,7 +46,11 @@ func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return e.client.UploadTraces(ctx, protoSpans)
|
err := e.client.UploadTraces(ctx, protoSpans)
|
||||||
|
if err != nil {
|
||||||
|
return internal.WrapTracesError(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start establishes a connection to the receiving endpoint.
|
// Start establishes a connection to the receiving endpoint.
|
||||||
|
@ -16,6 +16,7 @@ package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"crypto/x509"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
@ -53,6 +54,7 @@ func ApplyHTTPEnvConfigs(cfg Config) Config {
|
|||||||
func getOptionsFromEnv() []GenericOption {
|
func getOptionsFromEnv() []GenericOption {
|
||||||
opts := []GenericOption{}
|
opts := []GenericOption{}
|
||||||
|
|
||||||
|
tlsConf := &tls.Config{}
|
||||||
DefaultEnvOptionsReader.Apply(
|
DefaultEnvOptionsReader.Apply(
|
||||||
envconfig.WithURL("ENDPOINT", func(u *url.URL) {
|
envconfig.WithURL("ENDPOINT", func(u *url.URL) {
|
||||||
opts = append(opts, withEndpointScheme(u))
|
opts = append(opts, withEndpointScheme(u))
|
||||||
@ -81,8 +83,13 @@ func getOptionsFromEnv() []GenericOption {
|
|||||||
return cfg
|
return cfg
|
||||||
}, withEndpointForGRPC(u)))
|
}, withEndpointForGRPC(u)))
|
||||||
}),
|
}),
|
||||||
envconfig.WithTLSConfig("CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }),
|
envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }),
|
||||||
envconfig.WithTLSConfig("TRACES_CERTIFICATE", func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }),
|
envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }),
|
||||||
|
envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }),
|
||||||
|
envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }),
|
||||||
|
withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }),
|
||||||
|
envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }),
|
||||||
|
envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }),
|
||||||
envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }),
|
envconfig.WithHeaders("HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }),
|
||||||
envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }),
|
envconfig.WithHeaders("TRACES_HEADERS", func(h map[string]string) { opts = append(opts, WithHeaders(h)) }),
|
||||||
WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }),
|
WithEnvCompression("COMPRESSION", func(c Compression) { opts = append(opts, WithCompression(c)) }),
|
||||||
@ -125,3 +132,19 @@ func WithEnvCompression(n string, fn func(Compression)) func(e *envconfig.EnvOpt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// revive:disable-next-line:flag-parameter
|
||||||
|
func withInsecure(b bool) GenericOption {
|
||||||
|
if b {
|
||||||
|
return WithInsecure()
|
||||||
|
}
|
||||||
|
return WithSecure()
|
||||||
|
}
|
||||||
|
|
||||||
|
func withTLSConfig(c *tls.Config, fn func(*tls.Config)) func(e *envconfig.EnvOptionsReader) {
|
||||||
|
return func(e *envconfig.EnvOptionsReader) {
|
||||||
|
if c.RootCAs != nil || len(c.Certificates) > 0 {
|
||||||
|
fn(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
11
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
generated
vendored
11
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
generated
vendored
@ -202,11 +202,12 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc
|
|||||||
ResourceSpans: protoSpans,
|
ResourceSpans: protoSpans,
|
||||||
})
|
})
|
||||||
if resp != nil && resp.PartialSuccess != nil {
|
if resp != nil && resp.PartialSuccess != nil {
|
||||||
otel.Handle(internal.PartialSuccessToError(
|
msg := resp.PartialSuccess.GetErrorMessage()
|
||||||
internal.TracingPartialSuccess,
|
n := resp.PartialSuccess.GetRejectedSpans()
|
||||||
resp.PartialSuccess.RejectedSpans,
|
if n != 0 || msg != "" {
|
||||||
resp.PartialSuccess.ErrorMessage,
|
err := internal.TracePartialSuccessError(n, msg)
|
||||||
))
|
otel.Handle(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// nil is converted to OK.
|
// nil is converted to OK.
|
||||||
if status.Code(err) == codes.OK {
|
if status.Code(err) == codes.OK {
|
||||||
|
13
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go
generated
vendored
13
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp/client.go
generated
vendored
@ -180,11 +180,12 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if respProto.PartialSuccess != nil {
|
if respProto.PartialSuccess != nil {
|
||||||
otel.Handle(internal.PartialSuccessToError(
|
msg := respProto.PartialSuccess.GetErrorMessage()
|
||||||
internal.TracingPartialSuccess,
|
n := respProto.PartialSuccess.GetRejectedSpans()
|
||||||
respProto.PartialSuccess.RejectedSpans,
|
if n != 0 || msg != "" {
|
||||||
respProto.PartialSuccess.ErrorMessage,
|
err := internal.TracePartialSuccessError(n, msg)
|
||||||
))
|
otel.Handle(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -196,7 +197,7 @@ func (d *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc
|
|||||||
}
|
}
|
||||||
return newResponseError(resp.Header)
|
return newResponseError(resp.Header)
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("failed to send %s to %s: %s", d.name, request.URL, resp.Status)
|
return fmt.Errorf("failed to send to %s: %s", request.URL, resp.Status)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
25
vendor/go.opentelemetry.io/otel/handler.go
generated
vendored
25
vendor/go.opentelemetry.io/otel/handler.go
generated
vendored
@ -17,7 +17,8 @@ package otel // import "go.opentelemetry.io/otel"
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync/atomic"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -34,28 +35,26 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type delegator struct {
|
type delegator struct {
|
||||||
lock *sync.RWMutex
|
delegate unsafe.Pointer
|
||||||
eh ErrorHandler
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *delegator) Handle(err error) {
|
func (d *delegator) Handle(err error) {
|
||||||
d.lock.RLock()
|
d.getDelegate().Handle(err)
|
||||||
defer d.lock.RUnlock()
|
}
|
||||||
d.eh.Handle(err)
|
|
||||||
|
func (d *delegator) getDelegate() ErrorHandler {
|
||||||
|
return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate))
|
||||||
}
|
}
|
||||||
|
|
||||||
// setDelegate sets the ErrorHandler delegate.
|
// setDelegate sets the ErrorHandler delegate.
|
||||||
func (d *delegator) setDelegate(eh ErrorHandler) {
|
func (d *delegator) setDelegate(eh ErrorHandler) {
|
||||||
d.lock.Lock()
|
atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh))
|
||||||
defer d.lock.Unlock()
|
|
||||||
d.eh = eh
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultErrorHandler() *delegator {
|
func defaultErrorHandler() *delegator {
|
||||||
return &delegator{
|
d := &delegator{}
|
||||||
lock: &sync.RWMutex{},
|
d.setDelegate(&errLogger{l: log.New(os.Stderr, "", log.LstdFlags)})
|
||||||
eh: &errLogger{l: log.New(os.Stderr, "", log.LstdFlags)},
|
return d
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// errLogger logs errors if no delegate is set, otherwise they are delegated.
|
// errLogger logs errors if no delegate is set, otherwise they are delegated.
|
||||||
|
30
vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
generated
vendored
30
vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
generated
vendored
@ -17,7 +17,8 @@ package global // import "go.opentelemetry.io/otel/internal/global"
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync/atomic"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
"github.com/go-logr/logr"
|
"github.com/go-logr/logr"
|
||||||
"github.com/go-logr/stdr"
|
"github.com/go-logr/stdr"
|
||||||
@ -27,37 +28,36 @@ import (
|
|||||||
//
|
//
|
||||||
// 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 logr.Logger = stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))
|
var globalLogger unsafe.Pointer
|
||||||
var globalLoggerLock = &sync.RWMutex{}
|
|
||||||
|
func init() {
|
||||||
|
SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)))
|
||||||
|
}
|
||||||
|
|
||||||
// SetLogger overrides the globalLogger with l.
|
// SetLogger overrides the globalLogger with l.
|
||||||
//
|
//
|
||||||
// To see Info messages use a logger with `l.V(1).Enabled() == true`
|
// To see Info messages use a logger with `l.V(1).Enabled() == true`
|
||||||
// To see Debug messages use a logger with `l.V(5).Enabled() == true`.
|
// To see Debug messages use a logger with `l.V(5).Enabled() == true`.
|
||||||
func SetLogger(l logr.Logger) {
|
func SetLogger(l logr.Logger) {
|
||||||
globalLoggerLock.Lock()
|
atomic.StorePointer(&globalLogger, unsafe.Pointer(&l))
|
||||||
defer globalLoggerLock.Unlock()
|
}
|
||||||
globalLogger = l
|
|
||||||
|
func getLogger() logr.Logger {
|
||||||
|
return *(*logr.Logger)(atomic.LoadPointer(&globalLogger))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 then 5 messages a minute.
|
// This should usually be less then 5 messages a minute.
|
||||||
func Info(msg string, keysAndValues ...interface{}) {
|
func Info(msg string, keysAndValues ...interface{}) {
|
||||||
globalLoggerLock.RLock()
|
getLogger().V(1).Info(msg, keysAndValues...)
|
||||||
defer globalLoggerLock.RUnlock()
|
|
||||||
globalLogger.V(1).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{}) {
|
||||||
globalLoggerLock.RLock()
|
getLogger().Error(err, msg, keysAndValues...)
|
||||||
defer globalLoggerLock.RUnlock()
|
|
||||||
globalLogger.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{}) {
|
||||||
globalLoggerLock.RLock()
|
getLogger().V(5).Info(msg, keysAndValues...)
|
||||||
defer globalLoggerLock.RUnlock()
|
|
||||||
globalLogger.V(5).Info(msg, keysAndValues...)
|
|
||||||
}
|
}
|
||||||
|
201
vendor/go.opentelemetry.io/otel/metric/LICENSE
generated
vendored
Normal file
201
vendor/go.opentelemetry.io/otel/metric/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
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.
|
69
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
Normal file
69
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// 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 metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
|
// MeterConfig contains options for Meters.
|
||||||
|
type MeterConfig struct {
|
||||||
|
instrumentationVersion string
|
||||||
|
schemaURL string
|
||||||
|
}
|
||||||
|
|
||||||
|
// InstrumentationVersion is the version of the library providing instrumentation.
|
||||||
|
func (cfg MeterConfig) InstrumentationVersion() string {
|
||||||
|
return cfg.instrumentationVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
// SchemaURL is the schema_url of the library providing instrumentation.
|
||||||
|
func (cfg MeterConfig) SchemaURL() string {
|
||||||
|
return cfg.schemaURL
|
||||||
|
}
|
||||||
|
|
||||||
|
// MeterOption is an interface for applying Meter options.
|
||||||
|
type MeterOption interface {
|
||||||
|
// applyMeter is used to set a MeterOption value of a MeterConfig.
|
||||||
|
applyMeter(MeterConfig) MeterConfig
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMeterConfig creates a new MeterConfig and applies
|
||||||
|
// all the given options.
|
||||||
|
func NewMeterConfig(opts ...MeterOption) MeterConfig {
|
||||||
|
var config MeterConfig
|
||||||
|
for _, o := range opts {
|
||||||
|
config = o.applyMeter(config)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
|
||||||
|
type meterOptionFunc func(MeterConfig) MeterConfig
|
||||||
|
|
||||||
|
func (fn meterOptionFunc) applyMeter(cfg MeterConfig) MeterConfig {
|
||||||
|
return fn(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithInstrumentationVersion sets the instrumentation version.
|
||||||
|
func WithInstrumentationVersion(version string) MeterOption {
|
||||||
|
return meterOptionFunc(func(config MeterConfig) MeterConfig {
|
||||||
|
config.instrumentationVersion = version
|
||||||
|
return config
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSchemaURL sets the schema URL.
|
||||||
|
func WithSchemaURL(schemaURL string) MeterOption {
|
||||||
|
return meterOptionFunc(func(config MeterConfig) MeterConfig {
|
||||||
|
config.schemaURL = schemaURL
|
||||||
|
return config
|
||||||
|
})
|
||||||
|
}
|
23
vendor/go.opentelemetry.io/otel/metric/doc.go
generated
vendored
Normal file
23
vendor/go.opentelemetry.io/otel/metric/doc.go
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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 metric provides an implementation of the metrics part of the
|
||||||
|
OpenTelemetry API.
|
||||||
|
|
||||||
|
This package is currently in a pre-GA phase. Backwards incompatible changes
|
||||||
|
may be introduced in subsequent minor version releases as we work to track the
|
||||||
|
evolving OpenTelemetry specification and user feedback.
|
||||||
|
*/
|
||||||
|
package metric // import "go.opentelemetry.io/otel/metric"
|
42
vendor/go.opentelemetry.io/otel/metric/global/global.go
generated
vendored
Normal file
42
vendor/go.opentelemetry.io/otel/metric/global/global.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
// 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 global // import "go.opentelemetry.io/otel/metric/global"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
"go.opentelemetry.io/otel/metric/internal/global"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Meter returns a Meter from the global MeterProvider. The
|
||||||
|
// instrumentationName must be the name of the library providing
|
||||||
|
// instrumentation. This name may be the same as the instrumented code only if
|
||||||
|
// that code provides built-in instrumentation. If the instrumentationName is
|
||||||
|
// empty, then a implementation defined default name will be used instead.
|
||||||
|
//
|
||||||
|
// This is short for MeterProvider().Meter(name).
|
||||||
|
func Meter(instrumentationName string, opts ...metric.MeterOption) metric.Meter {
|
||||||
|
return MeterProvider().Meter(instrumentationName, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MeterProvider returns the registered global trace provider.
|
||||||
|
// If none is registered then a No-op MeterProvider is returned.
|
||||||
|
func MeterProvider() metric.MeterProvider {
|
||||||
|
return global.MeterProvider()
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetMeterProvider registers `mp` as the global meter provider.
|
||||||
|
func SetMeterProvider(mp metric.MeterProvider) {
|
||||||
|
global.SetMeterProvider(mp)
|
||||||
|
}
|
80
vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64/asyncfloat64.go
generated
vendored
Normal file
80
vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64/asyncfloat64.go
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// 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 asyncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InstrumentProvider provides access to individual instruments.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type InstrumentProvider interface {
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
Counter(name string, opts ...instrument.Option) (Counter, error)
|
||||||
|
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error)
|
||||||
|
|
||||||
|
// Gauge creates an instrument for recording the current value.
|
||||||
|
Gauge(name string, opts ...instrument.Option) (Gauge, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counter is an instrument that records increasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Counter interface {
|
||||||
|
// Observe records the state of the instrument to be x. Implementations
|
||||||
|
// will assume x to be the cumulative sum of the count.
|
||||||
|
//
|
||||||
|
// It is only valid to call this within a callback. If called outside of the
|
||||||
|
// registered callback it should have no effect on the instrument, and an
|
||||||
|
// error will be reported via the error handler.
|
||||||
|
Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter is an instrument that records increasing or decreasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type UpDownCounter interface {
|
||||||
|
// Observe records the state of the instrument to be x. Implementations
|
||||||
|
// will assume x to be the cumulative sum of the count.
|
||||||
|
//
|
||||||
|
// It is only valid to call this within a callback. If called outside of the
|
||||||
|
// registered callback it should have no effect on the instrument, and an
|
||||||
|
// error will be reported via the error handler.
|
||||||
|
Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gauge is an instrument that records independent readings.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Gauge interface {
|
||||||
|
// Observe records the state of the instrument to be x.
|
||||||
|
//
|
||||||
|
// It is only valid to call this within a callback. If called outside of the
|
||||||
|
// registered callback it should have no effect on the instrument, and an
|
||||||
|
// error will be reported via the error handler.
|
||||||
|
Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
80
vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64/asyncint64.go
generated
vendored
Normal file
80
vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64/asyncint64.go
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// 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 asyncint64 // import "go.opentelemetry.io/otel/metric/instrument/asyncint64"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InstrumentProvider provides access to individual instruments.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type InstrumentProvider interface {
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
Counter(name string, opts ...instrument.Option) (Counter, error)
|
||||||
|
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error)
|
||||||
|
|
||||||
|
// Gauge creates an instrument for recording the current value.
|
||||||
|
Gauge(name string, opts ...instrument.Option) (Gauge, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counter is an instrument that records increasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Counter interface {
|
||||||
|
// Observe records the state of the instrument to be x. Implementations
|
||||||
|
// will assume x to be the cumulative sum of the count.
|
||||||
|
//
|
||||||
|
// It is only valid to call this within a callback. If called outside of the
|
||||||
|
// registered callback it should have no effect on the instrument, and an
|
||||||
|
// error will be reported via the error handler.
|
||||||
|
Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter is an instrument that records increasing or decreasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type UpDownCounter interface {
|
||||||
|
// Observe records the state of the instrument to be x. Implementations
|
||||||
|
// will assume x to be the cumulative sum of the count.
|
||||||
|
//
|
||||||
|
// It is only valid to call this within a callback. If called outside of the
|
||||||
|
// registered callback it should have no effect on the instrument, and an
|
||||||
|
// error will be reported via the error handler.
|
||||||
|
Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gauge is an instrument that records independent readings.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Gauge interface {
|
||||||
|
// Observe records the state of the instrument to be x.
|
||||||
|
//
|
||||||
|
// It is only valid to call this within a callback. If called outside of the
|
||||||
|
// registered callback it should have no effect on the instrument, and an
|
||||||
|
// error will be reported via the error handler.
|
||||||
|
Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
69
vendor/go.opentelemetry.io/otel/metric/instrument/config.go
generated
vendored
Normal file
69
vendor/go.opentelemetry.io/otel/metric/instrument/config.go
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
// 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 instrument // import "go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
|
||||||
|
import "go.opentelemetry.io/otel/metric/unit"
|
||||||
|
|
||||||
|
// Config contains options for metric instrument descriptors.
|
||||||
|
type Config struct {
|
||||||
|
description string
|
||||||
|
unit unit.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description describes the instrument in human-readable terms.
|
||||||
|
func (cfg Config) Description() string {
|
||||||
|
return cfg.description
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unit describes the measurement unit for an instrument.
|
||||||
|
func (cfg Config) Unit() unit.Unit {
|
||||||
|
return cfg.unit
|
||||||
|
}
|
||||||
|
|
||||||
|
// Option is an interface for applying metric instrument options.
|
||||||
|
type Option interface {
|
||||||
|
applyInstrument(Config) Config
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewConfig creates a new Config and applies all the given options.
|
||||||
|
func NewConfig(opts ...Option) Config {
|
||||||
|
var config Config
|
||||||
|
for _, o := range opts {
|
||||||
|
config = o.applyInstrument(config)
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
}
|
||||||
|
|
||||||
|
type optionFunc func(Config) Config
|
||||||
|
|
||||||
|
func (fn optionFunc) applyInstrument(cfg Config) Config {
|
||||||
|
return fn(cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithDescription applies provided description.
|
||||||
|
func WithDescription(desc string) Option {
|
||||||
|
return optionFunc(func(cfg Config) Config {
|
||||||
|
cfg.description = desc
|
||||||
|
return cfg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithUnit applies provided unit.
|
||||||
|
func WithUnit(u unit.Unit) Option {
|
||||||
|
return optionFunc(func(cfg Config) Config {
|
||||||
|
cfg.unit = u
|
||||||
|
return cfg
|
||||||
|
})
|
||||||
|
}
|
30
vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go
generated
vendored
Normal file
30
vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// 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 instrument // import "go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
|
||||||
|
// Asynchronous instruments are instruments that are updated within a Callback.
|
||||||
|
// If an instrument is observed outside of it's callback it should be an error.
|
||||||
|
//
|
||||||
|
// This interface is used as a grouping mechanism.
|
||||||
|
type Asynchronous interface {
|
||||||
|
asynchronous()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Synchronous instruments are updated in line with application code.
|
||||||
|
//
|
||||||
|
// This interface is used as a grouping mechanism.
|
||||||
|
type Synchronous interface {
|
||||||
|
synchronous()
|
||||||
|
}
|
64
vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64/syncfloat64.go
generated
vendored
Normal file
64
vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64/syncfloat64.go
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// 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 syncfloat64 // import "go.opentelemetry.io/otel/metric/instrument/syncfloat64"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InstrumentProvider provides access to individual instruments.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type InstrumentProvider interface {
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
Counter(name string, opts ...instrument.Option) (Counter, error)
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error)
|
||||||
|
// Histogram creates an instrument for recording a distribution of values.
|
||||||
|
Histogram(name string, opts ...instrument.Option) (Histogram, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counter is an instrument that records increasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Counter interface {
|
||||||
|
// Add records a change to the counter.
|
||||||
|
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter is an instrument that records increasing or decreasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type UpDownCounter interface {
|
||||||
|
// Add records a change to the counter.
|
||||||
|
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// Histogram is an instrument that records a distribution of values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Histogram interface {
|
||||||
|
// Record adds an additional value to the distribution.
|
||||||
|
Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
64
vendor/go.opentelemetry.io/otel/metric/instrument/syncint64/syncint64.go
generated
vendored
Normal file
64
vendor/go.opentelemetry.io/otel/metric/instrument/syncint64/syncint64.go
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// 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 syncint64 // import "go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
)
|
||||||
|
|
||||||
|
// InstrumentProvider provides access to individual instruments.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type InstrumentProvider interface {
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
Counter(name string, opts ...instrument.Option) (Counter, error)
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
UpDownCounter(name string, opts ...instrument.Option) (UpDownCounter, error)
|
||||||
|
// Histogram creates an instrument for recording a distribution of values.
|
||||||
|
Histogram(name string, opts ...instrument.Option) (Histogram, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counter is an instrument that records increasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Counter interface {
|
||||||
|
// Add records a change to the counter.
|
||||||
|
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter is an instrument that records increasing or decreasing values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type UpDownCounter interface {
|
||||||
|
// Add records a change to the counter.
|
||||||
|
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
// Histogram is an instrument that records a distribution of values.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Histogram interface {
|
||||||
|
// Record adds an additional value to the distribution.
|
||||||
|
Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
360
vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
generated
vendored
Normal file
360
vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
generated
vendored
Normal file
@ -0,0 +1,360 @@
|
|||||||
|
// 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 global // import "go.opentelemetry.io/otel/metric/internal/global"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync/atomic"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel"
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncint64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
|
)
|
||||||
|
|
||||||
|
type afCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //asyncfloat64.Counter
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.AsyncFloat64().Counter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(asyncfloat64.Counter).Observe(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afCounter) unwrap() instrument.Asynchronous {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
return ctr.(asyncfloat64.Counter)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type afUpDownCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //asyncfloat64.UpDownCounter
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afUpDownCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.AsyncFloat64().UpDownCounter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afUpDownCounter) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(asyncfloat64.UpDownCounter).Observe(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afUpDownCounter) unwrap() instrument.Asynchronous {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
return ctr.(asyncfloat64.UpDownCounter)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type afGauge struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //asyncfloat64.Gauge
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afGauge) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.AsyncFloat64().Gauge(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afGauge) Observe(ctx context.Context, x float64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(asyncfloat64.Gauge).Observe(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *afGauge) unwrap() instrument.Asynchronous {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
return ctr.(asyncfloat64.Gauge)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type aiCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //asyncint64.Counter
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.AsyncInt64().Counter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(asyncint64.Counter).Observe(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiCounter) unwrap() instrument.Asynchronous {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
return ctr.(asyncint64.Counter)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type aiUpDownCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //asyncint64.UpDownCounter
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiUpDownCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.AsyncInt64().UpDownCounter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiUpDownCounter) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(asyncint64.UpDownCounter).Observe(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiUpDownCounter) unwrap() instrument.Asynchronous {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
return ctr.(asyncint64.UpDownCounter)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type aiGauge struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //asyncint64.Gauge
|
||||||
|
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiGauge) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.AsyncInt64().Gauge(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiGauge) Observe(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(asyncint64.Gauge).Observe(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *aiGauge) unwrap() instrument.Asynchronous {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
return ctr.(asyncint64.Gauge)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sync Instruments.
|
||||||
|
type sfCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //syncfloat64.Counter
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.SyncFloat64().Counter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(syncfloat64.Counter).Add(ctx, incr, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type sfUpDownCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //syncfloat64.UpDownCounter
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfUpDownCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.SyncFloat64().UpDownCounter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(syncfloat64.UpDownCounter).Add(ctx, incr, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type sfHistogram struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //syncfloat64.Histogram
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfHistogram) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.SyncFloat64().Histogram(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *sfHistogram) Record(ctx context.Context, x float64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(syncfloat64.Histogram).Record(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type siCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //syncint64.Counter
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.SyncInt64().Counter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(syncint64.Counter).Add(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type siUpDownCounter struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //syncint64.UpDownCounter
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siUpDownCounter) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.SyncInt64().UpDownCounter(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siUpDownCounter) Add(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(syncint64.UpDownCounter).Add(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type siHistogram struct {
|
||||||
|
name string
|
||||||
|
opts []instrument.Option
|
||||||
|
|
||||||
|
delegate atomic.Value //syncint64.Histogram
|
||||||
|
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siHistogram) setDelegate(m metric.Meter) {
|
||||||
|
ctr, err := m.SyncInt64().Histogram(i.name, i.opts...)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
i.delegate.Store(ctr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i *siHistogram) Record(ctx context.Context, x int64, attrs ...attribute.KeyValue) {
|
||||||
|
if ctr := i.delegate.Load(); ctr != nil {
|
||||||
|
ctr.(syncint64.Histogram).Record(ctx, x, attrs...)
|
||||||
|
}
|
||||||
|
}
|
347
vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go
generated
vendored
Normal file
347
vendor/go.opentelemetry.io/otel/metric/internal/global/meter.go
generated
vendored
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
// 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 global // import "go.opentelemetry.io/otel/metric/internal/global"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel"
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncint64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
|
)
|
||||||
|
|
||||||
|
// meterProvider is a placeholder for a configured SDK MeterProvider.
|
||||||
|
//
|
||||||
|
// All MeterProvider functionality is forwarded to a delegate once
|
||||||
|
// configured.
|
||||||
|
type meterProvider struct {
|
||||||
|
mtx sync.Mutex
|
||||||
|
meters map[il]*meter
|
||||||
|
|
||||||
|
delegate metric.MeterProvider
|
||||||
|
}
|
||||||
|
|
||||||
|
type il struct {
|
||||||
|
name string
|
||||||
|
version string
|
||||||
|
}
|
||||||
|
|
||||||
|
// setDelegate configures p to delegate all MeterProvider functionality to
|
||||||
|
// provider.
|
||||||
|
//
|
||||||
|
// All Meters provided prior to this function call are switched out to be
|
||||||
|
// Meters provided by provider. All instruments and callbacks are recreated and
|
||||||
|
// delegated.
|
||||||
|
//
|
||||||
|
// It is guaranteed by the caller that this happens only once.
|
||||||
|
func (p *meterProvider) setDelegate(provider metric.MeterProvider) {
|
||||||
|
p.mtx.Lock()
|
||||||
|
defer p.mtx.Unlock()
|
||||||
|
|
||||||
|
p.delegate = provider
|
||||||
|
|
||||||
|
if len(p.meters) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, meter := range p.meters {
|
||||||
|
meter.setDelegate(provider)
|
||||||
|
}
|
||||||
|
|
||||||
|
p.meters = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Meter implements MeterProvider.
|
||||||
|
func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Meter {
|
||||||
|
p.mtx.Lock()
|
||||||
|
defer p.mtx.Unlock()
|
||||||
|
|
||||||
|
if p.delegate != nil {
|
||||||
|
return p.delegate.Meter(name, opts...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this moment it is guaranteed that no sdk is installed, save the meter in the meters map.
|
||||||
|
|
||||||
|
c := metric.NewMeterConfig(opts...)
|
||||||
|
key := il{
|
||||||
|
name: name,
|
||||||
|
version: c.InstrumentationVersion(),
|
||||||
|
}
|
||||||
|
|
||||||
|
if p.meters == nil {
|
||||||
|
p.meters = make(map[il]*meter)
|
||||||
|
}
|
||||||
|
|
||||||
|
if val, ok := p.meters[key]; ok {
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
|
||||||
|
t := &meter{name: name, opts: opts}
|
||||||
|
p.meters[key] = t
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
// meter is a placeholder for a metric.Meter.
|
||||||
|
//
|
||||||
|
// All Meter functionality is forwarded to a delegate once configured.
|
||||||
|
// Otherwise, all functionality is forwarded to a NoopMeter.
|
||||||
|
type meter struct {
|
||||||
|
name string
|
||||||
|
opts []metric.MeterOption
|
||||||
|
|
||||||
|
mtx sync.Mutex
|
||||||
|
instruments []delegatedInstrument
|
||||||
|
callbacks []delegatedCallback
|
||||||
|
|
||||||
|
delegate atomic.Value // metric.Meter
|
||||||
|
}
|
||||||
|
|
||||||
|
type delegatedInstrument interface {
|
||||||
|
setDelegate(metric.Meter)
|
||||||
|
}
|
||||||
|
|
||||||
|
// setDelegate configures m to delegate all Meter functionality to Meters
|
||||||
|
// created by provider.
|
||||||
|
//
|
||||||
|
// All subsequent calls to the Meter methods will be passed to the delegate.
|
||||||
|
//
|
||||||
|
// It is guaranteed by the caller that this happens only once.
|
||||||
|
func (m *meter) setDelegate(provider metric.MeterProvider) {
|
||||||
|
meter := provider.Meter(m.name, m.opts...)
|
||||||
|
m.delegate.Store(meter)
|
||||||
|
|
||||||
|
m.mtx.Lock()
|
||||||
|
defer m.mtx.Unlock()
|
||||||
|
|
||||||
|
for _, inst := range m.instruments {
|
||||||
|
inst.setDelegate(meter)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, callback := range m.callbacks {
|
||||||
|
callback.setDelegate(meter)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.instruments = nil
|
||||||
|
m.callbacks = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncInt64 is the namespace for the Asynchronous Integer instruments.
|
||||||
|
//
|
||||||
|
// To Observe data with instruments it must be registered in a callback.
|
||||||
|
func (m *meter) AsyncInt64() asyncint64.InstrumentProvider {
|
||||||
|
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||||
|
return del.AsyncInt64()
|
||||||
|
}
|
||||||
|
return (*aiInstProvider)(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncFloat64 is the namespace for the Asynchronous Float instruments.
|
||||||
|
//
|
||||||
|
// To Observe data with instruments it must be registered in a callback.
|
||||||
|
func (m *meter) AsyncFloat64() asyncfloat64.InstrumentProvider {
|
||||||
|
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||||
|
return del.AsyncFloat64()
|
||||||
|
}
|
||||||
|
return (*afInstProvider)(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCallback captures the function that will be called during Collect.
|
||||||
|
//
|
||||||
|
// It is only valid to call Observe within the scope of the passed function,
|
||||||
|
// and only on the instruments that were registered with this call.
|
||||||
|
func (m *meter) RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error {
|
||||||
|
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||||
|
insts = unwrapInstruments(insts)
|
||||||
|
return del.RegisterCallback(insts, function)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.mtx.Lock()
|
||||||
|
defer m.mtx.Unlock()
|
||||||
|
m.callbacks = append(m.callbacks, delegatedCallback{
|
||||||
|
instruments: insts,
|
||||||
|
function: function,
|
||||||
|
})
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type wrapped interface {
|
||||||
|
unwrap() instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous {
|
||||||
|
out := make([]instrument.Asynchronous, 0, len(instruments))
|
||||||
|
|
||||||
|
for _, inst := range instruments {
|
||||||
|
if in, ok := inst.(wrapped); ok {
|
||||||
|
out = append(out, in.unwrap())
|
||||||
|
} else {
|
||||||
|
out = append(out, inst)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// SyncInt64 is the namespace for the Synchronous Integer instruments.
|
||||||
|
func (m *meter) SyncInt64() syncint64.InstrumentProvider {
|
||||||
|
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||||
|
return del.SyncInt64()
|
||||||
|
}
|
||||||
|
return (*siInstProvider)(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SyncFloat64 is the namespace for the Synchronous Float instruments.
|
||||||
|
func (m *meter) SyncFloat64() syncfloat64.InstrumentProvider {
|
||||||
|
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||||
|
return del.SyncFloat64()
|
||||||
|
}
|
||||||
|
return (*sfInstProvider)(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
type delegatedCallback struct {
|
||||||
|
instruments []instrument.Asynchronous
|
||||||
|
function func(context.Context)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *delegatedCallback) setDelegate(m metric.Meter) {
|
||||||
|
insts := unwrapInstruments(c.instruments)
|
||||||
|
err := m.RegisterCallback(insts, c.function)
|
||||||
|
if err != nil {
|
||||||
|
otel.Handle(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type afInstProvider meter
|
||||||
|
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
func (ip *afInstProvider) Counter(name string, opts ...instrument.Option) (asyncfloat64.Counter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &afCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
func (ip *afInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncfloat64.UpDownCounter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &afUpDownCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gauge creates an instrument for recording the current value.
|
||||||
|
func (ip *afInstProvider) Gauge(name string, opts ...instrument.Option) (asyncfloat64.Gauge, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &afGauge{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type aiInstProvider meter
|
||||||
|
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
func (ip *aiInstProvider) Counter(name string, opts ...instrument.Option) (asyncint64.Counter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &aiCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
func (ip *aiInstProvider) UpDownCounter(name string, opts ...instrument.Option) (asyncint64.UpDownCounter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &aiUpDownCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gauge creates an instrument for recording the current value.
|
||||||
|
func (ip *aiInstProvider) Gauge(name string, opts ...instrument.Option) (asyncint64.Gauge, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &aiGauge{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type sfInstProvider meter
|
||||||
|
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
func (ip *sfInstProvider) Counter(name string, opts ...instrument.Option) (syncfloat64.Counter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &sfCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
func (ip *sfInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncfloat64.UpDownCounter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &sfUpDownCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Histogram creates an instrument for recording a distribution of values.
|
||||||
|
func (ip *sfInstProvider) Histogram(name string, opts ...instrument.Option) (syncfloat64.Histogram, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &sfHistogram{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type siInstProvider meter
|
||||||
|
|
||||||
|
// Counter creates an instrument for recording increasing values.
|
||||||
|
func (ip *siInstProvider) Counter(name string, opts ...instrument.Option) (syncint64.Counter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &siCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UpDownCounter creates an instrument for recording changes of a value.
|
||||||
|
func (ip *siInstProvider) UpDownCounter(name string, opts ...instrument.Option) (syncint64.UpDownCounter, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &siUpDownCounter{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Histogram creates an instrument for recording a distribution of values.
|
||||||
|
func (ip *siInstProvider) Histogram(name string, opts ...instrument.Option) (syncint64.Histogram, error) {
|
||||||
|
ip.mtx.Lock()
|
||||||
|
defer ip.mtx.Unlock()
|
||||||
|
ctr := &siHistogram{name: name, opts: opts}
|
||||||
|
ip.instruments = append(ip.instruments, ctr)
|
||||||
|
return ctr, nil
|
||||||
|
}
|
68
vendor/go.opentelemetry.io/otel/metric/internal/global/state.go
generated
vendored
Normal file
68
vendor/go.opentelemetry.io/otel/metric/internal/global/state.go
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// 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
|
||||||
|
//
|
||||||
|
// htmp://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/metric/internal/global"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/internal/global"
|
||||||
|
"go.opentelemetry.io/otel/metric"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
globalMeterProvider = defaultMeterProvider()
|
||||||
|
|
||||||
|
delegateMeterOnce sync.Once
|
||||||
|
)
|
||||||
|
|
||||||
|
type meterProviderHolder struct {
|
||||||
|
mp metric.MeterProvider
|
||||||
|
}
|
||||||
|
|
||||||
|
// MeterProvider is the internal implementation for global.MeterProvider.
|
||||||
|
func MeterProvider() metric.MeterProvider {
|
||||||
|
return globalMeterProvider.Load().(meterProviderHolder).mp
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetMeterProvider is the internal implementation for global.SetMeterProvider.
|
||||||
|
func SetMeterProvider(mp metric.MeterProvider) {
|
||||||
|
current := MeterProvider()
|
||||||
|
if _, cOk := current.(*meterProvider); cOk {
|
||||||
|
if _, mpOk := mp.(*meterProvider); mpOk && current == mp {
|
||||||
|
// Do not assign the default delegating MeterProvider to delegate
|
||||||
|
// to itself.
|
||||||
|
global.Error(
|
||||||
|
errors.New("no delegate configured in meter provider"),
|
||||||
|
"Setting meter provider to it's current value. No delegate will be configured",
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delegateMeterOnce.Do(func() {
|
||||||
|
if def, ok := current.(*meterProvider); ok {
|
||||||
|
def.setDelegate(mp)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
globalMeterProvider.Store(meterProviderHolder{mp: mp})
|
||||||
|
}
|
||||||
|
|
||||||
|
func defaultMeterProvider() *atomic.Value {
|
||||||
|
v := &atomic.Value{}
|
||||||
|
v.Store(meterProviderHolder{mp: &meterProvider{}})
|
||||||
|
return v
|
||||||
|
}
|
64
vendor/go.opentelemetry.io/otel/metric/meter.go
generated
vendored
Normal file
64
vendor/go.opentelemetry.io/otel/metric/meter.go
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// 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 metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncint64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MeterProvider provides access to named Meter instances, for instrumenting
|
||||||
|
// an application or library.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type MeterProvider interface {
|
||||||
|
// Meter creates an instance of a `Meter` interface. The instrumentationName
|
||||||
|
// must be the name of the library providing instrumentation. This name may
|
||||||
|
// be the same as the instrumented code only if that code provides built-in
|
||||||
|
// instrumentation. If the instrumentationName is empty, then a
|
||||||
|
// implementation defined default name will be used instead.
|
||||||
|
Meter(instrumentationName string, opts ...MeterOption) Meter
|
||||||
|
}
|
||||||
|
|
||||||
|
// Meter provides access to instrument instances for recording metrics.
|
||||||
|
//
|
||||||
|
// Warning: methods may be added to this interface in minor releases.
|
||||||
|
type Meter interface {
|
||||||
|
// AsyncInt64 is the namespace for the Asynchronous Integer instruments.
|
||||||
|
//
|
||||||
|
// To Observe data with instruments it must be registered in a callback.
|
||||||
|
AsyncInt64() asyncint64.InstrumentProvider
|
||||||
|
|
||||||
|
// AsyncFloat64 is the namespace for the Asynchronous Float instruments
|
||||||
|
//
|
||||||
|
// To Observe data with instruments it must be registered in a callback.
|
||||||
|
AsyncFloat64() asyncfloat64.InstrumentProvider
|
||||||
|
|
||||||
|
// RegisterCallback captures the function that will be called during Collect.
|
||||||
|
//
|
||||||
|
// It is only valid to call Observe within the scope of the passed function,
|
||||||
|
// and only on the instruments that were registered with this call.
|
||||||
|
RegisterCallback(insts []instrument.Asynchronous, function func(context.Context)) error
|
||||||
|
|
||||||
|
// SyncInt64 is the namespace for the Synchronous Integer instruments
|
||||||
|
SyncInt64() syncint64.InstrumentProvider
|
||||||
|
// SyncFloat64 is the namespace for the Synchronous Float instruments
|
||||||
|
SyncFloat64() syncfloat64.InstrumentProvider
|
||||||
|
}
|
181
vendor/go.opentelemetry.io/otel/metric/noop.go
generated
vendored
Normal file
181
vendor/go.opentelemetry.io/otel/metric/noop.go
generated
vendored
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
// 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 metric // import "go.opentelemetry.io/otel/metric"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/asyncint64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncfloat64"
|
||||||
|
"go.opentelemetry.io/otel/metric/instrument/syncint64"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewNoopMeterProvider creates a MeterProvider that does not record any metrics.
|
||||||
|
func NewNoopMeterProvider() MeterProvider {
|
||||||
|
return noopMeterProvider{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type noopMeterProvider struct{}
|
||||||
|
|
||||||
|
func (noopMeterProvider) Meter(string, ...MeterOption) Meter {
|
||||||
|
return noopMeter{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewNoopMeter creates a Meter that does not record any metrics.
|
||||||
|
func NewNoopMeter() Meter {
|
||||||
|
return noopMeter{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type noopMeter struct{}
|
||||||
|
|
||||||
|
// AsyncInt64 creates an instrument that does not record any metrics.
|
||||||
|
func (noopMeter) AsyncInt64() asyncint64.InstrumentProvider {
|
||||||
|
return nonrecordingAsyncInt64Instrument{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AsyncFloat64 creates an instrument that does not record any metrics.
|
||||||
|
func (noopMeter) AsyncFloat64() asyncfloat64.InstrumentProvider {
|
||||||
|
return nonrecordingAsyncFloat64Instrument{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SyncInt64 creates an instrument that does not record any metrics.
|
||||||
|
func (noopMeter) SyncInt64() syncint64.InstrumentProvider {
|
||||||
|
return nonrecordingSyncInt64Instrument{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SyncFloat64 creates an instrument that does not record any metrics.
|
||||||
|
func (noopMeter) SyncFloat64() syncfloat64.InstrumentProvider {
|
||||||
|
return nonrecordingSyncFloat64Instrument{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RegisterCallback creates a register callback that does not record any metrics.
|
||||||
|
func (noopMeter) RegisterCallback([]instrument.Asynchronous, func(context.Context)) error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type nonrecordingAsyncFloat64Instrument struct {
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ asyncfloat64.InstrumentProvider = nonrecordingAsyncFloat64Instrument{}
|
||||||
|
_ asyncfloat64.Counter = nonrecordingAsyncFloat64Instrument{}
|
||||||
|
_ asyncfloat64.UpDownCounter = nonrecordingAsyncFloat64Instrument{}
|
||||||
|
_ asyncfloat64.Gauge = nonrecordingAsyncFloat64Instrument{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (n nonrecordingAsyncFloat64Instrument) Counter(string, ...instrument.Option) (asyncfloat64.Counter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingAsyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (asyncfloat64.UpDownCounter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingAsyncFloat64Instrument) Gauge(string, ...instrument.Option) (asyncfloat64.Gauge, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nonrecordingAsyncFloat64Instrument) Observe(context.Context, float64, ...attribute.KeyValue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type nonrecordingAsyncInt64Instrument struct {
|
||||||
|
instrument.Asynchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ asyncint64.InstrumentProvider = nonrecordingAsyncInt64Instrument{}
|
||||||
|
_ asyncint64.Counter = nonrecordingAsyncInt64Instrument{}
|
||||||
|
_ asyncint64.UpDownCounter = nonrecordingAsyncInt64Instrument{}
|
||||||
|
_ asyncint64.Gauge = nonrecordingAsyncInt64Instrument{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (n nonrecordingAsyncInt64Instrument) Counter(string, ...instrument.Option) (asyncint64.Counter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingAsyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (asyncint64.UpDownCounter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingAsyncInt64Instrument) Gauge(string, ...instrument.Option) (asyncint64.Gauge, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nonrecordingAsyncInt64Instrument) Observe(context.Context, int64, ...attribute.KeyValue) {
|
||||||
|
}
|
||||||
|
|
||||||
|
type nonrecordingSyncFloat64Instrument struct {
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ syncfloat64.InstrumentProvider = nonrecordingSyncFloat64Instrument{}
|
||||||
|
_ syncfloat64.Counter = nonrecordingSyncFloat64Instrument{}
|
||||||
|
_ syncfloat64.UpDownCounter = nonrecordingSyncFloat64Instrument{}
|
||||||
|
_ syncfloat64.Histogram = nonrecordingSyncFloat64Instrument{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (n nonrecordingSyncFloat64Instrument) Counter(string, ...instrument.Option) (syncfloat64.Counter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingSyncFloat64Instrument) UpDownCounter(string, ...instrument.Option) (syncfloat64.UpDownCounter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingSyncFloat64Instrument) Histogram(string, ...instrument.Option) (syncfloat64.Histogram, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
type nonrecordingSyncInt64Instrument struct {
|
||||||
|
instrument.Synchronous
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ syncint64.InstrumentProvider = nonrecordingSyncInt64Instrument{}
|
||||||
|
_ syncint64.Counter = nonrecordingSyncInt64Instrument{}
|
||||||
|
_ syncint64.UpDownCounter = nonrecordingSyncInt64Instrument{}
|
||||||
|
_ syncint64.Histogram = nonrecordingSyncInt64Instrument{}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (n nonrecordingSyncInt64Instrument) Counter(string, ...instrument.Option) (syncint64.Counter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingSyncInt64Instrument) UpDownCounter(string, ...instrument.Option) (syncint64.UpDownCounter, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (n nonrecordingSyncInt64Instrument) Histogram(string, ...instrument.Option) (syncint64.Histogram, error) {
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {
|
||||||
|
}
|
||||||
|
func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {
|
||||||
|
}
|
20
vendor/go.opentelemetry.io/otel/metric/unit/doc.go
generated
vendored
Normal file
20
vendor/go.opentelemetry.io/otel/metric/unit/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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 unit provides units.
|
||||||
|
//
|
||||||
|
// This package is currently in a pre-GA phase. Backwards incompatible changes
|
||||||
|
// may be introduced in subsequent minor version releases as we work to track
|
||||||
|
// the evolving OpenTelemetry specification and user feedback.
|
||||||
|
package unit // import "go.opentelemetry.io/otel/metric/unit"
|
25
vendor/go.opentelemetry.io/otel/metric/unit/unit.go
generated
vendored
Normal file
25
vendor/go.opentelemetry.io/otel/metric/unit/unit.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// 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 unit // import "go.opentelemetry.io/otel/metric/unit"
|
||||||
|
|
||||||
|
// Unit is a determinate standard quantity of measurement.
|
||||||
|
type Unit string
|
||||||
|
|
||||||
|
// Units defined by OpenTelemetry.
|
||||||
|
const (
|
||||||
|
Dimensionless Unit = "1"
|
||||||
|
Bytes Unit = "By"
|
||||||
|
Milliseconds Unit = "ms"
|
||||||
|
)
|
2
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
@ -22,7 +22,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.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
|
2
vendor/go.opentelemetry.io/otel/sdk/resource/container.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/resource/container.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type containerIDProvider func() (string, error)
|
type containerIDProvider func() (string, error)
|
||||||
|
2
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
@ -23,7 +23,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.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
2
vendor/go.opentelemetry.io/otel/sdk/resource/os.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/resource/os.go
generated
vendored
@ -19,7 +19,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
"go.opentelemetry.io/otel/attribute"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type osDescriptionProvider func() (string, error)
|
type osDescriptionProvider func() (string, error)
|
||||||
|
2
vendor/go.opentelemetry.io/otel/sdk/resource/process.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/resource/process.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
)
|
)
|
||||||
|
|
||||||
type pidProvider func() int
|
type pidProvider func() int
|
||||||
|
15
vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
generated
vendored
15
vendor/go.opentelemetry.io/otel/sdk/trace/provider.go
generated
vendored
@ -76,6 +76,7 @@ type TracerProvider struct {
|
|||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
namedTracer map[instrumentation.Scope]*tracer
|
namedTracer map[instrumentation.Scope]*tracer
|
||||||
spanProcessors atomic.Value
|
spanProcessors atomic.Value
|
||||||
|
isShutdown bool
|
||||||
|
|
||||||
// These fields are not protected by the lock mu. They are assumed to be
|
// These fields are not protected by the lock mu. They are assumed to be
|
||||||
// immutable after creation of the TracerProvider.
|
// immutable after creation of the TracerProvider.
|
||||||
@ -163,6 +164,9 @@ func (p *TracerProvider) Tracer(name string, opts ...trace.TracerOption) trace.T
|
|||||||
func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) {
|
func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
|
if p.isShutdown {
|
||||||
|
return
|
||||||
|
}
|
||||||
newSPS := spanProcessorStates{}
|
newSPS := spanProcessorStates{}
|
||||||
newSPS = append(newSPS, p.spanProcessors.Load().(spanProcessorStates)...)
|
newSPS = append(newSPS, p.spanProcessors.Load().(spanProcessorStates)...)
|
||||||
newSPS = append(newSPS, newSpanProcessorState(sp))
|
newSPS = append(newSPS, newSpanProcessorState(sp))
|
||||||
@ -173,6 +177,9 @@ func (p *TracerProvider) RegisterSpanProcessor(sp SpanProcessor) {
|
|||||||
func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) {
|
func (p *TracerProvider) UnregisterSpanProcessor(sp SpanProcessor) {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
|
if p.isShutdown {
|
||||||
|
return
|
||||||
|
}
|
||||||
old := p.spanProcessors.Load().(spanProcessorStates)
|
old := p.spanProcessors.Load().(spanProcessorStates)
|
||||||
if len(old) == 0 {
|
if len(old) == 0 {
|
||||||
return
|
return
|
||||||
@ -227,13 +234,18 @@ func (p *TracerProvider) ForceFlush(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown shuts down the span processors in the order they were registered.
|
// Shutdown shuts down TracerProvider. All registered span processors are shut down
|
||||||
|
// in the order they were registered and any held computational resources are released.
|
||||||
func (p *TracerProvider) Shutdown(ctx context.Context) error {
|
func (p *TracerProvider) Shutdown(ctx context.Context) error {
|
||||||
spss := p.spanProcessors.Load().(spanProcessorStates)
|
spss := p.spanProcessors.Load().(spanProcessorStates)
|
||||||
if len(spss) == 0 {
|
if len(spss) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.mu.Lock()
|
||||||
|
defer p.mu.Unlock()
|
||||||
|
p.isShutdown = true
|
||||||
|
|
||||||
var retErr error
|
var retErr error
|
||||||
for _, sps := range spss {
|
for _, sps := range spss {
|
||||||
select {
|
select {
|
||||||
@ -255,6 +267,7 @@ func (p *TracerProvider) Shutdown(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
p.spanProcessors.Store(spanProcessorStates{})
|
||||||
return retErr
|
return retErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/trace/sampling.go
generated
vendored
@ -81,7 +81,7 @@ type traceIDRatioSampler struct {
|
|||||||
|
|
||||||
func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
func (ts traceIDRatioSampler) ShouldSample(p SamplingParameters) SamplingResult {
|
||||||
psc := trace.SpanContextFromContext(p.ParentContext)
|
psc := trace.SpanContextFromContext(p.ParentContext)
|
||||||
x := binary.BigEndian.Uint64(p.TraceID[0:8]) >> 1
|
x := binary.BigEndian.Uint64(p.TraceID[8:16]) >> 1
|
||||||
if x < ts.traceIDUpperBound {
|
if x < ts.traceIDUpperBound {
|
||||||
return SamplingResult{
|
return SamplingResult{
|
||||||
Decision: RecordAndSample,
|
Decision: RecordAndSample,
|
||||||
|
2
vendor/go.opentelemetry.io/otel/sdk/trace/span.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/sdk/trace/span.go
generated
vendored
@ -30,7 +30,7 @@ import (
|
|||||||
"go.opentelemetry.io/otel/sdk/instrumentation"
|
"go.opentelemetry.io/otel/sdk/instrumentation"
|
||||||
"go.opentelemetry.io/otel/sdk/internal"
|
"go.opentelemetry.io/otel/sdk/internal"
|
||||||
"go.opentelemetry.io/otel/sdk/resource"
|
"go.opentelemetry.io/otel/sdk/resource"
|
||||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
"go.opentelemetry.io/otel/trace"
|
"go.opentelemetry.io/otel/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
405
vendor/go.opentelemetry.io/otel/semconv/internal/v2/http.go
generated
vendored
Normal file
405
vendor/go.opentelemetry.io/otel/semconv/internal/v2/http.go
generated
vendored
Normal file
@ -0,0 +1,405 @@
|
|||||||
|
// 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/semconv/internal/v2"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HTTPConv are the HTTP semantic convention attributes defined for a version
|
||||||
|
// of the OpenTelemetry specification.
|
||||||
|
type HTTPConv struct {
|
||||||
|
NetConv *NetConv
|
||||||
|
|
||||||
|
EnduserIDKey attribute.Key
|
||||||
|
HTTPClientIPKey attribute.Key
|
||||||
|
HTTPFlavorKey attribute.Key
|
||||||
|
HTTPMethodKey attribute.Key
|
||||||
|
HTTPRequestContentLengthKey attribute.Key
|
||||||
|
HTTPResponseContentLengthKey attribute.Key
|
||||||
|
HTTPRouteKey attribute.Key
|
||||||
|
HTTPSchemeHTTP attribute.KeyValue
|
||||||
|
HTTPSchemeHTTPS attribute.KeyValue
|
||||||
|
HTTPStatusCodeKey attribute.Key
|
||||||
|
HTTPTargetKey attribute.Key
|
||||||
|
HTTPURLKey attribute.Key
|
||||||
|
HTTPUserAgentKey attribute.Key
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientResponse returns attributes for an HTTP response received by a client
|
||||||
|
// from a server. The following attributes are returned if the related values
|
||||||
|
// are defined in resp: "http.status.code", "http.response_content_length".
|
||||||
|
//
|
||||||
|
// This does not add all OpenTelemetry required attributes for an HTTP event,
|
||||||
|
// it assumes ClientRequest was used to create the span with a complete set of
|
||||||
|
// attributes. If a complete set of attributes can be generated using the
|
||||||
|
// request contained in resp. For example:
|
||||||
|
//
|
||||||
|
// append(ClientResponse(resp), ClientRequest(resp.Request)...)
|
||||||
|
func (c *HTTPConv) ClientResponse(resp *http.Response) []attribute.KeyValue {
|
||||||
|
var n int
|
||||||
|
if resp.StatusCode > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
if resp.ContentLength > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs := make([]attribute.KeyValue, 0, n)
|
||||||
|
if resp.StatusCode > 0 {
|
||||||
|
attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode))
|
||||||
|
}
|
||||||
|
if resp.ContentLength > 0 {
|
||||||
|
attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength)))
|
||||||
|
}
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientRequest returns attributes for an HTTP request made by a client. The
|
||||||
|
// following attributes are always returned: "http.url", "http.flavor",
|
||||||
|
// "http.method", "net.peer.name". The following attributes are returned if the
|
||||||
|
// related values are defined in req: "net.peer.port", "http.user_agent",
|
||||||
|
// "http.request_content_length", "enduser.id".
|
||||||
|
func (c *HTTPConv) ClientRequest(req *http.Request) []attribute.KeyValue {
|
||||||
|
n := 3 // URL, peer name, proto, and method.
|
||||||
|
var h string
|
||||||
|
if req.URL != nil {
|
||||||
|
h = req.URL.Host
|
||||||
|
}
|
||||||
|
peer, p := firstHostPort(h, req.Header.Get("Host"))
|
||||||
|
port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p)
|
||||||
|
if port > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
useragent := req.UserAgent()
|
||||||
|
if useragent != "" {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
if req.ContentLength > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
userID, _, hasUserID := req.BasicAuth()
|
||||||
|
if hasUserID {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
attrs := make([]attribute.KeyValue, 0, n)
|
||||||
|
|
||||||
|
attrs = append(attrs, c.method(req.Method))
|
||||||
|
attrs = append(attrs, c.proto(req.Proto))
|
||||||
|
|
||||||
|
var u string
|
||||||
|
if req.URL != nil {
|
||||||
|
// Remove any username/password info that may be in the URL.
|
||||||
|
userinfo := req.URL.User
|
||||||
|
req.URL.User = nil
|
||||||
|
u = req.URL.String()
|
||||||
|
// Restore any username/password info that was removed.
|
||||||
|
req.URL.User = userinfo
|
||||||
|
}
|
||||||
|
attrs = append(attrs, c.HTTPURLKey.String(u))
|
||||||
|
|
||||||
|
attrs = append(attrs, c.NetConv.PeerName(peer))
|
||||||
|
if port > 0 {
|
||||||
|
attrs = append(attrs, c.NetConv.PeerPort(port))
|
||||||
|
}
|
||||||
|
|
||||||
|
if useragent != "" {
|
||||||
|
attrs = append(attrs, c.HTTPUserAgentKey.String(useragent))
|
||||||
|
}
|
||||||
|
|
||||||
|
if l := req.ContentLength; l > 0 {
|
||||||
|
attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l))
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasUserID {
|
||||||
|
attrs = append(attrs, c.EnduserIDKey.String(userID))
|
||||||
|
}
|
||||||
|
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerRequest returns attributes for an HTTP request received by a server.
|
||||||
|
//
|
||||||
|
// The server must be the primary server name if it is known. For example this
|
||||||
|
// would be the ServerName directive
|
||||||
|
// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache
|
||||||
|
// server, and the server_name directive
|
||||||
|
// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an
|
||||||
|
// nginx server. More generically, the primary server name would be the host
|
||||||
|
// header value that matches the default virtual host of an HTTP server. It
|
||||||
|
// should include the host identifier and if a port is used to route to the
|
||||||
|
// server that port identifier should be included as an appropriate port
|
||||||
|
// suffix.
|
||||||
|
//
|
||||||
|
// If the primary server name is not known, server should be an empty string.
|
||||||
|
// The req Host will be used to determine the server instead.
|
||||||
|
//
|
||||||
|
// The following attributes are always returned: "http.method", "http.scheme",
|
||||||
|
// "http.flavor", "http.target", "net.host.name". The following attributes are
|
||||||
|
// returned if they related values are defined in req: "net.host.port",
|
||||||
|
// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id",
|
||||||
|
// "http.client_ip".
|
||||||
|
func (c *HTTPConv) ServerRequest(server string, req *http.Request) []attribute.KeyValue {
|
||||||
|
n := 5 // Method, scheme, target, proto, and host name.
|
||||||
|
var host string
|
||||||
|
var p int
|
||||||
|
if server == "" {
|
||||||
|
host, p = splitHostPort(req.Host)
|
||||||
|
} else {
|
||||||
|
// Prioritize the primary server name.
|
||||||
|
host, p = splitHostPort(server)
|
||||||
|
if p < 0 {
|
||||||
|
_, p = splitHostPort(req.Host)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hostPort := requiredHTTPPort(req.TLS != nil, p)
|
||||||
|
if hostPort > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
peer, peerPort := splitHostPort(req.RemoteAddr)
|
||||||
|
if peer != "" {
|
||||||
|
n++
|
||||||
|
if peerPort > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useragent := req.UserAgent()
|
||||||
|
if useragent != "" {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
userID, _, hasUserID := req.BasicAuth()
|
||||||
|
if hasUserID {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
clientIP := serverClientIP(req.Header.Get("X-Forwarded-For"))
|
||||||
|
if clientIP != "" {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
attrs := make([]attribute.KeyValue, 0, n)
|
||||||
|
|
||||||
|
attrs = append(attrs, c.method(req.Method))
|
||||||
|
attrs = append(attrs, c.scheme(req.TLS != nil))
|
||||||
|
attrs = append(attrs, c.proto(req.Proto))
|
||||||
|
attrs = append(attrs, c.NetConv.HostName(host))
|
||||||
|
|
||||||
|
if req.URL != nil {
|
||||||
|
attrs = append(attrs, c.HTTPTargetKey.String(req.URL.RequestURI()))
|
||||||
|
} else {
|
||||||
|
// This should never occur if the request was generated by the net/http
|
||||||
|
// package. Fail gracefully, if it does though.
|
||||||
|
attrs = append(attrs, c.HTTPTargetKey.String(req.RequestURI))
|
||||||
|
}
|
||||||
|
|
||||||
|
if hostPort > 0 {
|
||||||
|
attrs = append(attrs, c.NetConv.HostPort(hostPort))
|
||||||
|
}
|
||||||
|
|
||||||
|
if peer != "" {
|
||||||
|
// The Go HTTP server sets RemoteAddr to "IP:port", this will not be a
|
||||||
|
// file-path that would be interpreted with a sock family.
|
||||||
|
attrs = append(attrs, c.NetConv.SockPeerAddr(peer))
|
||||||
|
if peerPort > 0 {
|
||||||
|
attrs = append(attrs, c.NetConv.SockPeerPort(peerPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if useragent != "" {
|
||||||
|
attrs = append(attrs, c.HTTPUserAgentKey.String(useragent))
|
||||||
|
}
|
||||||
|
|
||||||
|
if hasUserID {
|
||||||
|
attrs = append(attrs, c.EnduserIDKey.String(userID))
|
||||||
|
}
|
||||||
|
|
||||||
|
if clientIP != "" {
|
||||||
|
attrs = append(attrs, c.HTTPClientIPKey.String(clientIP))
|
||||||
|
}
|
||||||
|
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HTTPConv) method(method string) attribute.KeyValue {
|
||||||
|
if method == "" {
|
||||||
|
return c.HTTPMethodKey.String(http.MethodGet)
|
||||||
|
}
|
||||||
|
return c.HTTPMethodKey.String(method)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HTTPConv) scheme(https bool) attribute.KeyValue { // nolint:revive
|
||||||
|
if https {
|
||||||
|
return c.HTTPSchemeHTTPS
|
||||||
|
}
|
||||||
|
return c.HTTPSchemeHTTP
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HTTPConv) proto(proto string) attribute.KeyValue {
|
||||||
|
switch proto {
|
||||||
|
case "HTTP/1.0":
|
||||||
|
return c.HTTPFlavorKey.String("1.0")
|
||||||
|
case "HTTP/1.1":
|
||||||
|
return c.HTTPFlavorKey.String("1.1")
|
||||||
|
case "HTTP/2":
|
||||||
|
return c.HTTPFlavorKey.String("2.0")
|
||||||
|
case "HTTP/3":
|
||||||
|
return c.HTTPFlavorKey.String("3.0")
|
||||||
|
default:
|
||||||
|
return c.HTTPFlavorKey.String(proto)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func serverClientIP(xForwardedFor string) string {
|
||||||
|
if idx := strings.Index(xForwardedFor, ","); idx >= 0 {
|
||||||
|
xForwardedFor = xForwardedFor[:idx]
|
||||||
|
}
|
||||||
|
return xForwardedFor
|
||||||
|
}
|
||||||
|
|
||||||
|
func requiredHTTPPort(https bool, port int) int { // nolint:revive
|
||||||
|
if https {
|
||||||
|
if port > 0 && port != 443 {
|
||||||
|
return port
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if port > 0 && port != 80 {
|
||||||
|
return port
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the request host and port from the first non-empty source.
|
||||||
|
func firstHostPort(source ...string) (host string, port int) {
|
||||||
|
for _, hostport := range source {
|
||||||
|
host, port = splitHostPort(hostport)
|
||||||
|
if host != "" || port > 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// RequestHeader returns the contents of h as OpenTelemetry attributes.
|
||||||
|
func (c *HTTPConv) RequestHeader(h http.Header) []attribute.KeyValue {
|
||||||
|
return c.header("http.request.header", h)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResponseHeader returns the contents of h as OpenTelemetry attributes.
|
||||||
|
func (c *HTTPConv) ResponseHeader(h http.Header) []attribute.KeyValue {
|
||||||
|
return c.header("http.response.header", h)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *HTTPConv) header(prefix string, h http.Header) []attribute.KeyValue {
|
||||||
|
key := func(k string) attribute.Key {
|
||||||
|
k = strings.ToLower(k)
|
||||||
|
k = strings.ReplaceAll(k, "-", "_")
|
||||||
|
k = fmt.Sprintf("%s.%s", prefix, k)
|
||||||
|
return attribute.Key(k)
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs := make([]attribute.KeyValue, 0, len(h))
|
||||||
|
for k, v := range h {
|
||||||
|
attrs = append(attrs, key(k).StringSlice(v))
|
||||||
|
}
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientStatus returns a span status code and message for an HTTP status code
|
||||||
|
// value received by a client.
|
||||||
|
func (c *HTTPConv) ClientStatus(code int) (codes.Code, string) {
|
||||||
|
stat, valid := validateHTTPStatusCode(code)
|
||||||
|
if !valid {
|
||||||
|
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||||
|
}
|
||||||
|
return stat, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerStatus returns a span status code and message for an HTTP status code
|
||||||
|
// value returned by a server. Status codes in the 400-499 range are not
|
||||||
|
// returned as errors.
|
||||||
|
func (c *HTTPConv) ServerStatus(code int) (codes.Code, string) {
|
||||||
|
stat, valid := validateHTTPStatusCode(code)
|
||||||
|
if !valid {
|
||||||
|
return stat, fmt.Sprintf("Invalid HTTP status code %d", code)
|
||||||
|
}
|
||||||
|
|
||||||
|
if code/100 == 4 {
|
||||||
|
return codes.Unset, ""
|
||||||
|
}
|
||||||
|
return stat, ""
|
||||||
|
}
|
||||||
|
|
||||||
|
type codeRange struct {
|
||||||
|
fromInclusive int
|
||||||
|
toInclusive int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r codeRange) contains(code int) bool {
|
||||||
|
return r.fromInclusive <= code && code <= r.toInclusive
|
||||||
|
}
|
||||||
|
|
||||||
|
var validRangesPerCategory = map[int][]codeRange{
|
||||||
|
1: {
|
||||||
|
{http.StatusContinue, http.StatusEarlyHints},
|
||||||
|
},
|
||||||
|
2: {
|
||||||
|
{http.StatusOK, http.StatusAlreadyReported},
|
||||||
|
{http.StatusIMUsed, http.StatusIMUsed},
|
||||||
|
},
|
||||||
|
3: {
|
||||||
|
{http.StatusMultipleChoices, http.StatusUseProxy},
|
||||||
|
{http.StatusTemporaryRedirect, http.StatusPermanentRedirect},
|
||||||
|
},
|
||||||
|
4: {
|
||||||
|
{http.StatusBadRequest, http.StatusTeapot}, // yes, teapot is so useful…
|
||||||
|
{http.StatusMisdirectedRequest, http.StatusUpgradeRequired},
|
||||||
|
{http.StatusPreconditionRequired, http.StatusTooManyRequests},
|
||||||
|
{http.StatusRequestHeaderFieldsTooLarge, http.StatusRequestHeaderFieldsTooLarge},
|
||||||
|
{http.StatusUnavailableForLegalReasons, http.StatusUnavailableForLegalReasons},
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
{http.StatusInternalServerError, http.StatusLoopDetected},
|
||||||
|
{http.StatusNotExtended, http.StatusNetworkAuthenticationRequired},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// validateHTTPStatusCode validates the HTTP status code and returns
|
||||||
|
// corresponding span status code. If the `code` is not a valid HTTP status
|
||||||
|
// code, returns span status Error and false.
|
||||||
|
func validateHTTPStatusCode(code int) (codes.Code, bool) {
|
||||||
|
category := code / 100
|
||||||
|
ranges, ok := validRangesPerCategory[category]
|
||||||
|
if !ok {
|
||||||
|
return codes.Error, false
|
||||||
|
}
|
||||||
|
ok = false
|
||||||
|
for _, crange := range ranges {
|
||||||
|
ok = crange.contains(code)
|
||||||
|
if ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !ok {
|
||||||
|
return codes.Error, false
|
||||||
|
}
|
||||||
|
if category > 0 && category < 4 {
|
||||||
|
return codes.Unset, true
|
||||||
|
}
|
||||||
|
return codes.Error, true
|
||||||
|
}
|
324
vendor/go.opentelemetry.io/otel/semconv/internal/v2/net.go
generated
vendored
Normal file
324
vendor/go.opentelemetry.io/otel/semconv/internal/v2/net.go
generated
vendored
Normal file
@ -0,0 +1,324 @@
|
|||||||
|
// 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/semconv/internal/v2"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
)
|
||||||
|
|
||||||
|
// NetConv are the network semantic convention attributes defined for a version
|
||||||
|
// of the OpenTelemetry specification.
|
||||||
|
type NetConv struct {
|
||||||
|
NetHostNameKey attribute.Key
|
||||||
|
NetHostPortKey attribute.Key
|
||||||
|
NetPeerNameKey attribute.Key
|
||||||
|
NetPeerPortKey attribute.Key
|
||||||
|
NetSockFamilyKey attribute.Key
|
||||||
|
NetSockPeerAddrKey attribute.Key
|
||||||
|
NetSockPeerPortKey attribute.Key
|
||||||
|
NetSockHostAddrKey attribute.Key
|
||||||
|
NetSockHostPortKey attribute.Key
|
||||||
|
NetTransportOther attribute.KeyValue
|
||||||
|
NetTransportTCP attribute.KeyValue
|
||||||
|
NetTransportUDP attribute.KeyValue
|
||||||
|
NetTransportInProc attribute.KeyValue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) Transport(network string) attribute.KeyValue {
|
||||||
|
switch network {
|
||||||
|
case "tcp", "tcp4", "tcp6":
|
||||||
|
return c.NetTransportTCP
|
||||||
|
case "udp", "udp4", "udp6":
|
||||||
|
return c.NetTransportUDP
|
||||||
|
case "unix", "unixgram", "unixpacket":
|
||||||
|
return c.NetTransportInProc
|
||||||
|
default:
|
||||||
|
// "ip:*", "ip4:*", and "ip6:*" all are considered other.
|
||||||
|
return c.NetTransportOther
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Host returns attributes for a network host address.
|
||||||
|
func (c *NetConv) Host(address string) []attribute.KeyValue {
|
||||||
|
h, p := splitHostPort(address)
|
||||||
|
var n int
|
||||||
|
if h != "" {
|
||||||
|
n++
|
||||||
|
if p > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs := make([]attribute.KeyValue, 0, n)
|
||||||
|
attrs = append(attrs, c.HostName(h))
|
||||||
|
if p > 0 {
|
||||||
|
attrs = append(attrs, c.HostPort(int(p)))
|
||||||
|
}
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Server returns attributes for a network listener listening at address. See
|
||||||
|
// net.Listen for information about acceptable address values, address should
|
||||||
|
// be the same as the one used to create ln. If ln is nil, only network host
|
||||||
|
// attributes will be returned that describe address. Otherwise, the socket
|
||||||
|
// level information about ln will also be included.
|
||||||
|
func (c *NetConv) Server(address string, ln net.Listener) []attribute.KeyValue {
|
||||||
|
if ln == nil {
|
||||||
|
return c.Host(address)
|
||||||
|
}
|
||||||
|
|
||||||
|
lAddr := ln.Addr()
|
||||||
|
if lAddr == nil {
|
||||||
|
return c.Host(address)
|
||||||
|
}
|
||||||
|
|
||||||
|
hostName, hostPort := splitHostPort(address)
|
||||||
|
sockHostAddr, sockHostPort := splitHostPort(lAddr.String())
|
||||||
|
network := lAddr.Network()
|
||||||
|
sockFamily := family(network, sockHostAddr)
|
||||||
|
|
||||||
|
n := nonZeroStr(hostName, network, sockHostAddr, sockFamily)
|
||||||
|
n += positiveInt(hostPort, sockHostPort)
|
||||||
|
attr := make([]attribute.KeyValue, 0, n)
|
||||||
|
if hostName != "" {
|
||||||
|
attr = append(attr, c.HostName(hostName))
|
||||||
|
if hostPort > 0 {
|
||||||
|
// Only if net.host.name is set should net.host.port be.
|
||||||
|
attr = append(attr, c.HostPort(hostPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if network != "" {
|
||||||
|
attr = append(attr, c.Transport(network))
|
||||||
|
}
|
||||||
|
if sockFamily != "" {
|
||||||
|
attr = append(attr, c.NetSockFamilyKey.String(sockFamily))
|
||||||
|
}
|
||||||
|
if sockHostAddr != "" {
|
||||||
|
attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr))
|
||||||
|
if sockHostPort > 0 {
|
||||||
|
// Only if net.sock.host.addr is set should net.sock.host.port be.
|
||||||
|
attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return attr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) HostName(name string) attribute.KeyValue {
|
||||||
|
return c.NetHostNameKey.String(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) HostPort(port int) attribute.KeyValue {
|
||||||
|
return c.NetHostPortKey.Int(port)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client returns attributes for a client network connection to address. See
|
||||||
|
// net.Dial for information about acceptable address values, address should be
|
||||||
|
// the same as the one used to create conn. If conn is nil, only network peer
|
||||||
|
// attributes will be returned that describe address. Otherwise, the socket
|
||||||
|
// level information about conn will also be included.
|
||||||
|
func (c *NetConv) Client(address string, conn net.Conn) []attribute.KeyValue {
|
||||||
|
if conn == nil {
|
||||||
|
return c.Peer(address)
|
||||||
|
}
|
||||||
|
|
||||||
|
lAddr, rAddr := conn.LocalAddr(), conn.RemoteAddr()
|
||||||
|
|
||||||
|
var network string
|
||||||
|
switch {
|
||||||
|
case lAddr != nil:
|
||||||
|
network = lAddr.Network()
|
||||||
|
case rAddr != nil:
|
||||||
|
network = rAddr.Network()
|
||||||
|
default:
|
||||||
|
return c.Peer(address)
|
||||||
|
}
|
||||||
|
|
||||||
|
peerName, peerPort := splitHostPort(address)
|
||||||
|
var (
|
||||||
|
sockFamily string
|
||||||
|
sockPeerAddr string
|
||||||
|
sockPeerPort int
|
||||||
|
sockHostAddr string
|
||||||
|
sockHostPort int
|
||||||
|
)
|
||||||
|
|
||||||
|
if lAddr != nil {
|
||||||
|
sockHostAddr, sockHostPort = splitHostPort(lAddr.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
if rAddr != nil {
|
||||||
|
sockPeerAddr, sockPeerPort = splitHostPort(rAddr.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case sockHostAddr != "":
|
||||||
|
sockFamily = family(network, sockHostAddr)
|
||||||
|
case sockPeerAddr != "":
|
||||||
|
sockFamily = family(network, sockPeerAddr)
|
||||||
|
}
|
||||||
|
|
||||||
|
n := nonZeroStr(peerName, network, sockPeerAddr, sockHostAddr, sockFamily)
|
||||||
|
n += positiveInt(peerPort, sockPeerPort, sockHostPort)
|
||||||
|
attr := make([]attribute.KeyValue, 0, n)
|
||||||
|
if peerName != "" {
|
||||||
|
attr = append(attr, c.PeerName(peerName))
|
||||||
|
if peerPort > 0 {
|
||||||
|
// Only if net.peer.name is set should net.peer.port be.
|
||||||
|
attr = append(attr, c.PeerPort(peerPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if network != "" {
|
||||||
|
attr = append(attr, c.Transport(network))
|
||||||
|
}
|
||||||
|
if sockFamily != "" {
|
||||||
|
attr = append(attr, c.NetSockFamilyKey.String(sockFamily))
|
||||||
|
}
|
||||||
|
if sockPeerAddr != "" {
|
||||||
|
attr = append(attr, c.NetSockPeerAddrKey.String(sockPeerAddr))
|
||||||
|
if sockPeerPort > 0 {
|
||||||
|
// Only if net.sock.peer.addr is set should net.sock.peer.port be.
|
||||||
|
attr = append(attr, c.NetSockPeerPortKey.Int(sockPeerPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if sockHostAddr != "" {
|
||||||
|
attr = append(attr, c.NetSockHostAddrKey.String(sockHostAddr))
|
||||||
|
if sockHostPort > 0 {
|
||||||
|
// Only if net.sock.host.addr is set should net.sock.host.port be.
|
||||||
|
attr = append(attr, c.NetSockHostPortKey.Int(sockHostPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return attr
|
||||||
|
}
|
||||||
|
|
||||||
|
func family(network, address string) string {
|
||||||
|
switch network {
|
||||||
|
case "unix", "unixgram", "unixpacket":
|
||||||
|
return "unix"
|
||||||
|
default:
|
||||||
|
if ip := net.ParseIP(address); ip != nil {
|
||||||
|
if ip.To4() == nil {
|
||||||
|
return "inet6"
|
||||||
|
}
|
||||||
|
return "inet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func nonZeroStr(strs ...string) int {
|
||||||
|
var n int
|
||||||
|
for _, str := range strs {
|
||||||
|
if str != "" {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func positiveInt(ints ...int) int {
|
||||||
|
var n int
|
||||||
|
for _, i := range ints {
|
||||||
|
if i > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
// Peer returns attributes for a network peer address.
|
||||||
|
func (c *NetConv) Peer(address string) []attribute.KeyValue {
|
||||||
|
h, p := splitHostPort(address)
|
||||||
|
var n int
|
||||||
|
if h != "" {
|
||||||
|
n++
|
||||||
|
if p > 0 {
|
||||||
|
n++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if n == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
attrs := make([]attribute.KeyValue, 0, n)
|
||||||
|
attrs = append(attrs, c.PeerName(h))
|
||||||
|
if p > 0 {
|
||||||
|
attrs = append(attrs, c.PeerPort(int(p)))
|
||||||
|
}
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) PeerName(name string) attribute.KeyValue {
|
||||||
|
return c.NetPeerNameKey.String(name)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) PeerPort(port int) attribute.KeyValue {
|
||||||
|
return c.NetPeerPortKey.Int(port)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) SockPeerAddr(addr string) attribute.KeyValue {
|
||||||
|
return c.NetSockPeerAddrKey.String(addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *NetConv) SockPeerPort(port int) attribute.KeyValue {
|
||||||
|
return c.NetSockPeerPortKey.Int(port)
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitHostPort splits a network address hostport of the form "host",
|
||||||
|
// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port",
|
||||||
|
// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and
|
||||||
|
// port.
|
||||||
|
//
|
||||||
|
// An empty host is returned if it is not provided or unparsable. A negative
|
||||||
|
// port is returned if it is not provided or unparsable.
|
||||||
|
func splitHostPort(hostport string) (host string, port int) {
|
||||||
|
port = -1
|
||||||
|
|
||||||
|
if strings.HasPrefix(hostport, "[") {
|
||||||
|
addrEnd := strings.LastIndex(hostport, "]")
|
||||||
|
if addrEnd < 0 {
|
||||||
|
// Invalid hostport.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 {
|
||||||
|
host = hostport[1:addrEnd]
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if i := strings.LastIndex(hostport, ":"); i < 0 {
|
||||||
|
host = hostport
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
host, pStr, err := net.SplitHostPort(hostport)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
p, err := strconv.ParseUint(pStr, 10, 16)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return host, int(p)
|
||||||
|
}
|
20
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go
generated
vendored
Normal file
20
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/doc.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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 semconv implements OpenTelemetry semantic conventions.
|
||||||
|
//
|
||||||
|
// OpenTelemetry semantic conventions are agreed standardized naming
|
||||||
|
// patterns for OpenTelemetry things. This package represents the conventions
|
||||||
|
// as of the v1.17.0 version of the OpenTelemetry specification.
|
||||||
|
package semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0"
|
20
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go
generated
vendored
Normal file
20
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/exception.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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 semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// ExceptionEventName is the name of the Span event representing an exception.
|
||||||
|
ExceptionEventName = "exception"
|
||||||
|
)
|
21
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go
generated
vendored
Normal file
21
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/http.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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 semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
|
|
||||||
|
// HTTP scheme attributes.
|
||||||
|
var (
|
||||||
|
HTTPSchemeHTTP = HTTPSchemeKey.String("http")
|
||||||
|
HTTPSchemeHTTPS = HTTPSchemeKey.String("https")
|
||||||
|
)
|
150
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go
generated
vendored
Normal file
150
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/httpconv/http.go
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
// 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 httpconv provides OpenTelemetry semantic convetions for the net/http
|
||||||
|
// package from the standard library.
|
||||||
|
package httpconv // import "go.opentelemetry.io/otel/semconv/v1.17.0/httpconv"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"go.opentelemetry.io/otel/attribute"
|
||||||
|
"go.opentelemetry.io/otel/codes"
|
||||||
|
"go.opentelemetry.io/otel/semconv/internal/v2"
|
||||||
|
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
nc = &internal.NetConv{
|
||||||
|
NetHostNameKey: semconv.NetHostNameKey,
|
||||||
|
NetHostPortKey: semconv.NetHostPortKey,
|
||||||
|
NetPeerNameKey: semconv.NetPeerNameKey,
|
||||||
|
NetPeerPortKey: semconv.NetPeerPortKey,
|
||||||
|
NetSockPeerAddrKey: semconv.NetSockPeerAddrKey,
|
||||||
|
NetSockPeerPortKey: semconv.NetSockPeerPortKey,
|
||||||
|
NetTransportOther: semconv.NetTransportOther,
|
||||||
|
NetTransportTCP: semconv.NetTransportTCP,
|
||||||
|
NetTransportUDP: semconv.NetTransportUDP,
|
||||||
|
NetTransportInProc: semconv.NetTransportInProc,
|
||||||
|
}
|
||||||
|
|
||||||
|
hc = &internal.HTTPConv{
|
||||||
|
NetConv: nc,
|
||||||
|
|
||||||
|
EnduserIDKey: semconv.EnduserIDKey,
|
||||||
|
HTTPClientIPKey: semconv.HTTPClientIPKey,
|
||||||
|
HTTPFlavorKey: semconv.HTTPFlavorKey,
|
||||||
|
HTTPMethodKey: semconv.HTTPMethodKey,
|
||||||
|
HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey,
|
||||||
|
HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey,
|
||||||
|
HTTPRouteKey: semconv.HTTPRouteKey,
|
||||||
|
HTTPSchemeHTTP: semconv.HTTPSchemeHTTP,
|
||||||
|
HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS,
|
||||||
|
HTTPStatusCodeKey: semconv.HTTPStatusCodeKey,
|
||||||
|
HTTPTargetKey: semconv.HTTPTargetKey,
|
||||||
|
HTTPURLKey: semconv.HTTPURLKey,
|
||||||
|
HTTPUserAgentKey: semconv.HTTPUserAgentKey,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClientResponse returns attributes for an HTTP response received by a client
|
||||||
|
// from a server. It will return the following attributes if the related values
|
||||||
|
// are defined in resp: "http.status.code", "http.response_content_length".
|
||||||
|
//
|
||||||
|
// This does not add all OpenTelemetry required attributes for an HTTP event,
|
||||||
|
// it assumes ClientRequest was used to create the span with a complete set of
|
||||||
|
// attributes. If a complete set of attributes can be generated using the
|
||||||
|
// request contained in resp. For example:
|
||||||
|
//
|
||||||
|
// append(ClientResponse(resp), ClientRequest(resp.Request)...)
|
||||||
|
func ClientResponse(resp *http.Response) []attribute.KeyValue {
|
||||||
|
return hc.ClientResponse(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientRequest returns attributes for an HTTP request made by a client. The
|
||||||
|
// following attributes are always returned: "http.url", "http.flavor",
|
||||||
|
// "http.method", "net.peer.name". The following attributes are returned if the
|
||||||
|
// related values are defined in req: "net.peer.port", "http.user_agent",
|
||||||
|
// "http.request_content_length", "enduser.id".
|
||||||
|
func ClientRequest(req *http.Request) []attribute.KeyValue {
|
||||||
|
return hc.ClientRequest(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ClientStatus returns a span status code and message for an HTTP status code
|
||||||
|
// value received by a client.
|
||||||
|
func ClientStatus(code int) (codes.Code, string) {
|
||||||
|
return hc.ClientStatus(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerRequest returns attributes for an HTTP request received by a server.
|
||||||
|
//
|
||||||
|
// The server must be the primary server name if it is known. For example this
|
||||||
|
// would be the ServerName directive
|
||||||
|
// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache
|
||||||
|
// server, and the server_name directive
|
||||||
|
// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an
|
||||||
|
// nginx server. More generically, the primary server name would be the host
|
||||||
|
// header value that matches the default virtual host of an HTTP server. It
|
||||||
|
// should include the host identifier and if a port is used to route to the
|
||||||
|
// server that port identifier should be included as an appropriate port
|
||||||
|
// suffix.
|
||||||
|
//
|
||||||
|
// If the primary server name is not known, server should be an empty string.
|
||||||
|
// The req Host will be used to determine the server instead.
|
||||||
|
//
|
||||||
|
// The following attributes are always returned: "http.method", "http.scheme",
|
||||||
|
// "http.flavor", "http.target", "net.host.name". The following attributes are
|
||||||
|
// returned if they related values are defined in req: "net.host.port",
|
||||||
|
// "net.sock.peer.addr", "net.sock.peer.port", "http.user_agent", "enduser.id",
|
||||||
|
// "http.client_ip".
|
||||||
|
func ServerRequest(server string, req *http.Request) []attribute.KeyValue {
|
||||||
|
return hc.ServerRequest(server, req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ServerStatus returns a span status code and message for an HTTP status code
|
||||||
|
// value returned by a server. Status codes in the 400-499 range are not
|
||||||
|
// returned as errors.
|
||||||
|
func ServerStatus(code int) (codes.Code, string) {
|
||||||
|
return hc.ServerStatus(code)
|
||||||
|
}
|
||||||
|
|
||||||
|
// RequestHeader returns the contents of h as attributes.
|
||||||
|
//
|
||||||
|
// Instrumentation should require an explicit configuration of which headers to
|
||||||
|
// captured and then prune what they pass here. Including all headers can be a
|
||||||
|
// security risk - explicit configuration helps avoid leaking sensitive
|
||||||
|
// information.
|
||||||
|
//
|
||||||
|
// The User-Agent header is already captured in the http.user_agent attribute
|
||||||
|
// from ClientRequest and ServerRequest. Instrumentation may provide an option
|
||||||
|
// to capture that header here even though it is not recommended. Otherwise,
|
||||||
|
// instrumentation should filter that out of what is passed.
|
||||||
|
func RequestHeader(h http.Header) []attribute.KeyValue {
|
||||||
|
return hc.RequestHeader(h)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ResponseHeader returns the contents of h as attributes.
|
||||||
|
//
|
||||||
|
// Instrumentation should require an explicit configuration of which headers to
|
||||||
|
// captured and then prune what they pass here. Including all headers can be a
|
||||||
|
// security risk - explicit configuration helps avoid leaking sensitive
|
||||||
|
// information.
|
||||||
|
//
|
||||||
|
// The User-Agent header is already captured in the http.user_agent attribute
|
||||||
|
// from ClientRequest and ServerRequest. Instrumentation may provide an option
|
||||||
|
// to capture that header here even though it is not recommended. Otherwise,
|
||||||
|
// instrumentation should filter that out of what is passed.
|
||||||
|
func ResponseHeader(h http.Header) []attribute.KeyValue {
|
||||||
|
return hc.ResponseHeader(h)
|
||||||
|
}
|
1118
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go
generated
vendored
Normal file
1118
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/resource.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
20
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go
generated
vendored
Normal file
20
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/schema.go
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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 semconv // import "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||||
|
|
||||||
|
// SchemaURL is the schema URL that matches the version of the semantic conventions
|
||||||
|
// that this package defines. Semconv packages starting from v1.4.0 must declare
|
||||||
|
// non-empty schema URL in the form https://opentelemetry.io/schemas/<version>
|
||||||
|
const SchemaURL = "https://opentelemetry.io/schemas/1.17.0"
|
1892
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go
generated
vendored
Normal file
1892
vendor/go.opentelemetry.io/otel/semconv/v1.17.0/trace.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
vendor/go.opentelemetry.io/otel/trace/doc.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/trace/doc.go
generated
vendored
@ -17,7 +17,7 @@ Package trace provides an implementation of the tracing part of the
|
|||||||
OpenTelemetry API.
|
OpenTelemetry API.
|
||||||
|
|
||||||
To participate in distributed traces a Span needs to be created for the
|
To participate in distributed traces a Span needs to be created for the
|
||||||
operation being performed as part of a traced workflow. It its simplest form:
|
operation being performed as part of a traced workflow. In its simplest form:
|
||||||
|
|
||||||
var tracer trace.Tracer
|
var tracer trace.Tracer
|
||||||
|
|
||||||
|
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
@ -16,5 +16,5 @@ package otel // import "go.opentelemetry.io/otel"
|
|||||||
|
|
||||||
// Version is the current release version of OpenTelemetry in use.
|
// Version is the current release version of OpenTelemetry in use.
|
||||||
func Version() string {
|
func Version() string {
|
||||||
return "1.11.1"
|
return "1.12.0"
|
||||||
}
|
}
|
||||||
|
4
vendor/go.opentelemetry.io/otel/versions.yaml
generated
vendored
4
vendor/go.opentelemetry.io/otel/versions.yaml
generated
vendored
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
module-sets:
|
module-sets:
|
||||||
stable-v1:
|
stable-v1:
|
||||||
version: v1.11.1
|
version: v1.12.0
|
||||||
modules:
|
modules:
|
||||||
- go.opentelemetry.io/otel
|
- go.opentelemetry.io/otel
|
||||||
- go.opentelemetry.io/otel/bridge/opentracing
|
- go.opentelemetry.io/otel/bridge/opentracing
|
||||||
@ -34,7 +34,7 @@ module-sets:
|
|||||||
- go.opentelemetry.io/otel/trace
|
- go.opentelemetry.io/otel/trace
|
||||||
- go.opentelemetry.io/otel/sdk
|
- go.opentelemetry.io/otel/sdk
|
||||||
experimental-metrics:
|
experimental-metrics:
|
||||||
version: v0.33.0
|
version: v0.35.0
|
||||||
modules:
|
modules:
|
||||||
- go.opentelemetry.io/otel/example/opencensus
|
- go.opentelemetry.io/otel/example/opencensus
|
||||||
- go.opentelemetry.io/otel/example/prometheus
|
- go.opentelemetry.io/otel/example/prometheus
|
||||||
|
3
vendor/golang.org/x/oauth2/AUTHORS
generated
vendored
3
vendor/golang.org/x/oauth2/AUTHORS
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
# This source code refers to The Go Authors for copyright purposes.
|
|
||||||
# The master list of authors is in the main Go distribution,
|
|
||||||
# visible at http://tip.golang.org/AUTHORS.
|
|
3
vendor/golang.org/x/oauth2/CONTRIBUTORS
generated
vendored
3
vendor/golang.org/x/oauth2/CONTRIBUTORS
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
# This source code was written by the Go contributors.
|
|
||||||
# The master list of contributors is in the main Go distribution,
|
|
||||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
|
@ -16,9 +16,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Package state declares grpclb types to be set by resolvers wishing to pass
|
// Package grpclbstate declares grpclb types to be set by resolvers wishing to
|
||||||
// information to grpclb via resolver.State Attributes.
|
// pass information to grpclb via resolver.State Attributes.
|
||||||
package state
|
package grpclbstate
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"google.golang.org/grpc/resolver"
|
"google.golang.org/grpc/resolver"
|
||||||
@ -27,7 +27,7 @@ import (
|
|||||||
// keyType is the key to use for storing State in Attributes.
|
// keyType is the key to use for storing State in Attributes.
|
||||||
type keyType string
|
type keyType string
|
||||||
|
|
||||||
const key = keyType("grpc.grpclb.state")
|
const key = keyType("grpc.grpclb.grpclbstate")
|
||||||
|
|
||||||
// State contains gRPCLB-relevant data passed from the name resolver.
|
// State contains gRPCLB-relevant data passed from the name resolver.
|
||||||
type State struct {
|
type State struct {
|
7
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
generated
vendored
7
vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go
generated
vendored
@ -18,14 +18,13 @@
|
|||||||
|
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.28.1
|
||||||
// protoc v3.14.0
|
// protoc v3.14.0
|
||||||
// source: grpc/binlog/v1/binarylog.proto
|
// source: grpc/binlog/v1/binarylog.proto
|
||||||
|
|
||||||
package grpc_binarylog_v1
|
package grpc_binarylog_v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
||||||
@ -41,10 +40,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
|
||||||
// of the legacy proto package is being used.
|
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
|
||||||
|
|
||||||
// Enumerates the type of event
|
// Enumerates the type of event
|
||||||
// Note the terminology is different from the RPC semantics
|
// Note the terminology is different from the RPC semantics
|
||||||
// definition, but the same meaning is expressed here.
|
// definition, but the same meaning is expressed here.
|
||||||
|
9
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
9
vendor/google.golang.org/grpc/clientconn.go
generated
vendored
@ -788,10 +788,16 @@ func (cc *ClientConn) incrCallsFailed() {
|
|||||||
func (ac *addrConn) connect() error {
|
func (ac *addrConn) connect() error {
|
||||||
ac.mu.Lock()
|
ac.mu.Lock()
|
||||||
if ac.state == connectivity.Shutdown {
|
if ac.state == connectivity.Shutdown {
|
||||||
|
if logger.V(2) {
|
||||||
|
logger.Infof("connect called on shutdown addrConn; ignoring.")
|
||||||
|
}
|
||||||
ac.mu.Unlock()
|
ac.mu.Unlock()
|
||||||
return errConnClosing
|
return errConnClosing
|
||||||
}
|
}
|
||||||
if ac.state != connectivity.Idle {
|
if ac.state != connectivity.Idle {
|
||||||
|
if logger.V(2) {
|
||||||
|
logger.Infof("connect called on addrConn in non-idle state (%v); ignoring.", ac.state)
|
||||||
|
}
|
||||||
ac.mu.Unlock()
|
ac.mu.Unlock()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1268,6 +1274,9 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
|
|||||||
|
|
||||||
newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, onGoAway, onClose)
|
newTr, err := transport.NewClientTransport(connectCtx, ac.cc.ctx, addr, copts, onGoAway, onClose)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if logger.V(2) {
|
||||||
|
logger.Infof("Creating new client transport to %q: %v", addr, err)
|
||||||
|
}
|
||||||
// newTr is either nil, or closed.
|
// newTr is either nil, or closed.
|
||||||
hcancel()
|
hcancel()
|
||||||
channelz.Warningf(logger, ac.channelzID, "grpc: addrConn.createTransport failed to connect to %s. Err: %v", addr, err)
|
channelz.Warningf(logger, ac.channelzID, "grpc: addrConn.createTransport failed to connect to %s. Err: %v", addr, err)
|
||||||
|
10
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
10
vendor/google.golang.org/grpc/dialoptions.go
generated
vendored
@ -116,8 +116,9 @@ func newFuncDialOption(f func(*dialOptions)) *funcDialOption {
|
|||||||
// be twice the size to keep syscalls low. The default value for this buffer is
|
// be twice the size to keep syscalls low. The default value for this buffer is
|
||||||
// 32KB.
|
// 32KB.
|
||||||
//
|
//
|
||||||
// Zero will disable the write buffer such that each write will be on underlying
|
// Zero or negative values will disable the write buffer such that each write
|
||||||
// connection. Note: A Send call may not directly translate to a write.
|
// will be on underlying connection. Note: A Send call may not directly
|
||||||
|
// translate to a write.
|
||||||
func WithWriteBufferSize(s int) DialOption {
|
func WithWriteBufferSize(s int) DialOption {
|
||||||
return newFuncDialOption(func(o *dialOptions) {
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
o.copts.WriteBufferSize = s
|
o.copts.WriteBufferSize = s
|
||||||
@ -127,8 +128,9 @@ func WithWriteBufferSize(s int) DialOption {
|
|||||||
// WithReadBufferSize lets you set the size of read buffer, this determines how
|
// WithReadBufferSize lets you set the size of read buffer, this determines how
|
||||||
// much data can be read at most for each read syscall.
|
// much data can be read at most for each read syscall.
|
||||||
//
|
//
|
||||||
// The default value for this buffer is 32KB. Zero will disable read buffer for
|
// The default value for this buffer is 32KB. Zero or negative values will
|
||||||
// a connection so data framer can access the underlying conn directly.
|
// disable read buffer for a connection so data framer can access the
|
||||||
|
// underlying conn directly.
|
||||||
func WithReadBufferSize(s int) DialOption {
|
func WithReadBufferSize(s int) DialOption {
|
||||||
return newFuncDialOption(func(o *dialOptions) {
|
return newFuncDialOption(func(o *dialOptions) {
|
||||||
o.copts.ReadBufferSize = s
|
o.copts.ReadBufferSize = s
|
||||||
|
7
vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go
generated
vendored
7
vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go
generated
vendored
@ -17,14 +17,13 @@
|
|||||||
|
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.25.0
|
// protoc-gen-go v1.28.1
|
||||||
// protoc v3.14.0
|
// protoc v3.14.0
|
||||||
// source: grpc/health/v1/health.proto
|
// source: grpc/health/v1/health.proto
|
||||||
|
|
||||||
package grpc_health_v1
|
package grpc_health_v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
proto "github.com/golang/protobuf/proto"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
@ -38,10 +37,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
)
|
)
|
||||||
|
|
||||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
|
||||||
// of the legacy proto package is being used.
|
|
||||||
const _ = proto.ProtoPackageIsVersion4
|
|
||||||
|
|
||||||
type HealthCheckResponse_ServingStatus int32
|
type HealthCheckResponse_ServingStatus int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
2
vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
generated
vendored
2
vendor/google.golang.org/grpc/internal/binarylog/method_logger.go
generated
vendored
@ -121,7 +121,7 @@ func (ml *TruncatingMethodLogger) truncateMetadata(mdPb *pb.Metadata) (truncated
|
|||||||
// but not counted towards the size limit.
|
// but not counted towards the size limit.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
currentEntryLen := uint64(len(entry.Value))
|
currentEntryLen := uint64(len(entry.GetKey())) + uint64(len(entry.GetValue()))
|
||||||
if currentEntryLen > bytesLimit {
|
if currentEntryLen > bytesLimit {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
6
vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
generated
vendored
6
vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go
generated
vendored
@ -32,7 +32,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
grpclbstate "google.golang.org/grpc/balancer/grpclb/state"
|
grpclbstate "google.golang.org/grpc/balancer/grpclb/grpclbstate"
|
||||||
"google.golang.org/grpc/grpclog"
|
"google.golang.org/grpc/grpclog"
|
||||||
"google.golang.org/grpc/internal/backoff"
|
"google.golang.org/grpc/internal/backoff"
|
||||||
"google.golang.org/grpc/internal/envconfig"
|
"google.golang.org/grpc/internal/envconfig"
|
||||||
@ -140,10 +140,10 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts
|
|||||||
disableServiceConfig: opts.DisableServiceConfig,
|
disableServiceConfig: opts.DisableServiceConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.Authority == "" {
|
if target.URL.Host == "" {
|
||||||
d.resolver = defaultResolver
|
d.resolver = defaultResolver
|
||||||
} else {
|
} else {
|
||||||
d.resolver, err = customAuthorityResolver(target.Authority)
|
d.resolver, err = customAuthorityResolver(target.URL.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
9
vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go
generated
vendored
9
vendor/google.golang.org/grpc/internal/resolver/passthrough/passthrough.go
generated
vendored
@ -20,13 +20,20 @@
|
|||||||
// name without scheme back to gRPC as resolved address.
|
// name without scheme back to gRPC as resolved address.
|
||||||
package passthrough
|
package passthrough
|
||||||
|
|
||||||
import "google.golang.org/grpc/resolver"
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
"google.golang.org/grpc/resolver"
|
||||||
|
)
|
||||||
|
|
||||||
const scheme = "passthrough"
|
const scheme = "passthrough"
|
||||||
|
|
||||||
type passthroughBuilder struct{}
|
type passthroughBuilder struct{}
|
||||||
|
|
||||||
func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
|
func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOptions) (resolver.Resolver, error) {
|
||||||
|
if target.Endpoint == "" && opts.Dialer == nil {
|
||||||
|
return nil, errors.New("passthrough: received empty target in Build()")
|
||||||
|
}
|
||||||
r := &passthroughResolver{
|
r := &passthroughResolver{
|
||||||
target: target,
|
target: target,
|
||||||
cc: cc,
|
cc: cc,
|
||||||
|
4
vendor/google.golang.org/grpc/internal/resolver/unix/unix.go
generated
vendored
4
vendor/google.golang.org/grpc/internal/resolver/unix/unix.go
generated
vendored
@ -34,8 +34,8 @@ type builder struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
|
func (b *builder) Build(target resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) (resolver.Resolver, error) {
|
||||||
if target.Authority != "" {
|
if target.URL.Host != "" {
|
||||||
return nil, fmt.Errorf("invalid (non-empty) authority: %v", target.Authority)
|
return nil, fmt.Errorf("invalid (non-empty) authority: %v", target.URL.Host)
|
||||||
}
|
}
|
||||||
|
|
||||||
// gRPC was parsing the dial target manually before PR #4817, and we
|
// gRPC was parsing the dial target manually before PR #4817, and we
|
||||||
|
46
vendor/google.golang.org/grpc/internal/transport/controlbuf.go
generated
vendored
46
vendor/google.golang.org/grpc/internal/transport/controlbuf.go
generated
vendored
@ -191,7 +191,7 @@ type goAway struct {
|
|||||||
code http2.ErrCode
|
code http2.ErrCode
|
||||||
debugData []byte
|
debugData []byte
|
||||||
headsUp bool
|
headsUp bool
|
||||||
closeConn bool
|
closeConn error // if set, loopyWriter will exit, resulting in conn closure
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*goAway) isTransportResponseFrame() bool { return false }
|
func (*goAway) isTransportResponseFrame() bool { return false }
|
||||||
@ -209,6 +209,14 @@ type outFlowControlSizeRequest struct {
|
|||||||
|
|
||||||
func (*outFlowControlSizeRequest) isTransportResponseFrame() bool { return false }
|
func (*outFlowControlSizeRequest) isTransportResponseFrame() bool { return false }
|
||||||
|
|
||||||
|
// closeConnection is an instruction to tell the loopy writer to flush the
|
||||||
|
// framer and exit, which will cause the transport's connection to be closed
|
||||||
|
// (by the client or server). The transport itself will close after the reader
|
||||||
|
// encounters the EOF caused by the connection closure.
|
||||||
|
type closeConnection struct{}
|
||||||
|
|
||||||
|
func (closeConnection) isTransportResponseFrame() bool { return false }
|
||||||
|
|
||||||
type outStreamState int
|
type outStreamState int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -408,7 +416,7 @@ func (c *controlBuffer) get(block bool) (interface{}, error) {
|
|||||||
select {
|
select {
|
||||||
case <-c.ch:
|
case <-c.ch:
|
||||||
case <-c.done:
|
case <-c.done:
|
||||||
return nil, ErrConnClosing
|
return nil, errors.New("transport closed by client")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -519,18 +527,6 @@ const minBatchSize = 1000
|
|||||||
// As an optimization, to increase the batch size for each flush, loopy yields the processor, once
|
// As an optimization, to increase the batch size for each flush, loopy yields the processor, once
|
||||||
// if the batch size is too low to give stream goroutines a chance to fill it up.
|
// if the batch size is too low to give stream goroutines a chance to fill it up.
|
||||||
func (l *loopyWriter) run() (err error) {
|
func (l *loopyWriter) run() (err error) {
|
||||||
defer func() {
|
|
||||||
if err == ErrConnClosing {
|
|
||||||
// Don't log ErrConnClosing as error since it happens
|
|
||||||
// 1. When the connection is closed by some other known issue.
|
|
||||||
// 2. User closed the connection.
|
|
||||||
// 3. A graceful close of connection.
|
|
||||||
if logger.V(logLevel) {
|
|
||||||
logger.Infof("transport: loopyWriter.run returning. %v", err)
|
|
||||||
}
|
|
||||||
err = nil
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
for {
|
for {
|
||||||
it, err := l.cbuf.get(true)
|
it, err := l.cbuf.get(true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -574,7 +570,6 @@ func (l *loopyWriter) run() (err error) {
|
|||||||
}
|
}
|
||||||
l.framer.writer.Flush()
|
l.framer.writer.Flush()
|
||||||
break hasdata
|
break hasdata
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -662,12 +657,11 @@ func (l *loopyWriter) headerHandler(h *headerFrame) error {
|
|||||||
func (l *loopyWriter) originateStream(str *outStream) error {
|
func (l *loopyWriter) originateStream(str *outStream) error {
|
||||||
hdr := str.itl.dequeue().(*headerFrame)
|
hdr := str.itl.dequeue().(*headerFrame)
|
||||||
if err := hdr.initStream(str.id); err != nil {
|
if err := hdr.initStream(str.id); err != nil {
|
||||||
if err == ErrConnClosing {
|
if err == errStreamDrain { // errStreamDrain need not close transport
|
||||||
return err
|
|
||||||
}
|
|
||||||
// Other errors(errStreamDrain) need not close transport.
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil {
|
if err := l.writeHeader(str.id, hdr.endStream, hdr.hf, hdr.onWrite); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -764,7 +758,7 @@ func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if l.side == clientSide && l.draining && len(l.estdStreams) == 0 {
|
if l.side == clientSide && l.draining && len(l.estdStreams) == 0 {
|
||||||
return ErrConnClosing
|
return errors.New("finished processing active streams while in draining mode")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -799,7 +793,7 @@ func (l *loopyWriter) incomingGoAwayHandler(*incomingGoAway) error {
|
|||||||
if l.side == clientSide {
|
if l.side == clientSide {
|
||||||
l.draining = true
|
l.draining = true
|
||||||
if len(l.estdStreams) == 0 {
|
if len(l.estdStreams) == 0 {
|
||||||
return ErrConnClosing
|
return errors.New("received GOAWAY with no active streams")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -817,6 +811,14 @@ func (l *loopyWriter) goAwayHandler(g *goAway) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (l *loopyWriter) closeConnectionHandler() error {
|
||||||
|
l.framer.writer.Flush()
|
||||||
|
// Exit loopyWriter entirely by returning an error here. This will lead to
|
||||||
|
// the transport closing the connection, and, ultimately, transport
|
||||||
|
// closure.
|
||||||
|
return ErrConnClosing
|
||||||
|
}
|
||||||
|
|
||||||
func (l *loopyWriter) handle(i interface{}) error {
|
func (l *loopyWriter) handle(i interface{}) error {
|
||||||
switch i := i.(type) {
|
switch i := i.(type) {
|
||||||
case *incomingWindowUpdate:
|
case *incomingWindowUpdate:
|
||||||
@ -845,6 +847,8 @@ func (l *loopyWriter) handle(i interface{}) error {
|
|||||||
return l.goAwayHandler(i)
|
return l.goAwayHandler(i)
|
||||||
case *outFlowControlSizeRequest:
|
case *outFlowControlSizeRequest:
|
||||||
return l.outFlowControlSizeRequestHandler(i)
|
return l.outFlowControlSizeRequestHandler(i)
|
||||||
|
case closeConnection:
|
||||||
|
return l.closeConnectionHandler()
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("transport: unknown control message type %T", i)
|
return fmt.Errorf("transport: unknown control message type %T", i)
|
||||||
}
|
}
|
||||||
|
45
vendor/google.golang.org/grpc/internal/transport/handler_server.go
generated
vendored
45
vendor/google.golang.org/grpc/internal/transport/handler_server.go
generated
vendored
@ -46,24 +46,32 @@ import (
|
|||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewServerHandlerTransport returns a ServerTransport handling gRPC
|
// NewServerHandlerTransport returns a ServerTransport handling gRPC from
|
||||||
// from inside an http.Handler. It requires that the http Server
|
// inside an http.Handler, or writes an HTTP error to w and returns an error.
|
||||||
// supports HTTP/2.
|
// It requires that the http Server supports HTTP/2.
|
||||||
func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error) {
|
func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler) (ServerTransport, error) {
|
||||||
if r.ProtoMajor != 2 {
|
if r.ProtoMajor != 2 {
|
||||||
return nil, errors.New("gRPC requires HTTP/2")
|
msg := "gRPC requires HTTP/2"
|
||||||
|
http.Error(w, msg, http.StatusBadRequest)
|
||||||
|
return nil, errors.New(msg)
|
||||||
}
|
}
|
||||||
if r.Method != "POST" {
|
if r.Method != "POST" {
|
||||||
return nil, errors.New("invalid gRPC request method")
|
msg := fmt.Sprintf("invalid gRPC request method %q", r.Method)
|
||||||
|
http.Error(w, msg, http.StatusBadRequest)
|
||||||
|
return nil, errors.New(msg)
|
||||||
}
|
}
|
||||||
contentType := r.Header.Get("Content-Type")
|
contentType := r.Header.Get("Content-Type")
|
||||||
// TODO: do we assume contentType is lowercase? we did before
|
// TODO: do we assume contentType is lowercase? we did before
|
||||||
contentSubtype, validContentType := grpcutil.ContentSubtype(contentType)
|
contentSubtype, validContentType := grpcutil.ContentSubtype(contentType)
|
||||||
if !validContentType {
|
if !validContentType {
|
||||||
return nil, errors.New("invalid gRPC request content-type")
|
msg := fmt.Sprintf("invalid gRPC request content-type %q", contentType)
|
||||||
|
http.Error(w, msg, http.StatusBadRequest)
|
||||||
|
return nil, errors.New(msg)
|
||||||
}
|
}
|
||||||
if _, ok := w.(http.Flusher); !ok {
|
if _, ok := w.(http.Flusher); !ok {
|
||||||
return nil, errors.New("gRPC requires a ResponseWriter supporting http.Flusher")
|
msg := "gRPC requires a ResponseWriter supporting http.Flusher"
|
||||||
|
http.Error(w, msg, http.StatusInternalServerError)
|
||||||
|
return nil, errors.New(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
st := &serverHandlerTransport{
|
st := &serverHandlerTransport{
|
||||||
@ -79,7 +87,9 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []s
|
|||||||
if v := r.Header.Get("grpc-timeout"); v != "" {
|
if v := r.Header.Get("grpc-timeout"); v != "" {
|
||||||
to, err := decodeTimeout(v)
|
to, err := decodeTimeout(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "malformed time-out: %v", err)
|
msg := fmt.Sprintf("malformed time-out: %v", err)
|
||||||
|
http.Error(w, msg, http.StatusBadRequest)
|
||||||
|
return nil, status.Error(codes.Internal, msg)
|
||||||
}
|
}
|
||||||
st.timeoutSet = true
|
st.timeoutSet = true
|
||||||
st.timeout = to
|
st.timeout = to
|
||||||
@ -97,7 +107,9 @@ func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []s
|
|||||||
for _, v := range vv {
|
for _, v := range vv {
|
||||||
v, err := decodeMetadataHeader(k, v)
|
v, err := decodeMetadataHeader(k, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, status.Errorf(codes.Internal, "malformed binary metadata: %v", err)
|
msg := fmt.Sprintf("malformed binary metadata %q in header %q: %v", v, k, err)
|
||||||
|
http.Error(w, msg, http.StatusBadRequest)
|
||||||
|
return nil, status.Error(codes.Internal, msg)
|
||||||
}
|
}
|
||||||
metakv = append(metakv, k, v)
|
metakv = append(metakv, k, v)
|
||||||
}
|
}
|
||||||
@ -141,11 +153,14 @@ type serverHandlerTransport struct {
|
|||||||
stats []stats.Handler
|
stats []stats.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ht *serverHandlerTransport) Close() {
|
func (ht *serverHandlerTransport) Close(err error) {
|
||||||
ht.closeOnce.Do(ht.closeCloseChanOnce)
|
ht.closeOnce.Do(func() {
|
||||||
|
if logger.V(logLevel) {
|
||||||
|
logger.Infof("Closing serverHandlerTransport: %v", err)
|
||||||
|
}
|
||||||
|
close(ht.closedCh)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ht *serverHandlerTransport) closeCloseChanOnce() { close(ht.closedCh) }
|
|
||||||
|
|
||||||
func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) }
|
func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) }
|
||||||
|
|
||||||
@ -236,7 +251,7 @@ func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) erro
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ht.Close()
|
ht.Close(errors.New("finished writing status"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +361,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace
|
|||||||
case <-ht.req.Context().Done():
|
case <-ht.req.Context().Done():
|
||||||
}
|
}
|
||||||
cancel()
|
cancel()
|
||||||
ht.Close()
|
ht.Close(errors.New("request is done processing"))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
req := ht.req
|
req := ht.req
|
||||||
|
34
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
34
vendor/google.golang.org/grpc/internal/transport/http2_client.go
generated
vendored
@ -64,6 +64,10 @@ type http2Client struct {
|
|||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
ctxDone <-chan struct{} // Cache the ctx.Done() chan.
|
ctxDone <-chan struct{} // Cache the ctx.Done() chan.
|
||||||
userAgent string
|
userAgent string
|
||||||
|
// address contains the resolver returned address for this transport.
|
||||||
|
// If the `ServerName` field is set, it takes precedence over `CallHdr.Host`
|
||||||
|
// passed to `NewStream`, when determining the :authority header.
|
||||||
|
address resolver.Address
|
||||||
md metadata.MD
|
md metadata.MD
|
||||||
conn net.Conn // underlying communication channel
|
conn net.Conn // underlying communication channel
|
||||||
loopy *loopyWriter
|
loopy *loopyWriter
|
||||||
@ -238,8 +242,11 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
go func(conn net.Conn) {
|
go func(conn net.Conn) {
|
||||||
defer ctxMonitorDone.Fire() // Signal this goroutine has exited.
|
defer ctxMonitorDone.Fire() // Signal this goroutine has exited.
|
||||||
<-newClientCtx.Done() // Block until connectCtx expires or the defer above executes.
|
<-newClientCtx.Done() // Block until connectCtx expires or the defer above executes.
|
||||||
if connectCtx.Err() != nil {
|
if err := connectCtx.Err(); err != nil {
|
||||||
// connectCtx expired before exiting the function. Hard close the connection.
|
// connectCtx expired before exiting the function. Hard close the connection.
|
||||||
|
if logger.V(logLevel) {
|
||||||
|
logger.Infof("newClientTransport: aborting due to connectCtx: %v", err)
|
||||||
|
}
|
||||||
conn.Close()
|
conn.Close()
|
||||||
}
|
}
|
||||||
}(conn)
|
}(conn)
|
||||||
@ -314,6 +321,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
cancel: cancel,
|
cancel: cancel,
|
||||||
userAgent: opts.UserAgent,
|
userAgent: opts.UserAgent,
|
||||||
registeredCompressors: grpcutil.RegisteredCompressors(),
|
registeredCompressors: grpcutil.RegisteredCompressors(),
|
||||||
|
address: addr,
|
||||||
conn: conn,
|
conn: conn,
|
||||||
remoteAddr: conn.RemoteAddr(),
|
remoteAddr: conn.RemoteAddr(),
|
||||||
localAddr: conn.LocalAddr(),
|
localAddr: conn.LocalAddr(),
|
||||||
@ -440,10 +448,8 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts
|
|||||||
go func() {
|
go func() {
|
||||||
t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst)
|
t.loopy = newLoopyWriter(clientSide, t.framer, t.controlBuf, t.bdpEst)
|
||||||
err := t.loopy.run()
|
err := t.loopy.run()
|
||||||
if err != nil {
|
|
||||||
if logger.V(logLevel) {
|
if logger.V(logLevel) {
|
||||||
logger.Errorf("transport: loopyWriter.run returning. Err: %v", err)
|
logger.Infof("transport: loopyWriter exited. Closing connection. Err: %v", err)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Do not close the transport. Let reader goroutine handle it since
|
// Do not close the transport. Let reader goroutine handle it since
|
||||||
// there might be data in the buffers.
|
// there might be data in the buffers.
|
||||||
@ -702,6 +708,18 @@ func (e NewStreamError) Error() string {
|
|||||||
// streams. All non-nil errors returned will be *NewStreamError.
|
// streams. All non-nil errors returned will be *NewStreamError.
|
||||||
func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) {
|
func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) {
|
||||||
ctx = peer.NewContext(ctx, t.getPeer())
|
ctx = peer.NewContext(ctx, t.getPeer())
|
||||||
|
|
||||||
|
// ServerName field of the resolver returned address takes precedence over
|
||||||
|
// Host field of CallHdr to determine the :authority header. This is because,
|
||||||
|
// the ServerName field takes precedence for server authentication during
|
||||||
|
// TLS handshake, and the :authority header should match the value used
|
||||||
|
// for server authentication.
|
||||||
|
if t.address.ServerName != "" {
|
||||||
|
newCallHdr := *callHdr
|
||||||
|
newCallHdr.Host = t.address.ServerName
|
||||||
|
callHdr = &newCallHdr
|
||||||
|
}
|
||||||
|
|
||||||
headerFields, err := t.createHeaderFields(ctx, callHdr)
|
headerFields, err := t.createHeaderFields(ctx, callHdr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, &NewStreamError{Err: err, AllowTransparentRetry: false}
|
return nil, &NewStreamError{Err: err, AllowTransparentRetry: false}
|
||||||
@ -934,6 +952,9 @@ func (t *http2Client) Close(err error) {
|
|||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if logger.V(logLevel) {
|
||||||
|
logger.Infof("transport: closing: %v", err)
|
||||||
|
}
|
||||||
// Call t.onClose ASAP to prevent the client from attempting to create new
|
// Call t.onClose ASAP to prevent the client from attempting to create new
|
||||||
// streams.
|
// streams.
|
||||||
t.onClose()
|
t.onClose()
|
||||||
@ -986,11 +1007,14 @@ func (t *http2Client) GracefulClose() {
|
|||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if logger.V(logLevel) {
|
||||||
|
logger.Infof("transport: GracefulClose called")
|
||||||
|
}
|
||||||
t.state = draining
|
t.state = draining
|
||||||
active := len(t.activeStreams)
|
active := len(t.activeStreams)
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
if active == 0 {
|
if active == 0 {
|
||||||
t.Close(ErrConnClosing)
|
t.Close(connectionErrorf(true, nil, "no active streams left to process while draining"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.controlBuf.put(&incomingGoAway{})
|
t.controlBuf.put(&incomingGoAway{})
|
||||||
|
94
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
94
vendor/google.golang.org/grpc/internal/transport/http2_server.go
generated
vendored
@ -21,6 +21,7 @@ package transport
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math"
|
"math"
|
||||||
@ -41,6 +42,7 @@ import (
|
|||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
"google.golang.org/grpc/internal/channelz"
|
"google.golang.org/grpc/internal/channelz"
|
||||||
"google.golang.org/grpc/internal/grpcrand"
|
"google.golang.org/grpc/internal/grpcrand"
|
||||||
|
"google.golang.org/grpc/internal/grpcsync"
|
||||||
"google.golang.org/grpc/keepalive"
|
"google.golang.org/grpc/keepalive"
|
||||||
"google.golang.org/grpc/metadata"
|
"google.golang.org/grpc/metadata"
|
||||||
"google.golang.org/grpc/peer"
|
"google.golang.org/grpc/peer"
|
||||||
@ -101,13 +103,13 @@ type http2Server struct {
|
|||||||
|
|
||||||
mu sync.Mutex // guard the following
|
mu sync.Mutex // guard the following
|
||||||
|
|
||||||
// drainChan is initialized when Drain() is called the first time.
|
// drainEvent is initialized when Drain() is called the first time. After
|
||||||
// After which the server writes out the first GoAway(with ID 2^31-1) frame.
|
// which the server writes out the first GoAway(with ID 2^31-1) frame. Then
|
||||||
// Then an independent goroutine will be launched to later send the second GoAway.
|
// an independent goroutine will be launched to later send the second
|
||||||
// During this time we don't want to write another first GoAway(with ID 2^31 -1) frame.
|
// GoAway. During this time we don't want to write another first GoAway(with
|
||||||
// Thus call to Drain() will be a no-op if drainChan is already initialized since draining is
|
// ID 2^31 -1) frame. Thus call to Drain() will be a no-op if drainEvent is
|
||||||
// already underway.
|
// already initialized since draining is already underway.
|
||||||
drainChan chan struct{}
|
drainEvent *grpcsync.Event
|
||||||
state transportState
|
state transportState
|
||||||
activeStreams map[uint32]*Stream
|
activeStreams map[uint32]*Stream
|
||||||
// idle is the time instant when the connection went idle.
|
// idle is the time instant when the connection went idle.
|
||||||
@ -293,7 +295,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Close()
|
t.Close(err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -331,10 +333,9 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
go func() {
|
go func() {
|
||||||
t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst)
|
t.loopy = newLoopyWriter(serverSide, t.framer, t.controlBuf, t.bdpEst)
|
||||||
t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler
|
t.loopy.ssGoAwayHandler = t.outgoingGoAwayHandler
|
||||||
if err := t.loopy.run(); err != nil {
|
err := t.loopy.run()
|
||||||
if logger.V(logLevel) {
|
if logger.V(logLevel) {
|
||||||
logger.Errorf("transport: loopyWriter.run returning. Err: %v", err)
|
logger.Infof("transport: loopyWriter exited. Closing connection. Err: %v", err)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
t.conn.Close()
|
t.conn.Close()
|
||||||
t.controlBuf.finish()
|
t.controlBuf.finish()
|
||||||
@ -344,8 +345,9 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport,
|
|||||||
return t, nil
|
return t, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// operateHeader takes action on the decoded headers.
|
// operateHeaders takes action on the decoded headers. Returns an error if fatal
|
||||||
func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (fatal bool) {
|
// error encountered and transport needs to close, otherwise returns nil.
|
||||||
|
func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) error {
|
||||||
// Acquire max stream ID lock for entire duration
|
// Acquire max stream ID lock for entire duration
|
||||||
t.maxStreamMu.Lock()
|
t.maxStreamMu.Lock()
|
||||||
defer t.maxStreamMu.Unlock()
|
defer t.maxStreamMu.Unlock()
|
||||||
@ -361,15 +363,12 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
rstCode: http2.ErrCodeFrameSize,
|
rstCode: http2.ErrCodeFrameSize,
|
||||||
onWrite: func() {},
|
onWrite: func() {},
|
||||||
})
|
})
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if streamID%2 != 1 || streamID <= t.maxStreamID {
|
if streamID%2 != 1 || streamID <= t.maxStreamID {
|
||||||
// illegal gRPC stream id.
|
// illegal gRPC stream id.
|
||||||
if logger.V(logLevel) {
|
return fmt.Errorf("received an illegal stream id: %v. headers frame: %+v", streamID, frame)
|
||||||
logger.Errorf("transport: http2Server.HandleStreams received an illegal stream id: %v", streamID)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
t.maxStreamID = streamID
|
t.maxStreamID = streamID
|
||||||
|
|
||||||
@ -453,7 +452,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
status: status.New(codes.Internal, errMsg),
|
status: status.New(codes.Internal, errMsg),
|
||||||
rst: !frame.StreamEnded(),
|
rst: !frame.StreamEnded(),
|
||||||
})
|
})
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isGRPC || headerError {
|
if !isGRPC || headerError {
|
||||||
@ -463,7 +462,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
rstCode: http2.ErrCodeProtocol,
|
rstCode: http2.ErrCodeProtocol,
|
||||||
onWrite: func() {},
|
onWrite: func() {},
|
||||||
})
|
})
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// "If :authority is missing, Host must be renamed to :authority." - A41
|
// "If :authority is missing, Host must be renamed to :authority." - A41
|
||||||
@ -503,7 +502,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
if t.state != reachable {
|
if t.state != reachable {
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
s.cancel()
|
s.cancel()
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
if uint32(len(t.activeStreams)) >= t.maxStreams {
|
if uint32(len(t.activeStreams)) >= t.maxStreams {
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
@ -514,7 +513,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
onWrite: func() {},
|
onWrite: func() {},
|
||||||
})
|
})
|
||||||
s.cancel()
|
s.cancel()
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
if httpMethod != http.MethodPost {
|
if httpMethod != http.MethodPost {
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
@ -530,7 +529,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
rst: !frame.StreamEnded(),
|
rst: !frame.StreamEnded(),
|
||||||
})
|
})
|
||||||
s.cancel()
|
s.cancel()
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
if t.inTapHandle != nil {
|
if t.inTapHandle != nil {
|
||||||
var err error
|
var err error
|
||||||
@ -550,7 +549,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
status: stat,
|
status: stat,
|
||||||
rst: !frame.StreamEnded(),
|
rst: !frame.StreamEnded(),
|
||||||
})
|
})
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.activeStreams[streamID] = s
|
t.activeStreams[streamID] = s
|
||||||
@ -597,7 +596,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
|
|||||||
wq: s.wq,
|
wq: s.wq,
|
||||||
})
|
})
|
||||||
handle(s)
|
handle(s)
|
||||||
return false
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// HandleStreams receives incoming streams using the given handler. This is
|
// HandleStreams receives incoming streams using the given handler. This is
|
||||||
@ -630,19 +629,16 @@ func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if err == io.EOF || err == io.ErrUnexpectedEOF {
|
if err == io.EOF || err == io.ErrUnexpectedEOF {
|
||||||
t.Close()
|
t.Close(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if logger.V(logLevel) {
|
t.Close(err)
|
||||||
logger.Warningf("transport: http2Server.HandleStreams failed to read frame: %v", err)
|
|
||||||
}
|
|
||||||
t.Close()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch frame := frame.(type) {
|
switch frame := frame.(type) {
|
||||||
case *http2.MetaHeadersFrame:
|
case *http2.MetaHeadersFrame:
|
||||||
if t.operateHeaders(frame, handle, traceCtx) {
|
if err := t.operateHeaders(frame, handle, traceCtx); err != nil {
|
||||||
t.Close()
|
t.Close(err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case *http2.DataFrame:
|
case *http2.DataFrame:
|
||||||
@ -843,8 +839,8 @@ const (
|
|||||||
|
|
||||||
func (t *http2Server) handlePing(f *http2.PingFrame) {
|
func (t *http2Server) handlePing(f *http2.PingFrame) {
|
||||||
if f.IsAck() {
|
if f.IsAck() {
|
||||||
if f.Data == goAwayPing.data && t.drainChan != nil {
|
if f.Data == goAwayPing.data && t.drainEvent != nil {
|
||||||
close(t.drainChan)
|
t.drainEvent.Fire()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Maybe it's a BDP ping.
|
// Maybe it's a BDP ping.
|
||||||
@ -886,10 +882,7 @@ func (t *http2Server) handlePing(f *http2.PingFrame) {
|
|||||||
|
|
||||||
if t.pingStrikes > maxPingStrikes {
|
if t.pingStrikes > maxPingStrikes {
|
||||||
// Send goaway and close the connection.
|
// Send goaway and close the connection.
|
||||||
if logger.V(logLevel) {
|
t.controlBuf.put(&goAway{code: http2.ErrCodeEnhanceYourCalm, debugData: []byte("too_many_pings"), closeConn: errors.New("got too many pings from the client")})
|
||||||
logger.Errorf("transport: Got too many pings from the client, closing the connection.")
|
|
||||||
}
|
|
||||||
t.controlBuf.put(&goAway{code: http2.ErrCodeEnhanceYourCalm, debugData: []byte("too_many_pings"), closeConn: true})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1153,7 +1146,7 @@ func (t *http2Server) keepalive() {
|
|||||||
if logger.V(logLevel) {
|
if logger.V(logLevel) {
|
||||||
logger.Infof("transport: closing server transport due to maximum connection age.")
|
logger.Infof("transport: closing server transport due to maximum connection age.")
|
||||||
}
|
}
|
||||||
t.Close()
|
t.controlBuf.put(closeConnection{})
|
||||||
case <-t.done:
|
case <-t.done:
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@ -1169,10 +1162,7 @@ func (t *http2Server) keepalive() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if outstandingPing && kpTimeoutLeft <= 0 {
|
if outstandingPing && kpTimeoutLeft <= 0 {
|
||||||
if logger.V(logLevel) {
|
t.Close(fmt.Errorf("keepalive ping not acked within timeout %s", t.kp.Time))
|
||||||
logger.Infof("transport: closing server transport due to idleness.")
|
|
||||||
}
|
|
||||||
t.Close()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !outstandingPing {
|
if !outstandingPing {
|
||||||
@ -1199,12 +1189,15 @@ func (t *http2Server) keepalive() {
|
|||||||
// Close starts shutting down the http2Server transport.
|
// Close starts shutting down the http2Server transport.
|
||||||
// TODO(zhaoq): Now the destruction is not blocked on any pending streams. This
|
// TODO(zhaoq): Now the destruction is not blocked on any pending streams. This
|
||||||
// could cause some resource issue. Revisit this later.
|
// could cause some resource issue. Revisit this later.
|
||||||
func (t *http2Server) Close() {
|
func (t *http2Server) Close(err error) {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
if t.state == closing {
|
if t.state == closing {
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if logger.V(logLevel) {
|
||||||
|
logger.Infof("transport: closing: %v", err)
|
||||||
|
}
|
||||||
t.state = closing
|
t.state = closing
|
||||||
streams := t.activeStreams
|
streams := t.activeStreams
|
||||||
t.activeStreams = nil
|
t.activeStreams = nil
|
||||||
@ -1295,10 +1288,10 @@ func (t *http2Server) RemoteAddr() net.Addr {
|
|||||||
func (t *http2Server) Drain() {
|
func (t *http2Server) Drain() {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
defer t.mu.Unlock()
|
defer t.mu.Unlock()
|
||||||
if t.drainChan != nil {
|
if t.drainEvent != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
t.drainChan = make(chan struct{})
|
t.drainEvent = grpcsync.NewEvent()
|
||||||
t.controlBuf.put(&goAway{code: http2.ErrCodeNo, debugData: []byte{}, headsUp: true})
|
t.controlBuf.put(&goAway{code: http2.ErrCodeNo, debugData: []byte{}, headsUp: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,19 +1312,20 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) {
|
|||||||
// Stop accepting more streams now.
|
// Stop accepting more streams now.
|
||||||
t.state = draining
|
t.state = draining
|
||||||
sid := t.maxStreamID
|
sid := t.maxStreamID
|
||||||
|
retErr := g.closeConn
|
||||||
if len(t.activeStreams) == 0 {
|
if len(t.activeStreams) == 0 {
|
||||||
g.closeConn = true
|
retErr = errors.New("second GOAWAY written and no active streams left to process")
|
||||||
}
|
}
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
t.maxStreamMu.Unlock()
|
t.maxStreamMu.Unlock()
|
||||||
if err := t.framer.fr.WriteGoAway(sid, g.code, g.debugData); err != nil {
|
if err := t.framer.fr.WriteGoAway(sid, g.code, g.debugData); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
if g.closeConn {
|
if retErr != nil {
|
||||||
// Abruptly close the connection following the GoAway (via
|
// Abruptly close the connection following the GoAway (via
|
||||||
// loopywriter). But flush out what's inside the buffer first.
|
// loopywriter). But flush out what's inside the buffer first.
|
||||||
t.framer.writer.Flush()
|
t.framer.writer.Flush()
|
||||||
return false, fmt.Errorf("transport: Connection closing")
|
return false, retErr
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
@ -1353,7 +1347,7 @@ func (t *http2Server) outgoingGoAwayHandler(g *goAway) (bool, error) {
|
|||||||
timer := time.NewTimer(time.Minute)
|
timer := time.NewTimer(time.Minute)
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
select {
|
select {
|
||||||
case <-t.drainChan:
|
case <-t.drainEvent.Done():
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
case <-t.done:
|
case <-t.done:
|
||||||
return
|
return
|
||||||
|
2
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
2
vendor/google.golang.org/grpc/internal/transport/transport.go
generated
vendored
@ -701,7 +701,7 @@ type ServerTransport interface {
|
|||||||
// Close tears down the transport. Once it is called, the transport
|
// Close tears down the transport. Once it is called, the transport
|
||||||
// should not be accessed any more. All the pending streams and their
|
// should not be accessed any more. All the pending streams and their
|
||||||
// handlers will be terminated asynchronously.
|
// handlers will be terminated asynchronously.
|
||||||
Close()
|
Close(err error)
|
||||||
|
|
||||||
// RemoteAddr returns the remote network address.
|
// RemoteAddr returns the remote network address.
|
||||||
RemoteAddr() net.Addr
|
RemoteAddr() net.Addr
|
||||||
|
4
vendor/google.golang.org/grpc/pickfirst.go
generated
vendored
4
vendor/google.golang.org/grpc/pickfirst.go
generated
vendored
@ -102,8 +102,8 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState
|
|||||||
b.subConn = subConn
|
b.subConn = subConn
|
||||||
b.state = connectivity.Idle
|
b.state = connectivity.Idle
|
||||||
b.cc.UpdateState(balancer.State{
|
b.cc.UpdateState(balancer.State{
|
||||||
ConnectivityState: connectivity.Idle,
|
ConnectivityState: connectivity.Connecting,
|
||||||
Picker: &picker{result: balancer.PickResult{SubConn: b.subConn}},
|
Picker: &picker{err: balancer.ErrNoSubConnAvailable},
|
||||||
})
|
})
|
||||||
b.subConn.Connect()
|
b.subConn.Connect()
|
||||||
return nil
|
return nil
|
||||||
|
7
vendor/google.golang.org/grpc/regenerate.sh
generated
vendored
7
vendor/google.golang.org/grpc/regenerate.sh
generated
vendored
@ -57,7 +57,8 @@ LEGACY_SOURCES=(
|
|||||||
${WORKDIR}/grpc-proto/grpc/health/v1/health.proto
|
${WORKDIR}/grpc-proto/grpc/health/v1/health.proto
|
||||||
${WORKDIR}/grpc-proto/grpc/lb/v1/load_balancer.proto
|
${WORKDIR}/grpc-proto/grpc/lb/v1/load_balancer.proto
|
||||||
profiling/proto/service.proto
|
profiling/proto/service.proto
|
||||||
reflection/grpc_reflection_v1alpha/reflection.proto
|
${WORKDIR}/grpc-proto/grpc/reflection/v1alpha/reflection.proto
|
||||||
|
${WORKDIR}/grpc-proto/grpc/reflection/v1/reflection.proto
|
||||||
)
|
)
|
||||||
|
|
||||||
# Generates only the new gRPC Service symbols
|
# Generates only the new gRPC Service symbols
|
||||||
@ -119,8 +120,4 @@ mv ${WORKDIR}/out/google.golang.org/grpc/lookup/grpc_lookup_v1/* ${WORKDIR}/out/
|
|||||||
# see grpc_testing_not_regenerate/README.md for details.
|
# see grpc_testing_not_regenerate/README.md for details.
|
||||||
rm ${WORKDIR}/out/google.golang.org/grpc/reflection/grpc_testing_not_regenerate/*.pb.go
|
rm ${WORKDIR}/out/google.golang.org/grpc/reflection/grpc_testing_not_regenerate/*.pb.go
|
||||||
|
|
||||||
# grpc/testing does not have a go_package option.
|
|
||||||
mv ${WORKDIR}/out/grpc/testing/*.pb.go interop/grpc_testing/
|
|
||||||
mv ${WORKDIR}/out/grpc/core/*.pb.go interop/grpc_testing/core/
|
|
||||||
|
|
||||||
cp -R ${WORKDIR}/out/google.golang.org/grpc/* .
|
cp -R ${WORKDIR}/out/google.golang.org/grpc/* .
|
||||||
|
65
vendor/google.golang.org/grpc/server.go
generated
vendored
65
vendor/google.golang.org/grpc/server.go
generated
vendored
@ -233,10 +233,11 @@ func newJoinServerOption(opts ...ServerOption) ServerOption {
|
|||||||
return &joinServerOption{opts: opts}
|
return &joinServerOption{opts: opts}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteBufferSize determines how much data can be batched before doing a write on the wire.
|
// WriteBufferSize determines how much data can be batched before doing a write
|
||||||
// The corresponding memory allocation for this buffer will be twice the size to keep syscalls low.
|
// on the wire. The corresponding memory allocation for this buffer will be
|
||||||
// The default value for this buffer is 32KB.
|
// twice the size to keep syscalls low. The default value for this buffer is
|
||||||
// Zero will disable the write buffer such that each write will be on underlying connection.
|
// 32KB. Zero or negative values will disable the write buffer such that each
|
||||||
|
// write will be on underlying connection.
|
||||||
// Note: A Send call may not directly translate to a write.
|
// Note: A Send call may not directly translate to a write.
|
||||||
func WriteBufferSize(s int) ServerOption {
|
func WriteBufferSize(s int) ServerOption {
|
||||||
return newFuncServerOption(func(o *serverOptions) {
|
return newFuncServerOption(func(o *serverOptions) {
|
||||||
@ -244,11 +245,10 @@ func WriteBufferSize(s int) ServerOption {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadBufferSize lets you set the size of read buffer, this determines how much data can be read at most
|
// ReadBufferSize lets you set the size of read buffer, this determines how much
|
||||||
// for one read syscall.
|
// data can be read at most for one read syscall. The default value for this
|
||||||
// The default value for this buffer is 32KB.
|
// buffer is 32KB. Zero or negative values will disable read buffer for a
|
||||||
// Zero will disable read buffer for a connection so data framer can access the underlying
|
// connection so data framer can access the underlying conn directly.
|
||||||
// conn directly.
|
|
||||||
func ReadBufferSize(s int) ServerOption {
|
func ReadBufferSize(s int) ServerOption {
|
||||||
return newFuncServerOption(func(o *serverOptions) {
|
return newFuncServerOption(func(o *serverOptions) {
|
||||||
o.readBufferSize = s
|
o.readBufferSize = s
|
||||||
@ -942,7 +942,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) serveStreams(st transport.ServerTransport) {
|
func (s *Server) serveStreams(st transport.ServerTransport) {
|
||||||
defer st.Close()
|
defer st.Close(errors.New("finished serving streams for the server transport"))
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
var roundRobinCounter uint32
|
var roundRobinCounter uint32
|
||||||
@ -1008,7 +1008,8 @@ var _ http.Handler = (*Server)(nil)
|
|||||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers)
|
st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
// Errors returned from transport.NewServerHandlerTransport have
|
||||||
|
// already been written to w.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !s.addConn(listenerAddressForServeHTTP, st) {
|
if !s.addConn(listenerAddressForServeHTTP, st) {
|
||||||
@ -1046,7 +1047,7 @@ func (s *Server) addConn(addr string, st transport.ServerTransport) bool {
|
|||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
defer s.mu.Unlock()
|
defer s.mu.Unlock()
|
||||||
if s.conns == nil {
|
if s.conns == nil {
|
||||||
st.Close()
|
st.Close(errors.New("Server.addConn called when server has already been stopped"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if s.drain {
|
if s.drain {
|
||||||
@ -1150,21 +1151,16 @@ func chainUnaryServerInterceptors(s *Server) {
|
|||||||
|
|
||||||
func chainUnaryInterceptors(interceptors []UnaryServerInterceptor) UnaryServerInterceptor {
|
func chainUnaryInterceptors(interceptors []UnaryServerInterceptor) UnaryServerInterceptor {
|
||||||
return func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (interface{}, error) {
|
return func(ctx context.Context, req interface{}, info *UnaryServerInfo, handler UnaryHandler) (interface{}, error) {
|
||||||
// the struct ensures the variables are allocated together, rather than separately, since we
|
return interceptors[0](ctx, req, info, getChainUnaryHandler(interceptors, 0, info, handler))
|
||||||
// know they should be garbage collected together. This saves 1 allocation and decreases
|
|
||||||
// time/call by about 10% on the microbenchmark.
|
|
||||||
var state struct {
|
|
||||||
i int
|
|
||||||
next UnaryHandler
|
|
||||||
}
|
}
|
||||||
state.next = func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
||||||
if state.i == len(interceptors)-1 {
|
|
||||||
return interceptors[state.i](ctx, req, info, handler)
|
|
||||||
}
|
}
|
||||||
state.i++
|
|
||||||
return interceptors[state.i-1](ctx, req, info, state.next)
|
func getChainUnaryHandler(interceptors []UnaryServerInterceptor, curr int, info *UnaryServerInfo, finalHandler UnaryHandler) UnaryHandler {
|
||||||
|
if curr == len(interceptors)-1 {
|
||||||
|
return finalHandler
|
||||||
}
|
}
|
||||||
return state.next(ctx, req)
|
return func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return interceptors[curr+1](ctx, req, info, getChainUnaryHandler(interceptors, curr+1, info, finalHandler))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1470,21 +1466,16 @@ func chainStreamServerInterceptors(s *Server) {
|
|||||||
|
|
||||||
func chainStreamInterceptors(interceptors []StreamServerInterceptor) StreamServerInterceptor {
|
func chainStreamInterceptors(interceptors []StreamServerInterceptor) StreamServerInterceptor {
|
||||||
return func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error {
|
return func(srv interface{}, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error {
|
||||||
// the struct ensures the variables are allocated together, rather than separately, since we
|
return interceptors[0](srv, ss, info, getChainStreamHandler(interceptors, 0, info, handler))
|
||||||
// know they should be garbage collected together. This saves 1 allocation and decreases
|
|
||||||
// time/call by about 10% on the microbenchmark.
|
|
||||||
var state struct {
|
|
||||||
i int
|
|
||||||
next StreamHandler
|
|
||||||
}
|
}
|
||||||
state.next = func(srv interface{}, ss ServerStream) error {
|
|
||||||
if state.i == len(interceptors)-1 {
|
|
||||||
return interceptors[state.i](srv, ss, info, handler)
|
|
||||||
}
|
}
|
||||||
state.i++
|
|
||||||
return interceptors[state.i-1](srv, ss, info, state.next)
|
func getChainStreamHandler(interceptors []StreamServerInterceptor, curr int, info *StreamServerInfo, finalHandler StreamHandler) StreamHandler {
|
||||||
|
if curr == len(interceptors)-1 {
|
||||||
|
return finalHandler
|
||||||
}
|
}
|
||||||
return state.next(srv, ss)
|
return func(srv interface{}, stream ServerStream) error {
|
||||||
|
return interceptors[curr+1](srv, stream, info, getChainStreamHandler(interceptors, curr+1, info, finalHandler))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1819,7 +1810,7 @@ func (s *Server) Stop() {
|
|||||||
}
|
}
|
||||||
for _, cs := range conns {
|
for _, cs := range conns {
|
||||||
for st := range cs {
|
for st := range cs {
|
||||||
st.Close()
|
st.Close(errors.New("Server.Stop called"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if s.opts.numServerWorkers > 0 {
|
if s.opts.numServerWorkers > 0 {
|
||||||
|
2
vendor/google.golang.org/grpc/stream.go
generated
vendored
2
vendor/google.golang.org/grpc/stream.go
generated
vendored
@ -416,7 +416,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error)
|
|||||||
ctx = trace.NewContext(ctx, trInfo.tr)
|
ctx = trace.NewContext(ctx, trInfo.tr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cs.cc.parsedTarget.Scheme == "xds" {
|
if cs.cc.parsedTarget.URL.Scheme == "xds" {
|
||||||
// Add extra metadata (metadata that will be added by transport) to context
|
// Add extra metadata (metadata that will be added by transport) to context
|
||||||
// so the balancer can see them.
|
// so the balancer can see them.
|
||||||
ctx = grpcutil.WithExtraMetadata(ctx, metadata.Pairs(
|
ctx = grpcutil.WithExtraMetadata(ctx, metadata.Pairs(
|
||||||
|
2
vendor/google.golang.org/grpc/version.go
generated
vendored
2
vendor/google.golang.org/grpc/version.go
generated
vendored
@ -19,4 +19,4 @@
|
|||||||
package grpc
|
package grpc
|
||||||
|
|
||||||
// Version is the current grpc version.
|
// Version is the current grpc version.
|
||||||
const Version = "1.51.0"
|
const Version = "1.52.0"
|
||||||
|
3
vendor/google.golang.org/grpc/vet.sh
generated
vendored
3
vendor/google.golang.org/grpc/vet.sh
generated
vendored
@ -121,8 +121,9 @@ done
|
|||||||
#
|
#
|
||||||
# TODO(dfawley): don't use deprecated functions in examples or first-party
|
# TODO(dfawley): don't use deprecated functions in examples or first-party
|
||||||
# plugins.
|
# plugins.
|
||||||
|
# TODO(dfawley): enable ST1019 (duplicate imports) but allow for protobufs.
|
||||||
SC_OUT="$(mktemp)"
|
SC_OUT="$(mktemp)"
|
||||||
staticcheck -go 1.9 -checks 'inherit,-ST1015' ./... > "${SC_OUT}" || true
|
staticcheck -go 1.19 -checks 'inherit,-ST1015,-ST1019,-SA1019' ./... > "${SC_OUT}" || true
|
||||||
# Error if anything other than deprecation warnings are printed.
|
# Error if anything other than deprecation warnings are printed.
|
||||||
not grep -v "is deprecated:.*SA1019" "${SC_OUT}"
|
not grep -v "is deprecated:.*SA1019" "${SC_OUT}"
|
||||||
# Only ignore the following deprecated types/fields/functions.
|
# Only ignore the following deprecated types/fields/functions.
|
||||||
|
40
vendor/modules.txt
vendored
40
vendor/modules.txt
vendored
@ -1,5 +1,3 @@
|
|||||||
# cloud.google.com/go/compute/metadata v0.2.1
|
|
||||||
## explicit; go 1.19
|
|
||||||
# github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 => github.com/AdamKorcz/go-fuzz-headers-1 v0.0.0-20230111232327-1f10f66a31bf
|
# github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 => github.com/AdamKorcz/go-fuzz-headers-1 v0.0.0-20230111232327-1f10f66a31bf
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
github.com/AdaLogics/go-fuzz-headers
|
github.com/AdaLogics/go-fuzz-headers
|
||||||
@ -430,11 +428,11 @@ go.opencensus.io/internal
|
|||||||
go.opencensus.io/trace
|
go.opencensus.io/trace
|
||||||
go.opencensus.io/trace/internal
|
go.opencensus.io/trace/internal
|
||||||
go.opencensus.io/trace/tracestate
|
go.opencensus.io/trace/tracestate
|
||||||
# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.4
|
# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.37.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc
|
||||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal
|
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal
|
||||||
# go.opentelemetry.io/otel v1.11.1
|
# go.opentelemetry.io/otel v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel
|
go.opentelemetry.io/otel
|
||||||
go.opentelemetry.io/otel/attribute
|
go.opentelemetry.io/otel/attribute
|
||||||
@ -448,22 +446,36 @@ go.opentelemetry.io/otel/internal/baggage
|
|||||||
go.opentelemetry.io/otel/internal/global
|
go.opentelemetry.io/otel/internal/global
|
||||||
go.opentelemetry.io/otel/propagation
|
go.opentelemetry.io/otel/propagation
|
||||||
go.opentelemetry.io/otel/semconv/internal
|
go.opentelemetry.io/otel/semconv/internal
|
||||||
|
go.opentelemetry.io/otel/semconv/internal/v2
|
||||||
go.opentelemetry.io/otel/semconv/v1.12.0
|
go.opentelemetry.io/otel/semconv/v1.12.0
|
||||||
# go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.1
|
go.opentelemetry.io/otel/semconv/v1.17.0
|
||||||
|
go.opentelemetry.io/otel/semconv/v1.17.0/httpconv
|
||||||
|
# go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry
|
go.opentelemetry.io/otel/exporters/otlp/internal/retry
|
||||||
# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.1
|
# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/otlpconfig
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform
|
||||||
# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.1
|
# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
|
||||||
# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.1
|
# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
|
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp
|
||||||
# go.opentelemetry.io/otel/sdk v1.11.1
|
# go.opentelemetry.io/otel/metric v0.34.0
|
||||||
|
## explicit; go 1.18
|
||||||
|
go.opentelemetry.io/otel/metric
|
||||||
|
go.opentelemetry.io/otel/metric/global
|
||||||
|
go.opentelemetry.io/otel/metric/instrument
|
||||||
|
go.opentelemetry.io/otel/metric/instrument/asyncfloat64
|
||||||
|
go.opentelemetry.io/otel/metric/instrument/asyncint64
|
||||||
|
go.opentelemetry.io/otel/metric/instrument/syncfloat64
|
||||||
|
go.opentelemetry.io/otel/metric/instrument/syncint64
|
||||||
|
go.opentelemetry.io/otel/metric/internal/global
|
||||||
|
go.opentelemetry.io/otel/metric/unit
|
||||||
|
# go.opentelemetry.io/otel/sdk v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel/sdk/instrumentation
|
go.opentelemetry.io/otel/sdk/instrumentation
|
||||||
go.opentelemetry.io/otel/sdk/internal
|
go.opentelemetry.io/otel/sdk/internal
|
||||||
@ -471,7 +483,7 @@ go.opentelemetry.io/otel/sdk/internal/env
|
|||||||
go.opentelemetry.io/otel/sdk/resource
|
go.opentelemetry.io/otel/sdk/resource
|
||||||
go.opentelemetry.io/otel/sdk/trace
|
go.opentelemetry.io/otel/sdk/trace
|
||||||
go.opentelemetry.io/otel/sdk/trace/tracetest
|
go.opentelemetry.io/otel/sdk/trace/tracetest
|
||||||
# go.opentelemetry.io/otel/trace v1.11.1
|
# go.opentelemetry.io/otel/trace v1.12.0
|
||||||
## explicit; go 1.18
|
## explicit; go 1.18
|
||||||
go.opentelemetry.io/otel/trace
|
go.opentelemetry.io/otel/trace
|
||||||
# go.opentelemetry.io/proto/otlp v0.19.0
|
# go.opentelemetry.io/proto/otlp v0.19.0
|
||||||
@ -507,8 +519,8 @@ golang.org/x/net/internal/timeseries
|
|||||||
golang.org/x/net/proxy
|
golang.org/x/net/proxy
|
||||||
golang.org/x/net/trace
|
golang.org/x/net/trace
|
||||||
golang.org/x/net/websocket
|
golang.org/x/net/websocket
|
||||||
# golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b
|
# golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783
|
||||||
## explicit; go 1.11
|
## explicit; go 1.17
|
||||||
golang.org/x/oauth2
|
golang.org/x/oauth2
|
||||||
golang.org/x/oauth2/internal
|
golang.org/x/oauth2/internal
|
||||||
# golang.org/x/sync v0.1.0
|
# golang.org/x/sync v0.1.0
|
||||||
@ -570,14 +582,14 @@ google.golang.org/genproto/googleapis/rpc/code
|
|||||||
google.golang.org/genproto/googleapis/rpc/errdetails
|
google.golang.org/genproto/googleapis/rpc/errdetails
|
||||||
google.golang.org/genproto/googleapis/rpc/status
|
google.golang.org/genproto/googleapis/rpc/status
|
||||||
google.golang.org/genproto/protobuf/field_mask
|
google.golang.org/genproto/protobuf/field_mask
|
||||||
# google.golang.org/grpc v1.51.0
|
# google.golang.org/grpc v1.52.0
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
google.golang.org/grpc
|
google.golang.org/grpc
|
||||||
google.golang.org/grpc/attributes
|
google.golang.org/grpc/attributes
|
||||||
google.golang.org/grpc/backoff
|
google.golang.org/grpc/backoff
|
||||||
google.golang.org/grpc/balancer
|
google.golang.org/grpc/balancer
|
||||||
google.golang.org/grpc/balancer/base
|
google.golang.org/grpc/balancer/base
|
||||||
google.golang.org/grpc/balancer/grpclb/state
|
google.golang.org/grpc/balancer/grpclb/grpclbstate
|
||||||
google.golang.org/grpc/balancer/roundrobin
|
google.golang.org/grpc/balancer/roundrobin
|
||||||
google.golang.org/grpc/binarylog/grpc_binarylog_v1
|
google.golang.org/grpc/binarylog/grpc_binarylog_v1
|
||||||
google.golang.org/grpc/channelz
|
google.golang.org/grpc/channelz
|
||||||
|
Loading…
Reference in New Issue
Block a user