mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-25 00:20:32 +00:00
[chore] update latest deps, ensure readme up to date (#1873)
* [chore] update latest deps, ensure readme up to date * remove double entry
This commit is contained in:
parent
f1b70cc00f
commit
b401bd1ccb
156 changed files with 11730 additions and 2842 deletions
54
README.md
54
README.md
|
@ -33,6 +33,8 @@ Here's a screenshot of the instance landing page!
|
|||
- [Wishlist](#wishlist)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Third-Party Packaging](#third-party-packaging)
|
||||
- [Distribution packaging](#distribution-packaging)
|
||||
- [Self-hosting](#self-hosting)
|
||||
- [Known Issues](#known-issues)
|
||||
- [Client App Issues](#client-app-issues)
|
||||
- [Federation Issues](#federation-issues)
|
||||
|
@ -216,27 +218,31 @@ For bugs and feature requests, please check to see if there's [already an issue]
|
|||
|
||||
### Libraries
|
||||
|
||||
The following libraries and frameworks are used by GoToSocial, with gratitude 💕
|
||||
The following open source libraries, frameworks, and tools are used by GoToSocial, with gratitude 💕
|
||||
|
||||
- [abema/go-mp4](https://github.com/abema/go-mp4); mp4 parsing. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [buckket/go-blurhash](https://github.com/buckket/go-blurhash); used for generating image blurhashes. [GPL-3.0 License](https://spdx.org/licenses/GPL-3.0-only.html).
|
||||
- [coreos/go-oidc](https://github.com/coreos/go-oidc); OIDC client library. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [disintegration/imaging](https://github.com/disintegration/imaging); image resizing. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gin-gonic/gin](https://github.com/gin-gonic/gin); speedy router engine. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- Gin:
|
||||
- [gin-contrib/cors](https://github.com/gin-contrib/cors); Gin CORS middleware. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gin-contrib/gzip](https://github.com/gin-contrib/gzip); Gin gzip middleware. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gin-contrib/sessions](https://github.com/gin-contrib/sessions); Gin sessions middleware. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gin-contrib/static](https://github.com/gin-contrib/static); Gin static page middleware. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gin-gonic/gin](https://github.com/gin-gonic/gin); speedy router engine. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [go-fed/httpsig](https://github.com/go-fed/httpsig); secure HTTP signature library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [google/uuid](https://github.com/google/uuid); UUID generation. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [google/wuffs](https://github.com/google/wuffs); png-stripping code. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [go-playground/validator](https://github.com/go-playground/validator); struct validation. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gorilla/feeds](https://github.com/gorilla/feeds); RSS + Atom feed generation. [BSD-2-Clause License](https://spdx.org/licenses/BSD-2-Clause.html).
|
||||
- [gorilla/websocket](https://github.com/gorilla/websocket); Websocket connectivity. [BSD-2-Clause License](https://spdx.org/licenses/BSD-2-Clause.html).
|
||||
- gruf's libraries:
|
||||
- [gruf/go-debug](https://codeberg.org/gruf/go-debug); debug build tag. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- Go-Playground:
|
||||
- [go-playground/form](https://github.com/go-playground/form); funky form mapping support. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [go-playground/validator](https://github.com/go-playground/validator); struct validation. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- Gorilla:
|
||||
- [gorilla/feeds](https://github.com/gorilla/feeds); RSS + Atom feed generation. [BSD-2-Clause License](https://spdx.org/licenses/BSD-2-Clause.html).
|
||||
- [gorilla/websocket](https://github.com/gorilla/websocket); Websocket connectivity. [BSD-2-Clause License](https://spdx.org/licenses/BSD-2-Clause.html).
|
||||
- [go-swagger/go-swagger](https://github.com/go-swagger/go-swagger); Swagger OpenAPI spec generation. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- gruf:
|
||||
- [gruf/go-bytesize](https://codeberg.org/gruf/go-bytesize); byte size parsing / formatting. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gruf/go-cache](https://codeberg.org/gruf/go-cache); object & result caching. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gruf/go-debug](https://codeberg.org/gruf/go-debug); debug build tag. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gruf/go-errors](https://codeberg.org/gruf/go-errors); performant multi-error checking [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gruf/go-fastcopy](https://codeberg.org/gruf/go-fastcopy); performant pooled I/O copying [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gruf/go-kv](https://codeberg.org/gruf/go-kv); log field formatting. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
|
@ -245,31 +251,33 @@ The following libraries and frameworks are used by GoToSocial, with gratitude
|
|||
- [gruf/go-sched](https://codeberg.org/gruf/go-sched); task scheduler. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [gruf/go-store](https://codeberg.org/gruf/go-store); file storage backend (local & s3). [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [h2non/filetype](https://github.com/h2non/filetype); filetype checking. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [jackc/pgx](https://github.com/jackc/pgx); Postgres driver. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- jackc:
|
||||
- [jackc/pgx](https://github.com/jackc/pgconn); Postgres driver. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [jackc/pgx](https://github.com/jackc/pgx); Postgres driver and toolkit. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [KimMachineGun/automemlimit](https://github.com/KimMachineGun/automemlimit); cgroups memory limit checking. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [mcuadros/go-syslog](https://github.com/mcuadros/go-syslog); Syslog server library. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [microcosm-cc/bluemonday](https://github.com/microcosm-cc/bluemonday); HTML user-input sanitization. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [miekg/dns](https://github.com/miekg/dns); DNS utilities. [Go License](https://go.dev/LICENSE).
|
||||
- [minio/minio-go](https://github.com/minio/minio-go); S3 client SDK. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [mitchellh/mapstructure](https://github.com/mitchellh/mapstructure); Go interface => struct parsing. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [modernc.org/sqlite](https://gitlab.com/cznic/sqlite); cgo-free port of SQLite. [Other License](https://gitlab.com/cznic/sqlite/-/blob/master/LICENSE).
|
||||
- [modernc.org/ccgo](https://gitlab.com/cznic/ccgo); c99 AST -> Go translater. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [modernc.org/libc](https://gitlab.com/cznic/libc); C-runtime services. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [mvdan/xurls](https://github.com/mvdan/xurls); URL parsing regular expressions. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [mvdan.cc/xurls](https://github.com/mvdan/xurls); URL parsing regular expressions. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [oklog/ulid](https://github.com/oklog/ulid); sequential, database-friendly ID generation. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [ReneKroon/ttlcache](https://github.com/ReneKroon/ttlcache); in-memory caching. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [robfig/cron](https://github.com/robfig/cron); cron job scheduling. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [russross/blackfriday](https://github.com/russross/blackfriday); markdown parsing for statuses. [Simplified BSD License](https://spdx.org/licenses/BSD-2-Clause.html).
|
||||
- [spf13/cobra](https://github.com/spf13/cobra); command-line tooling. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [spf13/pflag](https://github.com/spf13/pflag); command-line flag utilities. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [spf13/viper](https://github.com/spf13/viper); configuration management. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [open-telemetry/opentelemetry-go](https://github.com/open-telemetry/opentelemetry-go); OpenTelemetry API + SDK. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- spf13:
|
||||
- [spf13/cobra](https://github.com/spf13/cobra); command-line tooling. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [spf13/viper](https://github.com/spf13/viper); configuration management. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- [stretchr/testify](https://github.com/stretchr/testify); test framework. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [superseriousbusiness/exif-terminator](https://github.com/superseriousbusiness/exif-terminator); EXIF data removal. [GNU AGPL v3 LICENSE](https://spdx.org/licenses/AGPL-3.0-or-later.html).
|
||||
- [superseriousbusiness/activity](https://github.com/superseriousbusiness/activity) forked from [go-fed/activity](https://github.com/go-fed/activity); Golang ActivityPub/ActivityStreams library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [superseriousbusiness/oauth2](https://github.com/superseriousbusiness/oauth2) forked from [go-oauth2/oauth2](https://github.com/go-oauth2/oauth2); OAuth server framework and token handling. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [go-swagger/go-swagger](https://github.com/go-swagger/go-swagger); Swagger OpenAPI spec generation. [Apache-2.0 License](https://spdx.org/licenses/Apache-2.0.html).
|
||||
- superseriousbusiness:
|
||||
- [superseriousbusiness/activity](https://github.com/superseriousbusiness/activity) forked from [go-fed/activity](https://github.com/go-fed/activity); Golang ActivityPub/ActivityStreams library. [BSD-3-Clause License](https://spdx.org/licenses/BSD-3-Clause.html).
|
||||
- [superseriousbusiness/exif-terminator](https://github.com/superseriousbusiness/exif-terminator); EXIF data removal. [GNU AGPL v3 LICENSE](https://spdx.org/licenses/AGPL-3.0-or-later.html).
|
||||
- [superseriousbusiness/oauth2](https://github.com/superseriousbusiness/oauth2) forked from [go-oauth2/oauth2](https://github.com/go-oauth2/oauth2); OAuth server framework and token handling. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [tdewolff/minify](https://github.com/tdewolff/minify); HTML minification for Markdown-submitted posts. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [uber-go/automaxprocs](https://github.com/uber-go/automaxprocs); GOMAXPROCS automation. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [ulule/limiter](https://github.com/ulule/limiter); http rate limit middleware. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [uptrace/bun](https://github.com/uptrace/bun); database ORM. [BSD-2-Clause License](https://spdx.org/licenses/BSD-2-Clause.html).
|
||||
- [wagslane/go-password-validator](https://github.com/wagslane/go-password-validator); password strength validation. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [ulule/limiter](https://github.com/ulule/limiter); http rate limit middleware. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
- [yuin/goldmark](https://github.com/yuin/goldmark); markdown parser. [MIT License](https://spdx.org/licenses/MIT.html).
|
||||
|
||||
### Image Attribution and Licensing
|
||||
|
||||
|
|
48
go.mod
48
go.mod
|
@ -27,7 +27,7 @@ require (
|
|||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/go-fed/httpsig v1.1.0
|
||||
github.com/go-playground/form/v4 v4.2.0
|
||||
github.com/go-playground/validator/v10 v10.14.0
|
||||
github.com/go-playground/validator/v10 v10.14.1
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/feeds v1.1.1
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
|
@ -40,34 +40,34 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/oklog/ulid v1.3.1
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/viper v1.15.0
|
||||
github.com/spf13/viper v1.16.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/superseriousbusiness/activity v1.3.0-gts
|
||||
github.com/superseriousbusiness/exif-terminator v0.5.0
|
||||
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB.0.20230227143000-f4900831d6c8
|
||||
github.com/tdewolff/minify/v2 v2.12.5
|
||||
github.com/tdewolff/minify/v2 v2.12.6
|
||||
github.com/ulule/limiter/v3 v3.11.2
|
||||
github.com/uptrace/bun v1.1.13
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.13
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.13
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.12
|
||||
github.com/uptrace/bun v1.1.14
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.14
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.14
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.14
|
||||
github.com/wagslane/go-password-validator v0.3.0
|
||||
github.com/yuin/goldmark v1.5.4
|
||||
go.opentelemetry.io/otel v1.14.0
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.14.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0
|
||||
go.opentelemetry.io/otel/sdk v1.14.0
|
||||
go.opentelemetry.io/otel/trace v1.14.0
|
||||
go.opentelemetry.io/otel v1.16.0
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.16.0
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0
|
||||
go.opentelemetry.io/otel/sdk v1.16.0
|
||||
go.opentelemetry.io/otel/trace v1.16.0
|
||||
go.uber.org/automaxprocs v1.5.2
|
||||
golang.org/x/crypto v0.9.0
|
||||
golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d
|
||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
|
||||
golang.org/x/image v0.7.0
|
||||
golang.org/x/net v0.10.0
|
||||
golang.org/x/oauth2 v0.8.0
|
||||
golang.org/x/text v0.9.0
|
||||
gopkg.in/mcuadros/go-syslog.v2 v2.3.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
modernc.org/sqlite v1.22.1
|
||||
modernc.org/sqlite v1.23.0
|
||||
mvdan.cc/xurls/v2 v2.5.0
|
||||
)
|
||||
|
||||
|
@ -112,7 +112,7 @@ require (
|
|||
github.com/godbus/dbus/v5 v5.0.4 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/gorilla/context v1.1.1 // indirect
|
||||
github.com/gorilla/css v1.0.0 // indirect
|
||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||
|
@ -145,30 +145,30 @@ require (
|
|||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rs/xid v1.5.0 // indirect
|
||||
github.com/sirupsen/logrus v1.9.2 // indirect
|
||||
github.com/spf13/afero v1.9.3 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/spf13/afero v1.9.5 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.4.2 // indirect
|
||||
github.com/superseriousbusiness/go-jpeg-image-structure/v2 v2.0.0-20220321154430-d89a106fdabe // indirect
|
||||
github.com/tdewolff/parse/v2 v2.6.5 // indirect
|
||||
github.com/tdewolff/parse/v2 v2.6.6 // indirect
|
||||
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.21 // indirect
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1 // indirect
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v0.37.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.16.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/mod v0.10.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
|
||||
google.golang.org/grpc v1.54.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
|
||||
google.golang.org/grpc v1.55.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
|
|
108
go.sum
108
go.sum
|
@ -181,7 +181,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
|
|||
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8=
|
||||
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
|
@ -231,8 +231,8 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl
|
|||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
|
||||
github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=
|
||||
github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-playground/validator/v10 v10.14.1 h1:9c50NUPC30zyuKprjL3vNZ0m5oG+jU0zvx4AqHGnv4k=
|
||||
github.com/go-playground/validator/v10 v10.14.1/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
|
||||
|
@ -251,8 +251,8 @@ github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgR
|
|||
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo=
|
||||
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=
|
||||
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
|
||||
github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
|
@ -279,8 +279,9 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD
|
|||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
|
@ -418,8 +419,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxv
|
|||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
|
@ -517,18 +518,18 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1
|
|||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
|
||||
github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
|
||||
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
|
||||
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
|
||||
github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
|
||||
github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
|
||||
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
|
||||
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
|
||||
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU=
|
||||
github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA=
|
||||
github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc=
|
||||
github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
|
@ -559,12 +560,13 @@ github.com/superseriousbusiness/go-jpeg-image-structure/v2 v2.0.0-20220321154430
|
|||
github.com/superseriousbusiness/go-jpeg-image-structure/v2 v2.0.0-20220321154430-d89a106fdabe/go.mod h1:gH4P6gN1V+wmIw5o97KGaa1RgXB/tVpC2UNzijhg3E4=
|
||||
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB.0.20230227143000-f4900831d6c8 h1:nTIhuP157oOFcscuoK1kCme1xTeGIzztSw70lX9NrDQ=
|
||||
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB.0.20230227143000-f4900831d6c8/go.mod h1:uYC/W92oVRJ49Vh1GcvTqpeFqHi+Ovrl2sMllQWRAEo=
|
||||
github.com/tdewolff/minify/v2 v2.12.5 h1:s2KDBt/D/3ayE3gcqQF8VIgTmYgkx+btuLvVAeePzZM=
|
||||
github.com/tdewolff/minify/v2 v2.12.5/go.mod h1:i8QXtVyL7Ddwc4I5gqzvgBqKlTMgMNTbiXaPO4Iqg+A=
|
||||
github.com/tdewolff/parse/v2 v2.6.5 h1:lYvWBk55GkqKl0JJenGpmrgu/cPHQQ6/Mm1hBGswoGQ=
|
||||
github.com/tdewolff/parse/v2 v2.6.5/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
|
||||
github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM=
|
||||
github.com/tdewolff/minify/v2 v2.12.6 h1:kw5FU0ErJyd7fs+TMojIlBvLyEjsN93wP1n8NUOs320=
|
||||
github.com/tdewolff/minify/v2 v2.12.6/go.mod h1:ZRKTheiOGyLSK8hOZWWv+YoJAECzDivNgAlVYDHp/Ws=
|
||||
github.com/tdewolff/parse/v2 v2.6.6 h1:Yld+0CrKUJaCV78DL1G2nk3C9lKrxyRTux5aaK/AkDo=
|
||||
github.com/tdewolff/parse/v2 v2.6.6/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOdX78o+Jgrs=
|
||||
github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
|
||||
github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0=
|
||||
github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE=
|
||||
github.com/tidwall/btree v0.0.0-20191029221954-400434d76274 h1:G6Z6HvJuPjG6XfNGi/feOATzeJrfgTNJY+rGrHbA04E=
|
||||
github.com/tidwall/btree v0.0.0-20191029221954-400434d76274/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
|
||||
github.com/tidwall/buntdb v1.1.2 h1:noCrqQXL9EKMtcdwJcmuVKSEjqu1ua99RHHgbLTEHRo=
|
||||
|
@ -593,16 +595,16 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d
|
|||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ulule/limiter/v3 v3.11.2 h1:P4yOrxoEMJbOTfRJR2OzjL90oflzYPPmWg+dvwN2tHA=
|
||||
github.com/ulule/limiter/v3 v3.11.2/go.mod h1:QG5GnFOCV+k7lrL5Y8kgEeeflPH3+Cviqlqa8SVSQxI=
|
||||
github.com/uptrace/bun v1.1.13 h1:IrxlIJHzCHFwmIzx66A9vi6qx8rHsHFiiT9LqlafHZw=
|
||||
github.com/uptrace/bun v1.1.13/go.mod h1:UsZPd0AuHOx2QkkKXnqkHnFBjVp5tKqI7s4A750u9v0=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.13 h1:j9BecpkRA9SDVBwh6oKhC5rABk4B40s66OCcqBHSQXM=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.13/go.mod h1:G9h6kk5qfTyACjTja7gqM7SbRc0rqRc9AWDjzxwA7nY=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.13 h1:ipYi26qS4xC9AVmArXqv4Rq+EJFtrsZfS+Ksqx21QVI=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.13/go.mod h1:pOUXT+1n1/cIJUwdq7w97NS6nA1kd01o8ZRWPy/JBMM=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.12 h1:uWPU75j9dYGXMRC9jF0ASlndZZAcngoqZagH4w3kn54=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.12/go.mod h1:QfszJGLzNaTTGvvg17cEEUyEwxXq2NJ7sRvrPYvYSIU=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.21 h1:iHkIlTU2P3xbSbVJbAiHL9IT+ekYV5empheF+652yeQ=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.1.21/go.mod h1:hiCFa1UeZITKXi8lhu2qwOD5LHXjdGMCUIQHbybxoF0=
|
||||
github.com/uptrace/bun v1.1.14 h1:S5vvNnjEynJ0CvnrBOD7MIRW7q/WbtvFXrdfy0lddAM=
|
||||
github.com/uptrace/bun v1.1.14/go.mod h1:RHk6DrIisO62dv10pUOJCz5MphXThuOTpVNYEYv7NI8=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.14 h1:b7+V1KDJPQSFYgkG/6YLXCl2uvwEY3kf/GSM7hTHRDY=
|
||||
github.com/uptrace/bun/dialect/pgdialect v1.1.14/go.mod h1:v6YiaXmnKQ2FlhRD2c0ZfKd+QXH09pYn4H8ojaavkKk=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.14 h1:SlwXLxr+N1kEo8Q0cheRlnIZLZlWniEB1OI+jkiLgWE=
|
||||
github.com/uptrace/bun/dialect/sqlitedialect v1.1.14/go.mod h1:9RTEj1l4bB9a4l1Mnc9y4COTwWlFYe1dh6fyxq1rR7A=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.14 h1:jKA1zNfD2/Y/O3eFP15ao+V0cMigXN+ReNbsVUqrOhg=
|
||||
github.com/uptrace/bun/extra/bunotel v1.1.14/go.mod h1:BBuePZ4ciMqoeyRfef4GL7Z75FsiOm3Q3fvNt0z4sQk=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1 h1:sCYkntVVoSMuQuyRBaEkedb1qS1KeJJaqKbdtNfTsfM=
|
||||
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.1/go.mod h1:1frv9RN1rlTq0jzCq+mVuEQisubZCQ4OU6S/8CaHzGY=
|
||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasthttp v1.14.0/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0zHzaclZhE=
|
||||
|
@ -645,22 +647,22 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM=
|
||||
go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.14.0 h1:CjbUNd4iN2hHmWekmOqZ+zSCU+dzZppG8XsV+A3oc8Q=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.14.0/go.mod h1:4Ay9kk5vELRrbg5z4cpP9EtmQRFap2Wb0woPG4lujZA=
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho=
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0/go.mod h1:UFG7EBMRdXyFstOwH028U0sVf+AvukSGhF0g8+dmNG8=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCBXNpHxfO/aC7PAdDsSH0IbeRQ=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0/go.mod h1:HrbCVv40OOLTABmOn1ZWty6CHXkU8DK/Urc43tHug70=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0/go.mod h1:5w41DY6S9gZrbjuq6Y+753e96WfPha5IcsOSZTtullM=
|
||||
go.opentelemetry.io/otel/metric v0.37.0 h1:pHDQuLQOZwYD+Km0eb657A25NaRzy0a+eLyKfDXedEs=
|
||||
go.opentelemetry.io/otel/metric v0.37.0/go.mod h1:DmdaHfGt54iV6UKxsV9slj2bBRJcKC1B1uvDLIioc1s=
|
||||
go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY=
|
||||
go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM=
|
||||
go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M=
|
||||
go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8=
|
||||
go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s=
|
||||
go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.16.0 h1:YhxxmXZ011C0aDZKoNw+juVWAmEfv/0W2XBOv9aHTaA=
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.16.0/go.mod h1:grYbBo/5afWlPpdPZYhyn78Bk04hnvxn2+hvxQhKIQM=
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0 h1:t4ZwRPU+emrcvM2e9DHd0Fsf0JTPVcbfa/BhTDF03d0=
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.16.0/go.mod h1:vLarbg68dH2Wa77g71zmKQqlQ8+8Rq3GRG31uc0WcWI=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0 h1:cbsD4cUcviQGXdw8+bo5x2wazq10SKz8hEbtCRPcU78=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0/go.mod h1:JgXSGah17croqhJfhByOLVY719k1emAXC8MVhCIJlRs=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0 h1:TVQp/bboR4mhZSav+MdgXB8FaRho1RC8UwVn3T0vjVc=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.16.0/go.mod h1:I33vtIe0sR96wfrUcilIzLoA3mLHhRmz9S9Te0S3gDo=
|
||||
go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo=
|
||||
go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4=
|
||||
go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE=
|
||||
go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4=
|
||||
go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs=
|
||||
go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0=
|
||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||
go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=
|
||||
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
|
||||
|
@ -688,7 +690,7 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm
|
|||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
|
@ -702,8 +704,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
|
|||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d h1:vtUKgx8dahOomfFzLREU8nSv25YHnTgLBn4rDnWZdU0=
|
||||
golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
|
||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
|
||||
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
|
@ -770,6 +772,7 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
|
|||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
|
@ -846,6 +849,7 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -1005,8 +1009,8 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D
|
|||
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
|
||||
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A=
|
||||
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
|
@ -1027,8 +1031,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
|
|||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
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.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag=
|
||||
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
|
||||
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
|
||||
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
|
||||
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-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
|
@ -1096,8 +1100,8 @@ modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=
|
|||
modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=
|
||||
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
|
||||
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
|
||||
modernc.org/sqlite v1.22.1 h1:P2+Dhp5FR1RlVRkQ3dDfCiv3Ok8XPxqpe70IjYVA9oE=
|
||||
modernc.org/sqlite v1.22.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk=
|
||||
modernc.org/sqlite v1.23.0 h1:MWTFBI5H1WLnXpNBh/BTruBVqzzoh28DA0iOnlkkRaM=
|
||||
modernc.org/sqlite v1.23.0/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk=
|
||||
modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY=
|
||||
modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw=
|
||||
modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY=
|
||||
|
|
2
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
2
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
|
@ -1,7 +1,7 @@
|
|||
Package validator
|
||||
=================
|
||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/validator/v10/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
![Project status](https://img.shields.io/badge/version-10.14.0-green.svg)
|
||||
![Project status](https://img.shields.io/badge/version-10.14.1-green.svg)
|
||||
[![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator)
|
||||
[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||
|
|
32
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
32
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
|
@ -1414,25 +1414,21 @@ func isURL(fl FieldLevel) bool {
|
|||
switch field.Kind() {
|
||||
case reflect.String:
|
||||
|
||||
var i int
|
||||
s := field.String()
|
||||
|
||||
// checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195
|
||||
// emulate browser and strip the '#' suffix prior to validation. see issue-#237
|
||||
if i = strings.Index(s, "#"); i > -1 {
|
||||
s = s[:i]
|
||||
}
|
||||
|
||||
if len(s) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
url, err := url.ParseRequestURI(s)
|
||||
|
||||
url, err := url.Parse(s)
|
||||
if err != nil || url.Scheme == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
if url.Host == "" && url.Fragment == "" && url.Opaque == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -1450,7 +1446,13 @@ func isHttpURL(fl FieldLevel) bool {
|
|||
case reflect.String:
|
||||
|
||||
s := strings.ToLower(field.String())
|
||||
return strings.HasPrefix(s, "http://") || strings.HasPrefix(s, "https://")
|
||||
|
||||
url, err := url.Parse(s)
|
||||
if err != nil || url.Host == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return url.Scheme == "http" || url.Scheme == "https"
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
|
@ -2568,9 +2570,17 @@ func isDirPath(fl FieldLevel) bool {
|
|||
func isJSON(fl FieldLevel) bool {
|
||||
field := fl.Field()
|
||||
|
||||
if field.Kind() == reflect.String {
|
||||
switch field.Kind() {
|
||||
case reflect.String:
|
||||
val := field.String()
|
||||
return json.Valid([]byte(val))
|
||||
case reflect.Slice:
|
||||
fieldType := field.Type()
|
||||
|
||||
if fieldType.ConvertibleTo(byteSliceType) {
|
||||
b := field.Convert(byteSliceType).Interface().([]byte)
|
||||
return json.Valid(b)
|
||||
}
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
|
|
2
vendor/github.com/go-playground/validator/v10/validator_instance.go
generated
vendored
2
vendor/github.com/go-playground/validator/v10/validator_instance.go
generated
vendored
|
@ -53,6 +53,8 @@ var (
|
|||
timeDurationType = reflect.TypeOf(time.Duration(0))
|
||||
timeType = reflect.TypeOf(time.Time{})
|
||||
|
||||
byteSliceType = reflect.TypeOf([]byte{})
|
||||
|
||||
defaultCField = &cField{namesEqual: true}
|
||||
)
|
||||
|
||||
|
|
8
vendor/github.com/golang/protobuf/jsonpb/decode.go
generated
vendored
8
vendor/github.com/golang/protobuf/jsonpb/decode.go
generated
vendored
|
@ -386,8 +386,14 @@ func (u *Unmarshaler) unmarshalMessage(m protoreflect.Message, in []byte) error
|
|||
}
|
||||
|
||||
func isSingularWellKnownValue(fd protoreflect.FieldDescriptor) bool {
|
||||
if fd.Cardinality() == protoreflect.Repeated {
|
||||
return false
|
||||
}
|
||||
if md := fd.Message(); md != nil {
|
||||
return md.FullName() == "google.protobuf.Value" && fd.Cardinality() != protoreflect.Repeated
|
||||
return md.FullName() == "google.protobuf.Value"
|
||||
}
|
||||
if ed := fd.Enum(); ed != nil {
|
||||
return ed.FullName() == "google.protobuf.NullValue"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
2
vendor/github.com/spf13/afero/afero.go
generated
vendored
2
vendor/github.com/spf13/afero/afero.go
generated
vendored
|
@ -97,7 +97,7 @@ type Fs interface {
|
|||
// Chown changes the uid and gid of the named file.
|
||||
Chown(name string, uid, gid int) error
|
||||
|
||||
//Chtimes changes the access and modification times of the named file
|
||||
// Chtimes changes the access and modification times of the named file
|
||||
Chtimes(name string, atime time.Time, mtime time.Time) error
|
||||
}
|
||||
|
||||
|
|
1
vendor/github.com/spf13/afero/basepath.go
generated
vendored
1
vendor/github.com/spf13/afero/basepath.go
generated
vendored
|
@ -40,7 +40,6 @@ func (f *BasePathFile) Name() string {
|
|||
func (f *BasePathFile) ReadDir(n int) ([]fs.DirEntry, error) {
|
||||
if rdf, ok := f.File.(fs.ReadDirFile); ok {
|
||||
return rdf.ReadDir(n)
|
||||
|
||||
}
|
||||
return readDirFile{f.File}.ReadDir(n)
|
||||
}
|
||||
|
|
9
vendor/github.com/spf13/afero/copyOnWriteFs.go
generated
vendored
9
vendor/github.com/spf13/afero/copyOnWriteFs.go
generated
vendored
|
@ -223,7 +223,7 @@ func (u *CopyOnWriteFs) OpenFile(name string, flag int, perm os.FileMode) (File,
|
|||
return nil, err
|
||||
}
|
||||
if isaDir {
|
||||
if err = u.layer.MkdirAll(dir, 0777); err != nil {
|
||||
if err = u.layer.MkdirAll(dir, 0o777); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return u.layer.OpenFile(name, flag, perm)
|
||||
|
@ -247,8 +247,9 @@ func (u *CopyOnWriteFs) OpenFile(name string, flag int, perm os.FileMode) (File,
|
|||
|
||||
// This function handles the 9 different possibilities caused
|
||||
// by the union which are the intersection of the following...
|
||||
// layer: doesn't exist, exists as a file, and exists as a directory
|
||||
// base: doesn't exist, exists as a file, and exists as a directory
|
||||
//
|
||||
// layer: doesn't exist, exists as a file, and exists as a directory
|
||||
// base: doesn't exist, exists as a file, and exists as a directory
|
||||
func (u *CopyOnWriteFs) Open(name string) (File, error) {
|
||||
// Since the overlay overrides the base we check that first
|
||||
b, err := u.isBaseFile(name)
|
||||
|
@ -322,5 +323,5 @@ func (u *CopyOnWriteFs) MkdirAll(name string, perm os.FileMode) error {
|
|||
}
|
||||
|
||||
func (u *CopyOnWriteFs) Create(name string) (File, error) {
|
||||
return u.OpenFile(name, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0666)
|
||||
return u.OpenFile(name, os.O_CREATE|os.O_TRUNC|os.O_RDWR, 0o666)
|
||||
}
|
||||
|
|
11
vendor/github.com/spf13/afero/ioutil.go
generated
vendored
11
vendor/github.com/spf13/afero/ioutil.go
generated
vendored
|
@ -141,8 +141,10 @@ func WriteFile(fs Fs, filename string, data []byte, perm os.FileMode) error {
|
|||
// We generate random temporary file names so that there's a good
|
||||
// chance the file doesn't exist yet - keeps the number of tries in
|
||||
// TempFile to a minimum.
|
||||
var randNum uint32
|
||||
var randmu sync.Mutex
|
||||
var (
|
||||
randNum uint32
|
||||
randmu sync.Mutex
|
||||
)
|
||||
|
||||
func reseed() uint32 {
|
||||
return uint32(time.Now().UnixNano() + int64(os.Getpid()))
|
||||
|
@ -190,7 +192,7 @@ func TempFile(fs Fs, dir, pattern string) (f File, err error) {
|
|||
nconflict := 0
|
||||
for i := 0; i < 10000; i++ {
|
||||
name := filepath.Join(dir, prefix+nextRandom()+suffix)
|
||||
f, err = fs.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
|
||||
f, err = fs.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0o600)
|
||||
if os.IsExist(err) {
|
||||
if nconflict++; nconflict > 10 {
|
||||
randmu.Lock()
|
||||
|
@ -214,6 +216,7 @@ func TempFile(fs Fs, dir, pattern string) (f File, err error) {
|
|||
func (a Afero) TempDir(dir, prefix string) (name string, err error) {
|
||||
return TempDir(a.Fs, dir, prefix)
|
||||
}
|
||||
|
||||
func TempDir(fs Fs, dir, prefix string) (name string, err error) {
|
||||
if dir == "" {
|
||||
dir = os.TempDir()
|
||||
|
@ -222,7 +225,7 @@ func TempDir(fs Fs, dir, prefix string) (name string, err error) {
|
|||
nconflict := 0
|
||||
for i := 0; i < 10000; i++ {
|
||||
try := filepath.Join(dir, prefix+nextRandom())
|
||||
err = fs.Mkdir(try, 0700)
|
||||
err = fs.Mkdir(try, 0o700)
|
||||
if os.IsExist(err) {
|
||||
if nconflict++; nconflict > 10 {
|
||||
randmu.Lock()
|
||||
|
|
7
vendor/github.com/spf13/afero/mem/file.go
generated
vendored
7
vendor/github.com/spf13/afero/mem/file.go
generated
vendored
|
@ -245,7 +245,7 @@ func (f *File) Truncate(size int64) error {
|
|||
defer f.fileData.Unlock()
|
||||
if size > int64(len(f.fileData.data)) {
|
||||
diff := size - int64(len(f.fileData.data))
|
||||
f.fileData.data = append(f.fileData.data, bytes.Repeat([]byte{00}, int(diff))...)
|
||||
f.fileData.data = append(f.fileData.data, bytes.Repeat([]byte{0o0}, int(diff))...)
|
||||
} else {
|
||||
f.fileData.data = f.fileData.data[0:size]
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ func (f *File) Write(b []byte) (n int, err error) {
|
|||
tail = f.fileData.data[n+int(cur):]
|
||||
}
|
||||
if diff > 0 {
|
||||
f.fileData.data = append(f.fileData.data, append(bytes.Repeat([]byte{00}, int(diff)), b...)...)
|
||||
f.fileData.data = append(f.fileData.data, append(bytes.Repeat([]byte{0o0}, int(diff)), b...)...)
|
||||
f.fileData.data = append(f.fileData.data, tail...)
|
||||
} else {
|
||||
f.fileData.data = append(f.fileData.data[:cur], b...)
|
||||
|
@ -321,16 +321,19 @@ func (s *FileInfo) Name() string {
|
|||
s.Unlock()
|
||||
return name
|
||||
}
|
||||
|
||||
func (s *FileInfo) Mode() os.FileMode {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
return s.mode
|
||||
}
|
||||
|
||||
func (s *FileInfo) ModTime() time.Time {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
return s.modtime
|
||||
}
|
||||
|
||||
func (s *FileInfo) IsDir() bool {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
|
21
vendor/github.com/spf13/afero/memmap.go
generated
vendored
21
vendor/github.com/spf13/afero/memmap.go
generated
vendored
|
@ -15,6 +15,7 @@ package afero
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -43,7 +44,7 @@ func (m *MemMapFs) getData() map[string]*mem.FileData {
|
|||
// Root should always exist, right?
|
||||
// TODO: what about windows?
|
||||
root := mem.CreateDir(FilePathSeparator)
|
||||
mem.SetMode(root, os.ModeDir|0755)
|
||||
mem.SetMode(root, os.ModeDir|0o755)
|
||||
m.data[FilePathSeparator] = root
|
||||
})
|
||||
return m.data
|
||||
|
@ -96,12 +97,12 @@ func (m *MemMapFs) registerWithParent(f *mem.FileData, perm os.FileMode) {
|
|||
pdir := filepath.Dir(filepath.Clean(f.Name()))
|
||||
err := m.lockfreeMkdir(pdir, perm)
|
||||
if err != nil {
|
||||
//log.Println("Mkdir error:", err)
|
||||
// log.Println("Mkdir error:", err)
|
||||
return
|
||||
}
|
||||
parent, err = m.lockfreeOpen(pdir)
|
||||
if err != nil {
|
||||
//log.Println("Open after Mkdir error:", err)
|
||||
// log.Println("Open after Mkdir error:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +238,7 @@ func (m *MemMapFs) OpenFile(name string, flag int, perm os.FileMode) (File, erro
|
|||
file = mem.NewReadOnlyFileHandle(file.(*mem.File).Data())
|
||||
}
|
||||
if flag&os.O_APPEND > 0 {
|
||||
_, err = file.Seek(0, os.SEEK_END)
|
||||
_, err = file.Seek(0, io.SeekEnd)
|
||||
if err != nil {
|
||||
file.Close()
|
||||
return nil, err
|
||||
|
@ -319,6 +320,18 @@ func (m *MemMapFs) Rename(oldname, newname string) error {
|
|||
} else {
|
||||
return &os.PathError{Op: "rename", Path: oldname, Err: ErrFileNotFound}
|
||||
}
|
||||
|
||||
for p, fileData := range m.getData() {
|
||||
if strings.HasPrefix(p, oldname+FilePathSeparator) {
|
||||
m.mu.RUnlock()
|
||||
m.mu.Lock()
|
||||
delete(m.getData(), p)
|
||||
p := strings.Replace(p, oldname, newname, 1)
|
||||
m.getData()[p] = fileData
|
||||
m.mu.Unlock()
|
||||
m.mu.RLock()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
1
vendor/github.com/spf13/afero/regexpfs.go
generated
vendored
1
vendor/github.com/spf13/afero/regexpfs.go
generated
vendored
|
@ -10,7 +10,6 @@ import (
|
|||
// The RegexpFs filters files (not directories) by regular expression. Only
|
||||
// files matching the given regexp will be allowed, all others get a ENOENT error (
|
||||
// "No such file or directory").
|
||||
//
|
||||
type RegexpFs struct {
|
||||
re *regexp.Regexp
|
||||
source Fs
|
||||
|
|
6
vendor/github.com/spf13/afero/symlink.go
generated
vendored
6
vendor/github.com/spf13/afero/symlink.go
generated
vendored
|
@ -21,9 +21,9 @@ import (
|
|||
// filesystems saying so.
|
||||
// It indicates support for 3 symlink related interfaces that implement the
|
||||
// behaviors of the os methods:
|
||||
// - Lstat
|
||||
// - Symlink, and
|
||||
// - Readlink
|
||||
// - Lstat
|
||||
// - Symlink, and
|
||||
// - Readlink
|
||||
type Symlinker interface {
|
||||
Lstater
|
||||
Linker
|
||||
|
|
7
vendor/github.com/spf13/afero/unionFile.go
generated
vendored
7
vendor/github.com/spf13/afero/unionFile.go
generated
vendored
|
@ -47,7 +47,7 @@ func (f *UnionFile) Read(s []byte) (int, error) {
|
|||
if (err == nil || err == io.EOF) && f.Base != nil {
|
||||
// advance the file position also in the base file, the next
|
||||
// call may be a write at this position (or a seek with SEEK_CUR)
|
||||
if _, seekErr := f.Base.Seek(int64(n), os.SEEK_CUR); seekErr != nil {
|
||||
if _, seekErr := f.Base.Seek(int64(n), io.SeekCurrent); seekErr != nil {
|
||||
// only overwrite err in case the seek fails: we need to
|
||||
// report an eventual io.EOF to the caller
|
||||
err = seekErr
|
||||
|
@ -130,7 +130,7 @@ func (f *UnionFile) Name() string {
|
|||
type DirsMerger func(lofi, bofi []os.FileInfo) ([]os.FileInfo, error)
|
||||
|
||||
var defaultUnionMergeDirsFn = func(lofi, bofi []os.FileInfo) ([]os.FileInfo, error) {
|
||||
var files = make(map[string]os.FileInfo)
|
||||
files := make(map[string]os.FileInfo)
|
||||
|
||||
for _, fi := range lofi {
|
||||
files[fi.Name()] = fi
|
||||
|
@ -151,7 +151,6 @@ var defaultUnionMergeDirsFn = func(lofi, bofi []os.FileInfo) ([]os.FileInfo, err
|
|||
}
|
||||
|
||||
return rfi, nil
|
||||
|
||||
}
|
||||
|
||||
// Readdir will weave the two directories together and
|
||||
|
@ -275,7 +274,7 @@ func copyFile(base Fs, layer Fs, name string, bfh File) error {
|
|||
return err
|
||||
}
|
||||
if !exists {
|
||||
err = layer.MkdirAll(filepath.Dir(name), 0777) // FIXME?
|
||||
err = layer.MkdirAll(filepath.Dir(name), 0o777) // FIXME?
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
7
vendor/github.com/spf13/afero/util.go
generated
vendored
7
vendor/github.com/spf13/afero/util.go
generated
vendored
|
@ -43,7 +43,7 @@ func WriteReader(fs Fs, path string, r io.Reader) (err error) {
|
|||
ospath := filepath.FromSlash(dir)
|
||||
|
||||
if ospath != "" {
|
||||
err = fs.MkdirAll(ospath, 0777) // rwx, rw, r
|
||||
err = fs.MkdirAll(ospath, 0o777) // rwx, rw, r
|
||||
if err != nil {
|
||||
if err != os.ErrExist {
|
||||
return err
|
||||
|
@ -71,7 +71,7 @@ func SafeWriteReader(fs Fs, path string, r io.Reader) (err error) {
|
|||
ospath := filepath.FromSlash(dir)
|
||||
|
||||
if ospath != "" {
|
||||
err = fs.MkdirAll(ospath, 0777) // rwx, rw, r
|
||||
err = fs.MkdirAll(ospath, 0o777) // rwx, rw, r
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ func GetTempDir(fs Fs, subPath string) string {
|
|||
return addSlash(dir)
|
||||
}
|
||||
|
||||
err := fs.MkdirAll(dir, 0777)
|
||||
err := fs.MkdirAll(dir, 0o777)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -197,7 +197,6 @@ func FileContainsAnyBytes(fs Fs, filename string, subslices [][]byte) (bool, err
|
|||
|
||||
// readerContains reports whether any of the subslices is within r.
|
||||
func readerContainsAny(r io.Reader, subslices ...[]byte) bool {
|
||||
|
||||
if r == nil || len(subslices) == 0 {
|
||||
return false
|
||||
}
|
||||
|
|
12
vendor/github.com/spf13/cast/README.md
generated
vendored
12
vendor/github.com/spf13/cast/README.md
generated
vendored
|
@ -1,7 +1,8 @@
|
|||
cast
|
||||
====
|
||||
[![GoDoc](https://godoc.org/github.com/spf13/cast?status.svg)](https://godoc.org/github.com/spf13/cast)
|
||||
[![Build Status](https://github.com/spf13/cast/actions/workflows/go.yml/badge.svg)](https://github.com/spf13/cast/actions/workflows/go.yml)
|
||||
# cast
|
||||
|
||||
[![Build Status](https://github.com/spf13/cast/actions/workflows/ci.yml/badge.svg)](https://github.com/spf13/cast/actions/workflows/ci.yml)
|
||||
[![PkgGoDev](https://pkg.go.dev/badge/mod/github.com/spf13/cast)](https://pkg.go.dev/mod/github.com/spf13/cast)
|
||||
![Go Version](https://img.shields.io/badge/go%20version-%3E=1.16-61CFDD.svg?style=flat-square)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cast)](https://goreportcard.com/report/github.com/spf13/cast)
|
||||
|
||||
Easy and safe casting from one type to another in Go
|
||||
|
@ -17,7 +18,7 @@ interface into a bool, etc. Cast does this intelligently when an obvious
|
|||
conversion is possible. It doesn’t make any attempts to guess what you meant,
|
||||
for example you can only convert a string to an int when it is a string
|
||||
representation of an int such as “8”. Cast was developed for use in
|
||||
[Hugo](http://hugo.spf13.com), a website engine which uses YAML, TOML or JSON
|
||||
[Hugo](https://gohugo.io), a website engine which uses YAML, TOML or JSON
|
||||
for meta data.
|
||||
|
||||
## Why use Cast?
|
||||
|
@ -72,4 +73,3 @@ the code for a complete set.
|
|||
var eight interface{} = 8
|
||||
cast.ToInt(eight) // 8
|
||||
cast.ToInt(nil) // 0
|
||||
|
||||
|
|
32
vendor/github.com/spf13/cast/caste.go
generated
vendored
32
vendor/github.com/spf13/cast/caste.go
generated
vendored
|
@ -98,10 +98,31 @@ func ToBoolE(i interface{}) (bool, error) {
|
|||
case nil:
|
||||
return false, nil
|
||||
case int:
|
||||
if i.(int) != 0 {
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
return b != 0, nil
|
||||
case int64:
|
||||
return b != 0, nil
|
||||
case int32:
|
||||
return b != 0, nil
|
||||
case int16:
|
||||
return b != 0, nil
|
||||
case int8:
|
||||
return b != 0, nil
|
||||
case uint:
|
||||
return b != 0, nil
|
||||
case uint64:
|
||||
return b != 0, nil
|
||||
case uint32:
|
||||
return b != 0, nil
|
||||
case uint16:
|
||||
return b != 0, nil
|
||||
case uint8:
|
||||
return b != 0, nil
|
||||
case float64:
|
||||
return b != 0, nil
|
||||
case float32:
|
||||
return b != 0, nil
|
||||
case time.Duration:
|
||||
return b != 0, nil
|
||||
case string:
|
||||
return strconv.ParseBool(i.(string))
|
||||
case json.Number:
|
||||
|
@ -1385,6 +1406,8 @@ func (f timeFormat) hasTimezone() bool {
|
|||
|
||||
var (
|
||||
timeFormats = []timeFormat{
|
||||
// Keep common formats at the top.
|
||||
{"2006-01-02", timeFormatNoTimezone},
|
||||
{time.RFC3339, timeFormatNumericTimezone},
|
||||
{"2006-01-02T15:04:05", timeFormatNoTimezone}, // iso8601 without timezone
|
||||
{time.RFC1123Z, timeFormatNumericTimezone},
|
||||
|
@ -1400,7 +1423,6 @@ var (
|
|||
{time.UnixDate, timeFormatNamedTimezone},
|
||||
{time.RubyDate, timeFormatNumericTimezone},
|
||||
{"2006-01-02 15:04:05Z07:00", timeFormatNumericTimezone},
|
||||
{"2006-01-02", timeFormatNoTimezone},
|
||||
{"02 Jan 2006", timeFormatNoTimezone},
|
||||
{"2006-01-02 15:04:05 -07:00", timeFormatNumericTimezone},
|
||||
{"2006-01-02 15:04:05 -0700", timeFormatNumericTimezone},
|
||||
|
|
8
vendor/github.com/spf13/viper/.golangci.yaml
generated
vendored
8
vendor/github.com/spf13/viper/.golangci.yaml
generated
vendored
|
@ -16,7 +16,6 @@ linters:
|
|||
disable-all: true
|
||||
enable:
|
||||
- bodyclose
|
||||
- deadcode
|
||||
- dogsled
|
||||
- dupl
|
||||
- durationcheck
|
||||
|
@ -43,14 +42,12 @@ linters:
|
|||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- tparallel
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- varcheck
|
||||
- wastedassign
|
||||
- whitespace
|
||||
|
||||
|
@ -83,6 +80,11 @@ linters:
|
|||
# - goheader
|
||||
# - gomodguard
|
||||
|
||||
# deprecated
|
||||
# - deadcode
|
||||
# - structcheck
|
||||
# - varcheck
|
||||
|
||||
# don't enable:
|
||||
# - asciicheck
|
||||
# - funlen
|
||||
|
|
4
vendor/github.com/spf13/viper/Makefile
generated
vendored
4
vendor/github.com/spf13/viper/Makefile
generated
vendored
|
@ -15,8 +15,8 @@ TEST_FORMAT = short-verbose
|
|||
endif
|
||||
|
||||
# Dependency versions
|
||||
GOTESTSUM_VERSION = 1.8.0
|
||||
GOLANGCI_VERSION = 1.50.1
|
||||
GOTESTSUM_VERSION = 1.9.0
|
||||
GOLANGCI_VERSION = 1.52.2
|
||||
|
||||
# Add the ability to override some variables
|
||||
# Use with care
|
||||
|
|
3
vendor/github.com/spf13/viper/README.md
generated
vendored
3
vendor/github.com/spf13/viper/README.md
generated
vendored
|
@ -27,6 +27,9 @@ Many Go projects are built using Viper including:
|
|||
* [doctl](https://github.com/digitalocean/doctl)
|
||||
* [Clairctl](https://github.com/jgsqware/clairctl)
|
||||
* [Mercure](https://mercure.rocks)
|
||||
* [Meshery](https://github.com/meshery/meshery)
|
||||
* [Bearer](https://github.com/bearer/bearer)
|
||||
* [Coder](https://github.com/coder/coder)
|
||||
|
||||
|
||||
## Install
|
||||
|
|
5
vendor/github.com/spf13/viper/util.go
generated
vendored
5
vendor/github.com/spf13/viper/util.go
generated
vendored
|
@ -31,6 +31,11 @@ func (pe ConfigParseError) Error() string {
|
|||
return fmt.Sprintf("While parsing config: %s", pe.err.Error())
|
||||
}
|
||||
|
||||
// Unwrap returns the wrapped error.
|
||||
func (pe ConfigParseError) Unwrap() error {
|
||||
return pe.err
|
||||
}
|
||||
|
||||
// toCaseInsensitiveValue checks if the value is a map;
|
||||
// if so, create a copy and lower-case the keys recursively.
|
||||
func toCaseInsensitiveValue(value interface{}) interface{} {
|
||||
|
|
61
vendor/github.com/spf13/viper/viper.go
generated
vendored
61
vendor/github.com/spf13/viper/viper.go
generated
vendored
|
@ -25,7 +25,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
|
@ -206,6 +205,7 @@ type Viper struct {
|
|||
envKeyReplacer StringReplacer
|
||||
allowEmptyEnv bool
|
||||
|
||||
parents []string
|
||||
config map[string]interface{}
|
||||
override map[string]interface{}
|
||||
defaults map[string]interface{}
|
||||
|
@ -232,6 +232,7 @@ func New() *Viper {
|
|||
v.configPermissions = os.FileMode(0o644)
|
||||
v.fs = afero.NewOsFs()
|
||||
v.config = make(map[string]interface{})
|
||||
v.parents = []string{}
|
||||
v.override = make(map[string]interface{})
|
||||
v.defaults = make(map[string]interface{})
|
||||
v.kvstore = make(map[string]interface{})
|
||||
|
@ -439,13 +440,14 @@ func (v *Viper) WatchConfig() {
|
|||
go func() {
|
||||
watcher, err := newWatcher()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
v.logger.Error(fmt.Sprintf("failed to create watcher: %s", err))
|
||||
os.Exit(1)
|
||||
}
|
||||
defer watcher.Close()
|
||||
// we have to watch the entire directory to pick up renames/atomic saves in a cross-platform way
|
||||
filename, err := v.getConfigFile()
|
||||
if err != nil {
|
||||
log.Printf("error: %v\n", err)
|
||||
v.logger.Error(fmt.Sprintf("get config file: %s", err))
|
||||
initWG.Done()
|
||||
return
|
||||
}
|
||||
|
@ -474,7 +476,7 @@ func (v *Viper) WatchConfig() {
|
|||
realConfigFile = currentConfigFile
|
||||
err := v.ReadInConfig()
|
||||
if err != nil {
|
||||
log.Printf("error reading config file: %v\n", err)
|
||||
v.logger.Error(fmt.Sprintf("read config file: %s", err))
|
||||
}
|
||||
if v.onConfigChange != nil {
|
||||
v.onConfigChange(event)
|
||||
|
@ -486,7 +488,7 @@ func (v *Viper) WatchConfig() {
|
|||
|
||||
case err, ok := <-watcher.Errors:
|
||||
if ok { // 'Errors' channel is not closed
|
||||
log.Printf("watcher error: %v\n", err)
|
||||
v.logger.Error(fmt.Sprintf("watcher error: %s", err))
|
||||
}
|
||||
eventsWG.Done()
|
||||
return
|
||||
|
@ -928,6 +930,8 @@ func (v *Viper) Get(key string) interface{} {
|
|||
return cast.ToStringSlice(val)
|
||||
case []int:
|
||||
return cast.ToIntSlice(val)
|
||||
case []time.Duration:
|
||||
return cast.ToDurationSlice(val)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -946,6 +950,10 @@ func (v *Viper) Sub(key string) *Viper {
|
|||
}
|
||||
|
||||
if reflect.TypeOf(data).Kind() == reflect.Map {
|
||||
subv.parents = append(v.parents, strings.ToLower(key))
|
||||
subv.automaticEnvApplied = v.automaticEnvApplied
|
||||
subv.envPrefix = v.envPrefix
|
||||
subv.envKeyReplacer = v.envKeyReplacer
|
||||
subv.config = cast.ToStringMap(data)
|
||||
return subv
|
||||
}
|
||||
|
@ -1099,7 +1107,7 @@ func (v *Viper) Unmarshal(rawVal interface{}, opts ...DecoderConfigOption) error
|
|||
return decode(v.AllSettings(), defaultDecoderConfig(rawVal, opts...))
|
||||
}
|
||||
|
||||
// defaultDecoderConfig returns default mapsstructure.DecoderConfig with suppot
|
||||
// defaultDecoderConfig returns default mapstructure.DecoderConfig with support
|
||||
// of time.Duration values & string slices
|
||||
func defaultDecoderConfig(output interface{}, opts ...DecoderConfigOption) *mapstructure.DecoderConfig {
|
||||
c := &mapstructure.DecoderConfig{
|
||||
|
@ -1274,8 +1282,15 @@ func (v *Viper) find(lcaseKey string, flagDefault bool) interface{} {
|
|||
s = strings.TrimSuffix(s, "]")
|
||||
res, _ := readAsCSV(s)
|
||||
return cast.ToIntSlice(res)
|
||||
case "durationSlice":
|
||||
s := strings.TrimPrefix(flag.ValueString(), "[")
|
||||
s = strings.TrimSuffix(s, "]")
|
||||
slice := strings.Split(s, ",")
|
||||
return cast.ToDurationSlice(slice)
|
||||
case "stringToString":
|
||||
return stringToStringConv(flag.ValueString())
|
||||
case "stringToInt":
|
||||
return stringToIntConv(flag.ValueString())
|
||||
default:
|
||||
return flag.ValueString()
|
||||
}
|
||||
|
@ -1286,9 +1301,10 @@ func (v *Viper) find(lcaseKey string, flagDefault bool) interface{} {
|
|||
|
||||
// Env override next
|
||||
if v.automaticEnvApplied {
|
||||
envKey := strings.Join(append(v.parents, lcaseKey), ".")
|
||||
// even if it hasn't been registered, if automaticEnv is used,
|
||||
// check any Get request
|
||||
if val, ok := v.getEnv(v.mergeWithEnvPrefix(lcaseKey)); ok {
|
||||
if val, ok := v.getEnv(v.mergeWithEnvPrefix(envKey)); ok {
|
||||
return val
|
||||
}
|
||||
if nested && v.isPathShadowedInAutoEnv(path) != "" {
|
||||
|
@ -1355,6 +1371,13 @@ func (v *Viper) find(lcaseKey string, flagDefault bool) interface{} {
|
|||
return cast.ToIntSlice(res)
|
||||
case "stringToString":
|
||||
return stringToStringConv(flag.ValueString())
|
||||
case "stringToInt":
|
||||
return stringToIntConv(flag.ValueString())
|
||||
case "durationSlice":
|
||||
s := strings.TrimPrefix(flag.ValueString(), "[")
|
||||
s = strings.TrimSuffix(s, "]")
|
||||
slice := strings.Split(s, ",")
|
||||
return cast.ToDurationSlice(slice)
|
||||
default:
|
||||
return flag.ValueString()
|
||||
}
|
||||
|
@ -1398,6 +1421,30 @@ func stringToStringConv(val string) interface{} {
|
|||
return out
|
||||
}
|
||||
|
||||
// mostly copied from pflag's implementation of this operation here https://github.com/spf13/pflag/blob/d5e0c0615acee7028e1e2740a11102313be88de1/string_to_int.go#L68
|
||||
// alterations are: errors are swallowed, map[string]interface{} is returned in order to enable cast.ToStringMap
|
||||
func stringToIntConv(val string) interface{} {
|
||||
val = strings.Trim(val, "[]")
|
||||
// An empty string would cause an empty map
|
||||
if len(val) == 0 {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
ss := strings.Split(val, ",")
|
||||
out := make(map[string]interface{}, len(ss))
|
||||
for _, pair := range ss {
|
||||
kv := strings.SplitN(pair, "=", 2)
|
||||
if len(kv) != 2 {
|
||||
return nil
|
||||
}
|
||||
var err error
|
||||
out[kv[0]], err = strconv.Atoi(kv[1])
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// IsSet checks to see if the key has been set in any of the data locations.
|
||||
// IsSet is case-insensitive for a key.
|
||||
func IsSet(key string) bool { return v.IsSet(key) }
|
||||
|
|
1
vendor/github.com/tdewolff/minify/v2/README.md
generated
vendored
1
vendor/github.com/tdewolff/minify/v2/README.md
generated
vendored
|
@ -280,6 +280,7 @@ Options:
|
|||
|
||||
- `KeepVarNames` keeps variable names as they are and omits shortening variable names
|
||||
- `Precision` number of significant digits to preserve for numbers, `0` means no trimming
|
||||
- `Version` ECMAScript version to use for output, `0` is the latest
|
||||
|
||||
### Comparison with other tools
|
||||
|
||||
|
|
1530
vendor/github.com/tdewolff/minify/v2/html/table.go
generated
vendored
1530
vendor/github.com/tdewolff/minify/v2/html/table.go
generated
vendored
File diff suppressed because it is too large
Load diff
9
vendor/github.com/uptrace/bun/CHANGELOG.md
generated
vendored
9
vendor/github.com/uptrace/bun/CHANGELOG.md
generated
vendored
|
@ -1,3 +1,12 @@
|
|||
## [1.1.14](https://github.com/uptrace/bun/compare/v1.1.13...v1.1.14) (2023-05-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* enable CompositeIn for MySQL ([9f377b5](https://github.com/uptrace/bun/commit/9f377b5e744cb38ef4aadd61213855c009e47354))
|
||||
|
||||
|
||||
|
||||
## [1.1.13](https://github.com/uptrace/bun/compare/v1.1.12...v1.1.13) (2023-05-06)
|
||||
|
||||
|
||||
|
|
3
vendor/github.com/uptrace/bun/Makefile
generated
vendored
3
vendor/github.com/uptrace/bun/Makefile
generated
vendored
|
@ -11,12 +11,11 @@ test:
|
|||
done
|
||||
|
||||
go_mod_tidy:
|
||||
go get -u && go mod tidy -go=1.18
|
||||
set -e; for dir in $(ALL_GO_MOD_DIRS); do \
|
||||
echo "go mod tidy in $${dir}"; \
|
||||
(cd "$${dir}" && \
|
||||
go get -u ./... && \
|
||||
go mod tidy -go=1.18); \
|
||||
go mod tidy -go=1.19); \
|
||||
done
|
||||
|
||||
fmt:
|
||||
|
|
2
vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
generated
vendored
2
vendor/github.com/uptrace/bun/dialect/pgdialect/version.go
generated
vendored
|
@ -2,5 +2,5 @@ package pgdialect
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "1.1.13"
|
||||
return "1.1.14"
|
||||
}
|
||||
|
|
2
vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
generated
vendored
2
vendor/github.com/uptrace/bun/dialect/sqlitedialect/version.go
generated
vendored
|
@ -2,5 +2,5 @@ package sqlitedialect
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "1.1.13"
|
||||
return "1.1.14"
|
||||
}
|
||||
|
|
14
vendor/github.com/uptrace/bun/extra/bunotel/otel.go
generated
vendored
14
vendor/github.com/uptrace/bun/extra/bunotel/otel.go
generated
vendored
|
@ -10,9 +10,8 @@ import (
|
|||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/metric/global"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.12.0"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.20.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"github.com/uptrace/bun"
|
||||
|
@ -23,12 +22,12 @@ import (
|
|||
|
||||
var (
|
||||
tracer = otel.Tracer("github.com/uptrace/bun")
|
||||
meter = global.Meter("github.com/uptrace/bun")
|
||||
meter = otel.Meter("github.com/uptrace/bun")
|
||||
|
||||
queryHistogram, _ = meter.Int64Histogram(
|
||||
"go.sql.query_timing",
|
||||
instrument.WithDescription("Timing of processed queries"),
|
||||
instrument.WithUnit("milliseconds"),
|
||||
metric.WithDescription("Timing of processed queries"),
|
||||
metric.WithUnit("milliseconds"),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -75,7 +74,8 @@ func (h *QueryHook) AfterQuery(ctx context.Context, event *bun.QueryEvent) {
|
|||
}
|
||||
}
|
||||
|
||||
queryHistogram.Record(ctx, time.Since(event.StartTime).Milliseconds(), labels...)
|
||||
dur := time.Since(event.StartTime)
|
||||
queryHistogram.Record(ctx, dur.Milliseconds(), metric.WithAttributes(labels...))
|
||||
|
||||
span := trace.SpanFromContext(ctx)
|
||||
if !span.IsRecording() {
|
||||
|
|
6
vendor/github.com/uptrace/bun/migrate/migrator.go
generated
vendored
6
vendor/github.com/uptrace/bun/migrate/migrator.go
generated
vendored
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"time"
|
||||
|
@ -255,7 +255,7 @@ func (m *Migrator) CreateGoMigration(
|
|||
fpath := filepath.Join(m.migrations.getDirectory(), fname)
|
||||
content := fmt.Sprintf(cfg.goTemplate, cfg.packageName)
|
||||
|
||||
if err := ioutil.WriteFile(fpath, []byte(content), 0o644); err != nil {
|
||||
if err := os.WriteFile(fpath, []byte(content), 0o644); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ func (m *Migrator) CreateSQLMigrations(ctx context.Context, name string) ([]*Mig
|
|||
func (m *Migrator) createSQL(ctx context.Context, fname string) (*MigrationFile, error) {
|
||||
fpath := filepath.Join(m.migrations.getDirectory(), fname)
|
||||
|
||||
if err := ioutil.WriteFile(fpath, []byte(sqlTemplate), 0o644); err != nil {
|
||||
if err := os.WriteFile(fpath, []byte(sqlTemplate), 0o644); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
2
vendor/github.com/uptrace/bun/package.json
generated
vendored
2
vendor/github.com/uptrace/bun/package.json
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gobun",
|
||||
"version": "1.1.13",
|
||||
"version": "1.1.14",
|
||||
"main": "index.js",
|
||||
"repository": "git@github.com:uptrace/bun.git",
|
||||
"author": "Vladimir Mihailenco <vladimir.webdev@gmail.com>",
|
||||
|
|
2
vendor/github.com/uptrace/bun/version.go
generated
vendored
2
vendor/github.com/uptrace/bun/version.go
generated
vendored
|
@ -2,5 +2,5 @@ package bun
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "1.1.13"
|
||||
return "1.1.14"
|
||||
}
|
||||
|
|
50
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/otel.go
generated
vendored
50
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/otel.go
generated
vendored
|
@ -11,8 +11,6 @@ import (
|
|||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/global"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.10.0"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
@ -36,7 +34,7 @@ type config struct {
|
|||
func newConfig(opts []Option) *config {
|
||||
c := &config{
|
||||
tracerProvider: otel.GetTracerProvider(),
|
||||
meterProvider: global.MeterProvider(),
|
||||
meterProvider: otel.GetMeterProvider(),
|
||||
}
|
||||
for _, opt := range opts {
|
||||
opt(c)
|
||||
|
@ -54,7 +52,7 @@ func (c *config) formatQuery(query string) string {
|
|||
type dbInstrum struct {
|
||||
*config
|
||||
|
||||
queryHistogram instrument.Int64Histogram
|
||||
queryHistogram metric.Int64Histogram
|
||||
}
|
||||
|
||||
func newDBInstrum(opts []Option) *dbInstrum {
|
||||
|
@ -72,8 +70,8 @@ func newDBInstrum(opts []Option) *dbInstrum {
|
|||
var err error
|
||||
t.queryHistogram, err = t.meter.Int64Histogram(
|
||||
"go.sql.query_timing",
|
||||
instrument.WithDescription("Timing of processed queries"),
|
||||
instrument.WithUnit("milliseconds"),
|
||||
metric.WithDescription("Timing of processed queries"),
|
||||
metric.WithUnit("milliseconds"),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -106,7 +104,7 @@ func (t *dbInstrum) withSpan(
|
|||
span.End()
|
||||
|
||||
if query != "" {
|
||||
t.queryHistogram.Record(ctx, time.Since(startTime).Milliseconds(), t.attrs...)
|
||||
t.queryHistogram.Record(ctx, time.Since(startTime).Milliseconds(), metric.WithAttributes(t.attrs...))
|
||||
}
|
||||
|
||||
if !span.IsRecording() {
|
||||
|
@ -185,57 +183,57 @@ func ReportDBStatsMetrics(db *sql.DB, opts ...Option) {
|
|||
|
||||
maxOpenConns, _ := meter.Int64ObservableGauge(
|
||||
"go.sql.connections_max_open",
|
||||
instrument.WithDescription("Maximum number of open connections to the database"),
|
||||
metric.WithDescription("Maximum number of open connections to the database"),
|
||||
)
|
||||
openConns, _ := meter.Int64ObservableGauge(
|
||||
"go.sql.connections_open",
|
||||
instrument.WithDescription("The number of established connections both in use and idle"),
|
||||
metric.WithDescription("The number of established connections both in use and idle"),
|
||||
)
|
||||
inUseConns, _ := meter.Int64ObservableGauge(
|
||||
"go.sql.connections_in_use",
|
||||
instrument.WithDescription("The number of connections currently in use"),
|
||||
metric.WithDescription("The number of connections currently in use"),
|
||||
)
|
||||
idleConns, _ := meter.Int64ObservableGauge(
|
||||
"go.sql.connections_idle",
|
||||
instrument.WithDescription("The number of idle connections"),
|
||||
metric.WithDescription("The number of idle connections"),
|
||||
)
|
||||
connsWaitCount, _ := meter.Int64ObservableCounter(
|
||||
"go.sql.connections_wait_count",
|
||||
instrument.WithDescription("The total number of connections waited for"),
|
||||
metric.WithDescription("The total number of connections waited for"),
|
||||
)
|
||||
connsWaitDuration, _ := meter.Int64ObservableCounter(
|
||||
"go.sql.connections_wait_duration",
|
||||
instrument.WithDescription("The total time blocked waiting for a new connection"),
|
||||
instrument.WithUnit("nanoseconds"),
|
||||
metric.WithDescription("The total time blocked waiting for a new connection"),
|
||||
metric.WithUnit("nanoseconds"),
|
||||
)
|
||||
connsClosedMaxIdle, _ := meter.Int64ObservableCounter(
|
||||
"go.sql.connections_closed_max_idle",
|
||||
instrument.WithDescription("The total number of connections closed due to SetMaxIdleConns"),
|
||||
metric.WithDescription("The total number of connections closed due to SetMaxIdleConns"),
|
||||
)
|
||||
connsClosedMaxIdleTime, _ := meter.Int64ObservableCounter(
|
||||
"go.sql.connections_closed_max_idle_time",
|
||||
instrument.WithDescription("The total number of connections closed due to SetConnMaxIdleTime"),
|
||||
metric.WithDescription("The total number of connections closed due to SetConnMaxIdleTime"),
|
||||
)
|
||||
connsClosedMaxLifetime, _ := meter.Int64ObservableCounter(
|
||||
"go.sql.connections_closed_max_lifetime",
|
||||
instrument.WithDescription("The total number of connections closed due to SetConnMaxLifetime"),
|
||||
metric.WithDescription("The total number of connections closed due to SetConnMaxLifetime"),
|
||||
)
|
||||
|
||||
if _, err := meter.RegisterCallback(
|
||||
func(ctx context.Context, o metric.Observer) error {
|
||||
stats := db.Stats()
|
||||
|
||||
o.ObserveInt64(maxOpenConns, int64(stats.MaxOpenConnections), labels...)
|
||||
o.ObserveInt64(maxOpenConns, int64(stats.MaxOpenConnections), metric.WithAttributes(labels...))
|
||||
|
||||
o.ObserveInt64(openConns, int64(stats.OpenConnections), labels...)
|
||||
o.ObserveInt64(inUseConns, int64(stats.InUse), labels...)
|
||||
o.ObserveInt64(idleConns, int64(stats.Idle), labels...)
|
||||
o.ObserveInt64(openConns, int64(stats.OpenConnections), metric.WithAttributes(labels...))
|
||||
o.ObserveInt64(inUseConns, int64(stats.InUse), metric.WithAttributes(labels...))
|
||||
o.ObserveInt64(idleConns, int64(stats.Idle), metric.WithAttributes(labels...))
|
||||
|
||||
o.ObserveInt64(connsWaitCount, stats.WaitCount, labels...)
|
||||
o.ObserveInt64(connsWaitDuration, int64(stats.WaitDuration), labels...)
|
||||
o.ObserveInt64(connsClosedMaxIdle, stats.MaxIdleClosed, labels...)
|
||||
o.ObserveInt64(connsClosedMaxIdleTime, stats.MaxIdleTimeClosed, labels...)
|
||||
o.ObserveInt64(connsClosedMaxLifetime, stats.MaxLifetimeClosed, labels...)
|
||||
o.ObserveInt64(connsWaitCount, stats.WaitCount, metric.WithAttributes(labels...))
|
||||
o.ObserveInt64(connsWaitDuration, int64(stats.WaitDuration), metric.WithAttributes(labels...))
|
||||
o.ObserveInt64(connsClosedMaxIdle, stats.MaxIdleClosed, metric.WithAttributes(labels...))
|
||||
o.ObserveInt64(connsClosedMaxIdleTime, stats.MaxIdleTimeClosed, metric.WithAttributes(labels...))
|
||||
o.ObserveInt64(connsClosedMaxLifetime, stats.MaxLifetimeClosed, metric.WithAttributes(labels...))
|
||||
|
||||
return nil
|
||||
},
|
||||
|
|
2
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/version.go
generated
vendored
2
vendor/github.com/uptrace/opentelemetry-go-extra/otelsql/version.go
generated
vendored
|
@ -2,5 +2,5 @@ package otelsql
|
|||
|
||||
// Version is the current release version.
|
||||
func Version() string {
|
||||
return "0.1.21"
|
||||
return "0.2.1"
|
||||
}
|
||||
|
|
5
vendor/go.opentelemetry.io/otel/.codespellignore
generated
vendored
Normal file
5
vendor/go.opentelemetry.io/otel/.codespellignore
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
ot
|
||||
fo
|
||||
te
|
||||
collison
|
||||
consequentially
|
10
vendor/go.opentelemetry.io/otel/.codespellrc
generated
vendored
Normal file
10
vendor/go.opentelemetry.io/otel/.codespellrc
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
# https://github.com/codespell-project/codespell
|
||||
[codespell]
|
||||
builtin = clear,rare,informal
|
||||
check-filenames =
|
||||
check-hidden =
|
||||
ignore-words = .codespellignore
|
||||
interactive = 1
|
||||
skip = .git,go.mod,go.sum,semconv,venv,.tools
|
||||
uri-ignore-words-list = *
|
||||
write =
|
3
vendor/go.opentelemetry.io/otel/.gitignore
generated
vendored
3
vendor/go.opentelemetry.io/otel/.gitignore
generated
vendored
|
@ -2,11 +2,14 @@
|
|||
Thumbs.db
|
||||
|
||||
.tools/
|
||||
venv/
|
||||
.idea/
|
||||
.vscode/
|
||||
*.iml
|
||||
*.so
|
||||
coverage.*
|
||||
go.work
|
||||
go.work.sum
|
||||
|
||||
gen/
|
||||
|
||||
|
|
4
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
4
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
|
@ -85,6 +85,8 @@ linters-settings:
|
|||
- "**/internal/matchers/*.go"
|
||||
godot:
|
||||
exclude:
|
||||
# Exclude links.
|
||||
- '^ *\[[^]]+\]:'
|
||||
# Exclude sentence fragments for lists.
|
||||
- '^[ ]*[-•]'
|
||||
# Exclude sentences prefixing a list.
|
||||
|
@ -111,7 +113,7 @@ linters-settings:
|
|||
- name: constant-logical-expr
|
||||
disabled: false
|
||||
# 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
|
||||
# TODO (#3372) re-enable linter when it is compatible. https://github.com/golangci/golangci-lint/issues/3280
|
||||
- name: context-as-argument
|
||||
disabled: true
|
||||
arguments:
|
||||
|
|
214
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
214
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
|
@ -8,6 +8,196 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.16.0/0.39.0] 2023-05-18
|
||||
|
||||
This release contains the first stable release of the OpenTelemetry Go [metric API].
|
||||
Our project stability guarantees now apply to the `go.opentelemetry.io/otel/metric` package.
|
||||
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
|
||||
|
||||
### Added
|
||||
|
||||
- The `go.opentelemetry.io/otel/semconv/v1.19.0` package.
|
||||
The package contains semantic conventions from the `v1.19.0` version of the OpenTelemetry specification. (#3848)
|
||||
- The `go.opentelemetry.io/otel/semconv/v1.20.0` package.
|
||||
The package contains semantic conventions from the `v1.20.0` version of the OpenTelemetry specification. (#4078)
|
||||
|
||||
### Changed
|
||||
|
||||
- Use `strings.Cut()` instead of `string.SplitN()` for better readability and memory use. (#4049)
|
||||
|
||||
### Removed
|
||||
|
||||
- The deprecated `go.opentelemetry.io/otel/metric/instrument` package is removed.
|
||||
Use `go.opentelemetry.io/otel/metric` instead. (#4055)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix build for BSD based systems in `go.opentelemetry.io/otel/sdk/resource`. (#4077)
|
||||
|
||||
## [1.16.0-rc.1/0.39.0-rc.1] 2023-05-03
|
||||
|
||||
This is a release candidate for the v1.16.0/v0.39.0 release.
|
||||
That release is expected to include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API.
|
||||
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
|
||||
|
||||
### Added
|
||||
|
||||
- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#4039)
|
||||
- Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`.
|
||||
- Use `GetMeterProivder` for a global `metric.MeterProvider`.
|
||||
- Use `SetMeterProivder` to set the global `metric.MeterProvider`.
|
||||
|
||||
### Changed
|
||||
|
||||
- Move the `go.opentelemetry.io/otel/metric` module to the `stable-v1` module set.
|
||||
This stages the metric API to be released as a stable module. (#4038)
|
||||
|
||||
### Removed
|
||||
|
||||
- The `go.opentelemetry.io/otel/metric/global` package is removed.
|
||||
Use `go.opentelemetry.io/otel` instead. (#4039)
|
||||
|
||||
## [1.15.1/0.38.1] 2023-05-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- Remove unused imports from `sdk/resource/host_id_bsd.go` which caused build failures. (#4040, #4041)
|
||||
|
||||
## [1.15.0/0.38.0] 2023-04-27
|
||||
|
||||
### Added
|
||||
|
||||
- The `go.opentelemetry.io/otel/metric/embedded` package. (#3916)
|
||||
- The `Version` function to `go.opentelemetry.io/otel/sdk` to return the SDK version. (#3949)
|
||||
- Add a `WithNamespace` option to `go.opentelemetry.io/otel/exporters/prometheus` to allow users to prefix metrics with a namespace. (#3970)
|
||||
- The following configuration types were added to `go.opentelemetry.io/otel/metric/instrument` to be used in the configuration of measurement methods. (#3971)
|
||||
- The `AddConfig` used to hold configuration for addition measurements
|
||||
- `NewAddConfig` used to create a new `AddConfig`
|
||||
- `AddOption` used to configure an `AddConfig`
|
||||
- The `RecordConfig` used to hold configuration for recorded measurements
|
||||
- `NewRecordConfig` used to create a new `RecordConfig`
|
||||
- `RecordOption` used to configure a `RecordConfig`
|
||||
- The `ObserveConfig` used to hold configuration for observed measurements
|
||||
- `NewObserveConfig` used to create a new `ObserveConfig`
|
||||
- `ObserveOption` used to configure an `ObserveConfig`
|
||||
- `WithAttributeSet` and `WithAttributes` are added to `go.opentelemetry.io/otel/metric/instrument`.
|
||||
They return an option used during a measurement that defines the attribute Set associated with the measurement. (#3971)
|
||||
- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlpmetric` to return the OTLP metrics client version. (#3956)
|
||||
- The `Version` function to `go.opentelemetry.io/otel/exporters/otlp/otlptrace` to return the OTLP trace client version. (#3956)
|
||||
|
||||
### Changed
|
||||
|
||||
- The `Extrema` in `go.opentelemetry.io/otel/sdk/metric/metricdata` is redefined with a generic argument of `[N int64 | float64]`. (#3870)
|
||||
- Update all exported interfaces from `go.opentelemetry.io/otel/metric` to embed their corresponding interface from `go.opentelemetry.io/otel/metric/embedded`.
|
||||
This adds an implementation requirement to set the interface default behavior for unimplemented methods. (#3916)
|
||||
- Move No-Op implementation from `go.opentelemetry.io/otel/metric` into its own package `go.opentelemetry.io/otel/metric/noop`. (#3941)
|
||||
- `metric.NewNoopMeterProvider` is replaced with `noop.NewMeterProvider`
|
||||
- Add all the methods from `"go.opentelemetry.io/otel/trace".SpanContext` to `bridgeSpanContext` by embedding `otel.SpanContext` in `bridgeSpanContext`. (#3966)
|
||||
- Wrap `UploadMetrics` error in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/` to improve error message when encountering generic grpc errors. (#3974)
|
||||
- The measurement methods for all instruments in `go.opentelemetry.io/otel/metric/instrument` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971)
|
||||
- The `Int64Counter.Add` method now accepts `...AddOption`
|
||||
- The `Float64Counter.Add` method now accepts `...AddOption`
|
||||
- The `Int64UpDownCounter.Add` method now accepts `...AddOption`
|
||||
- The `Float64UpDownCounter.Add` method now accepts `...AddOption`
|
||||
- The `Int64Histogram.Record` method now accepts `...RecordOption`
|
||||
- The `Float64Histogram.Record` method now accepts `...RecordOption`
|
||||
- The `Int64Observer.Observe` method now accepts `...ObserveOption`
|
||||
- The `Float64Observer.Observe` method now accepts `...ObserveOption`
|
||||
- The `Observer` methods in `go.opentelemetry.io/otel/metric` accept an option instead of the variadic `"go.opentelemetry.io/otel/attribute".KeyValue`. (#3971)
|
||||
- The `Observer.ObserveInt64` method now accepts `...ObserveOption`
|
||||
- The `Observer.ObserveFloat64` method now accepts `...ObserveOption`
|
||||
- Move global metric back to `go.opentelemetry.io/otel/metric/global` from `go.opentelemetry.io/otel`. (#3986)
|
||||
|
||||
### Fixed
|
||||
|
||||
- `TracerProvider` allows calling `Tracer()` while it's shutting down.
|
||||
It used to deadlock. (#3924)
|
||||
- Use the SDK version for the Telemetry SDK resource detector in `go.opentelemetry.io/otel/sdk/resource`. (#3949)
|
||||
- Fix a data race in `SpanProcessor` returned by `NewSimpleSpanProcessor` in `go.opentelemetry.io/otel/sdk/trace`. (#3951)
|
||||
- Automatically figure out the default aggregation with `aggregation.Default`. (#3967)
|
||||
|
||||
### Deprecated
|
||||
|
||||
- The `go.opentelemetry.io/otel/metric/instrument` package is deprecated.
|
||||
Use the equivalent types added to `go.opentelemetry.io/otel/metric` instead. (#4018)
|
||||
|
||||
## [1.15.0-rc.2/0.38.0-rc.2] 2023-03-23
|
||||
|
||||
This is a release candidate for the v1.15.0/v0.38.0 release.
|
||||
That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API.
|
||||
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
|
||||
|
||||
### Added
|
||||
|
||||
- The `WithHostID` option to `go.opentelemetry.io/otel/sdk/resource`. (#3812)
|
||||
- The `WithoutTimestamps` option to `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric` to sets all timestamps to zero. (#3828)
|
||||
- The new `Exemplar` type is added to `go.opentelemetry.io/otel/sdk/metric/metricdata`.
|
||||
Both the `DataPoint` and `HistogramDataPoint` types from that package have a new field of `Exemplars` containing the sampled exemplars for their timeseries. (#3849)
|
||||
- Configuration for each metric instrument in `go.opentelemetry.io/otel/sdk/metric/instrument`. (#3895)
|
||||
- The internal logging introduces a warning level verbosity equal to `V(1)`. (#3900)
|
||||
- Added a log message warning about usage of `SimpleSpanProcessor` in production environments. (#3854)
|
||||
|
||||
### Changed
|
||||
|
||||
- Optimize memory allocation when creation a new `Set` using `NewSet` or `NewSetWithFiltered` in `go.opentelemetry.io/otel/attribute`. (#3832)
|
||||
- Optimize memory allocation when creation new metric instruments in `go.opentelemetry.io/otel/sdk/metric`. (#3832)
|
||||
- Avoid creating new objects on all calls to `WithDeferredSetup` and `SkipContextSetup` in OpenTracing bridge. (#3833)
|
||||
- The `New` and `Detect` functions from `go.opentelemetry.io/otel/sdk/resource` return errors that wrap underlying errors instead of just containing the underlying error strings. (#3844)
|
||||
- Both the `Histogram` and `HistogramDataPoint` are redefined with a generic argument of `[N int64 | float64]` in `go.opentelemetry.io/otel/sdk/metric/metricdata`. (#3849)
|
||||
- The metric `Export` interface from `go.opentelemetry.io/otel/sdk/metric` accepts a `*ResourceMetrics` instead of `ResourceMetrics`. (#3853)
|
||||
- Rename `Asynchronous` to `Observable` in `go.opentelemetry.io/otel/metric/instrument`. (#3892)
|
||||
- Rename `Int64ObserverOption` to `Int64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895)
|
||||
- Rename `Float64ObserverOption` to `Float64ObservableOption` in `go.opentelemetry.io/otel/metric/instrument`. (#3895)
|
||||
- The internal logging changes the verbosity level of info to `V(4)`, the verbosity level of debug to `V(8)`. (#3900)
|
||||
|
||||
### Fixed
|
||||
|
||||
- `TracerProvider` consistently doesn't allow to register a `SpanProcessor` after shutdown. (#3845)
|
||||
|
||||
### Removed
|
||||
|
||||
- The deprecated `go.opentelemetry.io/otel/metric/global` package is removed. (#3829)
|
||||
- The unneeded `Synchronous` interface in `go.opentelemetry.io/otel/metric/instrument` was removed. (#3892)
|
||||
- The `Float64ObserverConfig` and `NewFloat64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`.
|
||||
Use the added `float64` instrument configuration instead. (#3895)
|
||||
- The `Int64ObserverConfig` and `NewInt64ObserverConfig` in `go.opentelemetry.io/otel/sdk/metric/instrument`.
|
||||
Use the added `int64` instrument configuration instead. (#3895)
|
||||
- The `NewNoopMeter` function in `go.opentelemetry.io/otel/metric`, use `NewMeterProvider().Meter("")` instead. (#3893)
|
||||
|
||||
## [1.15.0-rc.1/0.38.0-rc.1] 2023-03-01
|
||||
|
||||
This is a release candidate for the v1.15.0/v0.38.0 release.
|
||||
That release will include the `v1` release of the OpenTelemetry Go metric API and will provide stability guarantees of that API.
|
||||
See our [versioning policy](VERSIONING.md) for more information about these stability guarantees.
|
||||
|
||||
This release drops the compatibility guarantee of [Go 1.18].
|
||||
|
||||
### Added
|
||||
|
||||
- Support global `MeterProvider` in `go.opentelemetry.io/otel`. (#3818)
|
||||
- Use `Meter` for a `metric.Meter` from the global `metric.MeterProvider`.
|
||||
- Use `GetMeterProivder` for a global `metric.MeterProvider`.
|
||||
- Use `SetMeterProivder` to set the global `metric.MeterProvider`.
|
||||
|
||||
### Changed
|
||||
|
||||
- Dropped compatibility testing for [Go 1.18].
|
||||
The project no longer guarantees support for this version of Go. (#3813)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Handle empty environment variable as it they were not set. (#3764)
|
||||
- Clarify the `httpconv` and `netconv` packages in `go.opentelemetry.io/otel/semconv/*` provide tracing semantic conventions. (#3823)
|
||||
|
||||
### Deprecated
|
||||
|
||||
- The `go.opentelemetry.io/otel/metric/global` package is deprecated.
|
||||
Use `go.opentelemetry.io/otel` instead. (#3818)
|
||||
|
||||
### Removed
|
||||
|
||||
- The deprecated `go.opentelemetry.io/otel/metric/unit` package is removed. (#3814)
|
||||
|
||||
## [1.14.0/0.37.0/0.0.4] 2023-02-27
|
||||
|
||||
This release is the last to support [Go 1.18].
|
||||
|
@ -121,7 +311,7 @@ The next release will require at least [Go 1.19].
|
|||
- 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)
|
||||
These instruments are use as replacements of the deprecated `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`
|
||||
|
@ -144,7 +334,7 @@ The next release will require at least [Go 1.19].
|
|||
### 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)
|
||||
- Instrument configuration in `go.opentelemetry.io/otel/metric/instrument` is split into specific options and configuration 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`.
|
||||
|
@ -157,7 +347,7 @@ The next release will require at least [Go 1.19].
|
|||
- 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.
|
||||
- Errors from `go.opentelemetry.io/otel/exporters/otlp/otlptrace` exporters are wrapped in errors 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)
|
||||
|
@ -266,7 +456,7 @@ The next release will require at least [Go 1.19].
|
|||
- 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)
|
||||
- Re-enabled Attribute Filters in the Metric SDK. (#3396)
|
||||
- Asynchronous callbacks are only called if they are registered with at least one instrument that does not use drop aggragation. (#3408)
|
||||
- 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)
|
||||
|
@ -847,7 +1037,7 @@ This release includes an API and SDK for the tracing signal that will comply wit
|
|||
- Setting the global `ErrorHandler` with `"go.opentelemetry.io/otel".SetErrorHandler` multiple times is now supported. (#2160, #2140)
|
||||
- The `"go.opentelemetry.io/otel/attribute".Any` function now supports `int32` values. (#2169)
|
||||
- Multiple calls to `"go.opentelemetry.io/otel/sdk/metric/controller/basic".WithResource()` are handled correctly, and when no resources are provided `"go.opentelemetry.io/otel/sdk/resource".Default()` is used. (#2120)
|
||||
- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly ommit timestamps. (#2195)
|
||||
- The `WithoutTimestamps` option for the `go.opentelemetry.io/otel/exporters/stdout/stdouttrace` exporter causes the exporter to correctly omit timestamps. (#2195)
|
||||
- Fixed typos in resources.go. (#2201)
|
||||
|
||||
## [1.0.0-RC2] - 2021-07-26
|
||||
|
@ -1293,7 +1483,7 @@ with major version 0.
|
|||
- `NewGRPCDriver` function returns a `ProtocolDriver` that maintains a single gRPC connection to the collector. (#1369)
|
||||
- Added documentation about the project's versioning policy. (#1388)
|
||||
- Added `NewSplitDriver` for OTLP exporter that allows sending traces and metrics to different endpoints. (#1418)
|
||||
- Added codeql worfklow to GitHub Actions (#1428)
|
||||
- Added codeql workflow to GitHub Actions (#1428)
|
||||
- Added Gosec workflow to GitHub Actions (#1429)
|
||||
- Add new HTTP driver for OTLP exporter in `exporters/otlp/otlphttp`. Currently it only supports the binary protobuf payloads. (#1420)
|
||||
- Add an OpenCensus exporter bridge. (#1444)
|
||||
|
@ -2136,7 +2326,7 @@ There is still a possibility of breaking changes.
|
|||
|
||||
### Fixed
|
||||
|
||||
- Use stateful batcher on Prometheus exporter fixing regresion introduced in #395. (#428)
|
||||
- Use stateful batcher on Prometheus exporter fixing regression introduced in #395. (#428)
|
||||
|
||||
## [0.2.1] - 2020-01-08
|
||||
|
||||
|
@ -2302,7 +2492,13 @@ It contains api and sdk for trace and meter.
|
|||
- CircleCI build CI manifest files.
|
||||
- CODEOWNERS file to track owners of this project.
|
||||
|
||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.14.0...HEAD
|
||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.16.0...HEAD
|
||||
[1.16.0/0.39.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0
|
||||
[1.16.0-rc.1/0.39.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.16.0-rc.1
|
||||
[1.15.1/0.38.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.1
|
||||
[1.15.0/0.38.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0
|
||||
[1.15.0-rc.2/0.38.0-rc.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.2
|
||||
[1.15.0-rc.1/0.38.0-rc.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.15.0-rc.1
|
||||
[1.14.0/0.37.0/0.0.4]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.14.0
|
||||
[1.13.0/0.36.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.13.0
|
||||
[1.12.0/0.35.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.12.0
|
||||
|
@ -2367,3 +2563,5 @@ It contains api and sdk for trace and meter.
|
|||
[Go 1.20]: https://go.dev/doc/go1.20
|
||||
[Go 1.19]: https://go.dev/doc/go1.19
|
||||
[Go 1.18]: https://go.dev/doc/go1.18
|
||||
|
||||
[metric API]:https://pkg.go.dev/go.opentelemetry.io/otel/metric
|
||||
|
|
2
vendor/go.opentelemetry.io/otel/CODEOWNERS
generated
vendored
2
vendor/go.opentelemetry.io/otel/CODEOWNERS
generated
vendored
|
@ -12,6 +12,6 @@
|
|||
# https://help.github.com/en/articles/about-code-owners
|
||||
#
|
||||
|
||||
* @jmacd @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu
|
||||
* @MrAlias @Aneurysm9 @evantorrie @XSAM @dashpole @MadVikingGod @pellared @hanyuancheung @dmathieu
|
||||
|
||||
CODEOWNERS @MrAlias @Aneurysm9 @MadVikingGod
|
||||
|
|
102
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
102
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
|
@ -6,7 +6,7 @@ OpenTelemetry
|
|||
repo for information on this and other language SIGs.
|
||||
|
||||
See the [public meeting
|
||||
notes](https://docs.google.com/document/d/1A63zSWX0x2CyCK_LoNhmQC4rqhLpYXJzXbEPDUQ2n6w/edit#heading=h.9tngw7jdwd6b)
|
||||
notes](https://docs.google.com/document/d/1E5e7Ld0NuU1iVvf-42tOBpu2VBBLYnh73GJuITGJTTU/edit)
|
||||
for a summary description of past meetings. To request edit access,
|
||||
join the meeting or get in touch on
|
||||
[Slack](https://cloud-native.slack.com/archives/C01NPAXACKT).
|
||||
|
@ -28,6 +28,11 @@ precommit` - the `precommit` target is the default).
|
|||
The `precommit` target also fixes the formatting of the code and
|
||||
checks the status of the go module files.
|
||||
|
||||
Additionally, there is a `codespell` target that checks for common
|
||||
typos in the code. It is not run by default, but you can run it
|
||||
manually with `make codespell`. It will set up a virtual environment
|
||||
in `venv` and install `codespell` there.
|
||||
|
||||
If after running `make precommit` the output of `git status` contains
|
||||
`nothing to commit, working tree clean` then it means that everything
|
||||
is up-to-date and properly formatted.
|
||||
|
@ -94,38 +99,66 @@ request ID to the entry you added to `CHANGELOG.md`.
|
|||
|
||||
### How to Get PRs Merged
|
||||
|
||||
A PR is considered to be **ready to merge** when:
|
||||
A PR is considered **ready to merge** when:
|
||||
|
||||
* It has received two approvals from Collaborators/Maintainers (at
|
||||
different companies). This is not enforced through technical means
|
||||
and a PR may be **ready to merge** with a single approval if the change
|
||||
and its approach have been discussed and consensus reached.
|
||||
* Feedback has been addressed.
|
||||
* Any substantive changes to your PR will require that you clear any prior
|
||||
Approval reviews, this includes changes resulting from other feedback. Unless
|
||||
the approver explicitly stated that their approval will persist across
|
||||
changes it should be assumed that the PR needs their review again. Other
|
||||
project members (e.g. approvers, maintainers) can help with this if there are
|
||||
any questions or if you forget to clear reviews.
|
||||
* It has been open for review for at least one working day. This gives
|
||||
people reasonable time to review.
|
||||
* Trivial changes (typo, cosmetic, doc, etc.) do not have to wait for
|
||||
one day and may be merged with a single Maintainer's approval.
|
||||
* `CHANGELOG.md` has been updated to reflect what has been
|
||||
added, changed, removed, or fixed.
|
||||
* `README.md` has been updated if necessary.
|
||||
* Urgent fix can take exception as long as it has been actively
|
||||
communicated.
|
||||
* It has received two qualified approvals[^1].
|
||||
|
||||
Any Maintainer can merge the PR once it is **ready to merge**.
|
||||
This is not enforced through automation, but needs to be validated by the
|
||||
maintainer merging.
|
||||
* The qualified approvals need to be from [Approver]s/[Maintainer]s
|
||||
affiliated with different companies. Two qualified approvals from
|
||||
[Approver]s or [Maintainer]s affiliated with the same company counts as a
|
||||
single qualified approval.
|
||||
* PRs introducing changes that have already been discussed and consensus
|
||||
reached only need one qualified approval. The discussion and resolution
|
||||
needs to be linked to the PR.
|
||||
* Trivial changes[^2] only need one qualified approval.
|
||||
|
||||
* All feedback has been addressed.
|
||||
* All PR comments and suggestions are resolved.
|
||||
* All GitHub Pull Request reviews with a status of "Request changes" have
|
||||
been addressed. Another review by the objecting reviewer with a different
|
||||
status can be submitted to clear the original review, or the review can be
|
||||
dismissed by a [Maintainer] when the issues from the original review have
|
||||
been addressed.
|
||||
* Any comments or reviews that cannot be resolved between the PR author and
|
||||
reviewers can be submitted to the community [Approver]s and [Maintainer]s
|
||||
during the weekly SIG meeting. If consensus is reached among the
|
||||
[Approver]s and [Maintainer]s during the SIG meeting the objections to the
|
||||
PR may be dismissed or resolved or the PR closed by a [Maintainer].
|
||||
* Any substantive changes to the PR require existing Approval reviews be
|
||||
cleared unless the approver explicitly states that their approval persists
|
||||
across changes. This includes changes resulting from other feedback.
|
||||
[Approver]s and [Maintainer]s can help in clearing reviews and they should
|
||||
be consulted if there are any questions.
|
||||
|
||||
* The PR branch is up to date with the base branch it is merging into.
|
||||
* To ensure this does not block the PR, it should be configured to allow
|
||||
maintainers to update it.
|
||||
|
||||
* It has been open for review for at least one working day. This gives people
|
||||
reasonable time to review.
|
||||
* Trivial changes[^2] do not have to wait for one day and may be merged with
|
||||
a single [Maintainer]'s approval.
|
||||
|
||||
* All required GitHub workflows have succeeded.
|
||||
* Urgent fix can take exception as long as it has been actively communicated
|
||||
among [Maintainer]s.
|
||||
|
||||
Any [Maintainer] can merge the PR once the above criteria have been met.
|
||||
|
||||
[^1]: A qualified approval is a GitHub Pull Request review with "Approve"
|
||||
status from an OpenTelemetry Go [Approver] or [Maintainer].
|
||||
[^2]: Trivial changes include: typo corrections, cosmetic non-substantive
|
||||
changes, documentation corrections or updates, dependency updates, etc.
|
||||
|
||||
## Design Choices
|
||||
|
||||
As with other OpenTelemetry clients, opentelemetry-go follows the
|
||||
[opentelemetry-specification](https://github.com/open-telemetry/opentelemetry-specification).
|
||||
[OpenTelemetry Specification](https://opentelemetry.io/docs/specs/otel).
|
||||
|
||||
It's especially valuable to read through the [library
|
||||
guidelines](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/library-guidelines.md).
|
||||
guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines).
|
||||
|
||||
### Focus on Capabilities, Not Structure Compliance
|
||||
|
||||
|
@ -216,7 +249,7 @@ Meaning a `config` from one package should not be directly used by another. The
|
|||
one exception is the API packages. The configs from the base API, eg.
|
||||
`go.opentelemetry.io/otel/trace.TracerConfig` and
|
||||
`go.opentelemetry.io/otel/metric.InstrumentConfig`, are intended to be consumed
|
||||
by the SDK therefor it is expected that these are exported.
|
||||
by the SDK therefore it is expected that these are exported.
|
||||
|
||||
When a config is exported we want to maintain forward and backward
|
||||
compatibility, to achieve this no fields should be exported but should
|
||||
|
@ -234,12 +267,12 @@ func newConfig(options ...Option) config {
|
|||
for _, option := range options {
|
||||
config = option.apply(config)
|
||||
}
|
||||
// Preform any validation here.
|
||||
// Perform any validation here.
|
||||
return config
|
||||
}
|
||||
```
|
||||
|
||||
If validation of the `config` options is also preformed this can return an
|
||||
If validation of the `config` options is also performed this can return an
|
||||
error as well that is expected to be handled by the instantiation function
|
||||
or propagated to the user.
|
||||
|
||||
|
@ -438,7 +471,7 @@ their parameters appropriately named.
|
|||
#### Interface Stability
|
||||
|
||||
All exported stable interfaces that include the following warning in their
|
||||
doumentation are allowed to be extended with additional methods.
|
||||
documentation are allowed to be extended with additional methods.
|
||||
|
||||
> Warning: methods may be added to this interface in minor releases.
|
||||
|
||||
|
@ -500,27 +533,30 @@ interface that defines the specific functionality should be preferred.
|
|||
|
||||
## Approvers and Maintainers
|
||||
|
||||
Approvers:
|
||||
### Approvers
|
||||
|
||||
- [Evan Torrie](https://github.com/evantorrie), Verizon Media
|
||||
- [Josh MacDonald](https://github.com/jmacd), LightStep
|
||||
- [Sam Xie](https://github.com/XSAM), Cisco/AppDynamics
|
||||
- [David Ashpole](https://github.com/dashpole), Google
|
||||
- [Robert Pająk](https://github.com/pellared), Splunk
|
||||
- [Chester Cheung](https://github.com/hanyuancheung), Tencent
|
||||
- [Damien Mathieu](https://github.com/dmathieu), Elastic
|
||||
|
||||
Maintainers:
|
||||
### Maintainers
|
||||
|
||||
- [Aaron Clawson](https://github.com/MadVikingGod), LightStep
|
||||
- [Anthony Mirabella](https://github.com/Aneurysm9), AWS
|
||||
- [Tyler Yahn](https://github.com/MrAlias), Splunk
|
||||
|
||||
Emeritus:
|
||||
### Emeritus
|
||||
|
||||
- [Gustavo Silva Paiva](https://github.com/paivagustavo), LightStep
|
||||
- [Josh MacDonald](https://github.com/jmacd), LightStep
|
||||
|
||||
### Become an Approver or a Maintainer
|
||||
|
||||
See the [community membership document in OpenTelemetry community
|
||||
repo](https://github.com/open-telemetry/community/blob/main/community-membership.md).
|
||||
|
||||
[Approver]: #approvers
|
||||
[Maintainer]: #maintainers
|
||||
|
|
54
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
54
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
|
@ -25,8 +25,8 @@ TIMEOUT = 60
|
|||
.DEFAULT_GOAL := precommit
|
||||
|
||||
.PHONY: precommit ci
|
||||
precommit: dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default
|
||||
ci: dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage
|
||||
precommit: generate dependabot-generate license-check vanity-import-fix misspell go-mod-tidy golangci-lint-fix test-default
|
||||
ci: generate dependabot-check license-check lint vanity-import-check build test-default check-clean-work-tree test-coverage
|
||||
|
||||
# Tools
|
||||
|
||||
|
@ -74,9 +74,42 @@ $(TOOLS)/gojq: PACKAGE=github.com/itchyny/gojq/cmd/gojq
|
|||
.PHONY: tools
|
||||
tools: $(CROSSLINK) $(DBOTCONF) $(GOLANGCI_LINT) $(MISSPELL) $(GOCOVMERGE) $(STRINGER) $(PORTO) $(GOJQ) $(SEMCONVGEN) $(MULTIMOD) $(SEMCONVKIT)
|
||||
|
||||
# Build
|
||||
# Virtualized python tools via docker
|
||||
|
||||
.PHONY: generate build
|
||||
# The directory where the virtual environment is created.
|
||||
VENVDIR := venv
|
||||
|
||||
# The directory where the python tools are installed.
|
||||
PYTOOLS := $(VENVDIR)/bin
|
||||
|
||||
# The pip executable in the virtual environment.
|
||||
PIP := $(PYTOOLS)/pip
|
||||
|
||||
# The directory in the docker image where the current directory is mounted.
|
||||
WORKDIR := /workdir
|
||||
|
||||
# The python image to use for the virtual environment.
|
||||
PYTHONIMAGE := python:3.11.3-slim-bullseye
|
||||
|
||||
# Run the python image with the current directory mounted.
|
||||
DOCKERPY := docker run --rm -v "$(CURDIR):$(WORKDIR)" -w $(WORKDIR) $(PYTHONIMAGE)
|
||||
|
||||
# Create a virtual environment for Python tools.
|
||||
$(PYTOOLS):
|
||||
# The `--upgrade` flag is needed to ensure that the virtual environment is
|
||||
# created with the latest pip version.
|
||||
@$(DOCKERPY) bash -c "python3 -m venv $(VENVDIR) && $(PIP) install --upgrade pip"
|
||||
|
||||
# Install python packages into the virtual environment.
|
||||
$(PYTOOLS)/%: | $(PYTOOLS)
|
||||
@$(DOCKERPY) $(PIP) install -r requirements.txt
|
||||
|
||||
CODESPELL = $(PYTOOLS)/codespell
|
||||
$(CODESPELL): PACKAGE=codespell
|
||||
|
||||
# Generate
|
||||
|
||||
.PHONY: generate
|
||||
|
||||
generate: $(OTEL_GO_MOD_DIRS:%=generate/%)
|
||||
generate/%: DIR=$*
|
||||
|
@ -85,7 +118,11 @@ generate/%: | $(STRINGER) $(PORTO)
|
|||
&& cd $(DIR) \
|
||||
&& PATH="$(TOOLS):$${PATH}" $(GO) generate ./... && $(PORTO) -w .
|
||||
|
||||
build: generate $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%)
|
||||
# Build
|
||||
|
||||
.PHONY: build
|
||||
|
||||
build: $(OTEL_GO_MOD_DIRS:%=build/%) $(OTEL_GO_MOD_DIRS:%=build-tests/%)
|
||||
build/%: DIR=$*
|
||||
build/%:
|
||||
@echo "$(GO) build $(DIR)/..." \
|
||||
|
@ -156,7 +193,7 @@ go-mod-tidy/%: DIR=$*
|
|||
go-mod-tidy/%: | crosslink
|
||||
@echo "$(GO) mod tidy in $(DIR)" \
|
||||
&& cd $(DIR) \
|
||||
&& $(GO) mod tidy -compat=1.18
|
||||
&& $(GO) mod tidy -compat=1.19
|
||||
|
||||
.PHONY: lint-modules
|
||||
lint-modules: go-mod-tidy
|
||||
|
@ -176,6 +213,10 @@ vanity-import-fix: | $(PORTO)
|
|||
misspell: | $(MISSPELL)
|
||||
@$(MISSPELL) -w $(ALL_DOCS)
|
||||
|
||||
.PHONY: codespell
|
||||
codespell: | $(CODESPELL)
|
||||
@$(DOCKERPY) $(CODESPELL)
|
||||
|
||||
.PHONY: license-check
|
||||
license-check:
|
||||
@licRes=$$(for f in $$(find . -type f \( -iname '*.go' -o -iname '*.sh' \) ! -path '**/third_party/*' ! -path './.git/*' ) ; do \
|
||||
|
@ -211,6 +252,7 @@ semconv-generate: | $(SEMCONVGEN) $(SEMCONVKIT)
|
|||
[ "$(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 )
|
||||
$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=span -p conventionType=trace -f trace.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
||||
$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=attribute_group -p conventionType=trace -f attribute_group.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
||||
$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=event -p conventionType=event -f event.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
||||
$(SEMCONVGEN) -i "$(OTEL_SPEC_REPO)/semantic_conventions/." --only=resource -p conventionType=resource -f resource.go -t "$(SEMCONVPKG)/template.j2" -s "$(TAG)"
|
||||
$(SEMCONVKIT) -output "$(SEMCONVPKG)/$(TAG)" -tag "$(TAG)"
|
||||
|
|
7
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
7
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
|
@ -14,7 +14,7 @@ It provides a set of APIs to directly measure performance and behavior of your s
|
|||
| Signal | Status | Project |
|
||||
| ------- | ---------- | ------- |
|
||||
| Traces | Stable | N/A |
|
||||
| Metrics | Alpha | N/A |
|
||||
| Metrics | Beta | N/A |
|
||||
| Logs | Frozen [1] | N/A |
|
||||
|
||||
- [1]: The Logs signal development is halted for this project while we develop both Traces and Metrics.
|
||||
|
@ -52,19 +52,14 @@ Currently, this project supports the following environments.
|
|||
| ------- | ---------- | ------------ |
|
||||
| Ubuntu | 1.20 | amd64 |
|
||||
| Ubuntu | 1.19 | amd64 |
|
||||
| Ubuntu | 1.18 | amd64 |
|
||||
| Ubuntu | 1.20 | 386 |
|
||||
| Ubuntu | 1.19 | 386 |
|
||||
| Ubuntu | 1.18 | 386 |
|
||||
| MacOS | 1.20 | amd64 |
|
||||
| MacOS | 1.19 | amd64 |
|
||||
| MacOS | 1.18 | amd64 |
|
||||
| Windows | 1.20 | amd64 |
|
||||
| Windows | 1.19 | amd64 |
|
||||
| Windows | 1.18 | amd64 |
|
||||
| Windows | 1.20 | 386 |
|
||||
| Windows | 1.19 | 386 |
|
||||
| Windows | 1.18 | 386 |
|
||||
|
||||
While this project should work for other systems, no compatibility guarantees
|
||||
are made for those systems currently.
|
||||
|
|
7
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
7
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
|
@ -2,10 +2,10 @@
|
|||
|
||||
## Semantic Convention Generation
|
||||
|
||||
New versions of the [OpenTelemetry specification] mean new versions of the `semconv` package need to be generated.
|
||||
New versions of the [OpenTelemetry Specification] mean new versions of the `semconv` package need to be generated.
|
||||
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. Pull the latest `otel/semconvgen` image: `docker pull otel/semconvgen:latest`
|
||||
3. Run the `make semconv-generate ...` target from this repository.
|
||||
|
||||
|
@ -14,7 +14,6 @@ For example,
|
|||
```sh
|
||||
export TAG="v1.13.0" # Change to the release version you are generating.
|
||||
export OTEL_SPEC_REPO="/absolute/path/to/opentelemetry-specification"
|
||||
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.
|
||||
```
|
||||
|
@ -124,4 +123,4 @@ Once verified be sure to [make a release for the `contrib` repository](https://g
|
|||
Update [the documentation](./website_docs) for [the OpenTelemetry website](https://opentelemetry.io/docs/go/).
|
||||
Importantly, bump any package versions referenced to be the latest one you just released and ensure all code examples still compile and are accurate.
|
||||
|
||||
[OpenTelemetry specification]: https://github.com/open-telemetry/opentelemetry-specification
|
||||
[OpenTelemetry Specification]: https://github.com/open-telemetry/opentelemetry-specification
|
||||
|
|
20
vendor/go.opentelemetry.io/otel/attribute/set.go
generated
vendored
20
vendor/go.opentelemetry.io/otel/attribute/set.go
generated
vendored
|
@ -18,6 +18,7 @@ import (
|
|||
"encoding/json"
|
||||
"reflect"
|
||||
"sort"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type (
|
||||
|
@ -62,6 +63,12 @@ var (
|
|||
iface: [0]KeyValue{},
|
||||
},
|
||||
}
|
||||
|
||||
// sortables is a pool of Sortables used to create Sets with a user does
|
||||
// not provide one.
|
||||
sortables = sync.Pool{
|
||||
New: func() interface{} { return new(Sortable) },
|
||||
}
|
||||
)
|
||||
|
||||
// EmptySet returns a reference to a Set with no elements.
|
||||
|
@ -91,7 +98,7 @@ func (l *Set) Len() int {
|
|||
|
||||
// Get returns the KeyValue at ordered position idx in this set.
|
||||
func (l *Set) Get(idx int) (KeyValue, bool) {
|
||||
if l == nil {
|
||||
if l == nil || !l.equivalent.Valid() {
|
||||
return KeyValue{}, false
|
||||
}
|
||||
value := l.equivalent.reflectValue()
|
||||
|
@ -107,7 +114,7 @@ func (l *Set) Get(idx int) (KeyValue, bool) {
|
|||
|
||||
// Value returns the value of a specified key in this set.
|
||||
func (l *Set) Value(k Key) (Value, bool) {
|
||||
if l == nil {
|
||||
if l == nil || !l.equivalent.Valid() {
|
||||
return Value{}, false
|
||||
}
|
||||
rValue := l.equivalent.reflectValue()
|
||||
|
@ -191,7 +198,9 @@ func NewSet(kvs ...KeyValue) Set {
|
|||
if len(kvs) == 0 {
|
||||
return empty()
|
||||
}
|
||||
s, _ := NewSetWithSortableFiltered(kvs, new(Sortable), nil)
|
||||
srt := sortables.Get().(*Sortable)
|
||||
s, _ := NewSetWithSortableFiltered(kvs, srt, nil)
|
||||
sortables.Put(srt)
|
||||
return s
|
||||
}
|
||||
|
||||
|
@ -218,7 +227,10 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
|||
if len(kvs) == 0 {
|
||||
return empty(), nil
|
||||
}
|
||||
return NewSetWithSortableFiltered(kvs, new(Sortable), filter)
|
||||
srt := sortables.Get().(*Sortable)
|
||||
s, filtered := NewSetWithSortableFiltered(kvs, srt, filter)
|
||||
sortables.Put(srt)
|
||||
return s, filtered
|
||||
}
|
||||
|
||||
// NewSetWithSortableFiltered returns a new Set.
|
||||
|
|
54
vendor/go.opentelemetry.io/otel/baggage/baggage.go
generated
vendored
54
vendor/go.opentelemetry.io/otel/baggage/baggage.go
generated
vendored
|
@ -289,45 +289,37 @@ func parseMember(member string) (Member, error) {
|
|||
props properties
|
||||
)
|
||||
|
||||
parts := strings.SplitN(member, propertyDelimiter, 2)
|
||||
switch len(parts) {
|
||||
case 2:
|
||||
keyValue, properties, found := strings.Cut(member, propertyDelimiter)
|
||||
if found {
|
||||
// Parse the member properties.
|
||||
for _, pStr := range strings.Split(parts[1], propertyDelimiter) {
|
||||
for _, pStr := range strings.Split(properties, propertyDelimiter) {
|
||||
p, err := parseProperty(pStr)
|
||||
if err != nil {
|
||||
return newInvalidMember(), err
|
||||
}
|
||||
props = append(props, p)
|
||||
}
|
||||
fallthrough
|
||||
case 1:
|
||||
// Parse the member key/value pair.
|
||||
}
|
||||
// Parse the member key/value pair.
|
||||
|
||||
// Take into account a value can contain equal signs (=).
|
||||
kv := strings.SplitN(parts[0], keyValueDelimiter, 2)
|
||||
if len(kv) != 2 {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member)
|
||||
}
|
||||
// "Leading and trailing whitespaces are allowed but MUST be trimmed
|
||||
// when converting the header into a data structure."
|
||||
key = strings.TrimSpace(kv[0])
|
||||
var err error
|
||||
value, err = url.QueryUnescape(strings.TrimSpace(kv[1]))
|
||||
if err != nil {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", err, value)
|
||||
}
|
||||
if !keyRe.MatchString(key) {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||
}
|
||||
if !valueRe.MatchString(value) {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||
}
|
||||
default:
|
||||
// This should never happen unless a developer has changed the string
|
||||
// splitting somehow. Panic instead of failing silently and allowing
|
||||
// the bug to slip past the CI checks.
|
||||
panic("failed to parse baggage member")
|
||||
// Take into account a value can contain equal signs (=).
|
||||
k, v, found := strings.Cut(keyValue, keyValueDelimiter)
|
||||
if !found {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidMember, member)
|
||||
}
|
||||
// "Leading and trailing whitespaces are allowed but MUST be trimmed
|
||||
// when converting the header into a data structure."
|
||||
key = strings.TrimSpace(k)
|
||||
var err error
|
||||
value, err = url.QueryUnescape(strings.TrimSpace(v))
|
||||
if err != nil {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", err, value)
|
||||
}
|
||||
if !keyRe.MatchString(key) {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidKey, key)
|
||||
}
|
||||
if !valueRe.MatchString(value) {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %q", errInvalidValue, value)
|
||||
}
|
||||
|
||||
return Member{key: key, value: value, properties: props, hasData: true}, nil
|
||||
|
|
2
vendor/go.opentelemetry.io/otel/codes/doc.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/codes/doc.go
generated
vendored
|
@ -16,6 +16,6 @@
|
|||
Package codes defines the canonical error codes used by OpenTelemetry.
|
||||
|
||||
It conforms to [the OpenTelemetry
|
||||
specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#statuscanonicalcode).
|
||||
specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/api.md#set-status).
|
||||
*/
|
||||
package codes // import "go.opentelemetry.io/otel/codes"
|
||||
|
|
6
vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md
generated
vendored
6
vendor/go.opentelemetry.io/otel/exporters/jaeger/README.md
generated
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/jaeger.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/jaeger)
|
||||
|
||||
[OpenTelemetry span exporter for Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md) implementation.
|
||||
[OpenTelemetry span exporter for Jaeger](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md) implementation.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -46,5 +46,5 @@ When re-generating Thrift code in the future, please adapt import paths as neces
|
|||
## References
|
||||
|
||||
- [Jaeger](https://www.jaegertracing.io/)
|
||||
- [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md)
|
||||
- [OpenTelemetry Environment Variable Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/sdk-environment-variables.md)
|
||||
- [OpenTelemetry to Jaeger Transformation](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/trace/sdk_exporters/jaeger.md)
|
||||
- [OpenTelemetry Environment Variable Specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/sdk-environment-variables.md#jaeger-exporter)
|
||||
|
|
2
vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/exporters/jaeger/env.go
generated
vendored
|
@ -37,7 +37,7 @@ const (
|
|||
|
||||
// envOr returns an env variable's value if it is exists or the default if not.
|
||||
func envOr(key, defaultValue string) string {
|
||||
if v, ok := os.LookupEnv(key); ok && v != "" {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
}
|
||||
return defaultValue
|
||||
|
|
|
@ -77,7 +77,7 @@ const (
|
|||
// WrapTException wraps an error into TException.
|
||||
//
|
||||
// If err is nil or already TException, it's returned as-is.
|
||||
// Otherwise it will be wraped into TException with TExceptionType() returning
|
||||
// Otherwise it will be wrapped into TException with TExceptionType() returning
|
||||
// TExceptionTypeUnknown, and Unwrap() returning the original error.
|
||||
func WrapTException(err error) TException {
|
||||
if err == nil {
|
||||
|
|
|
@ -160,15 +160,13 @@ func (t *TMultiplexedProcessor) ProcessorMap() map[string]TProcessorFunction {
|
|||
// the given ProcessorName or if all that is given is the FunctionName and there
|
||||
// is no DefaultProcessor set.
|
||||
func (t *TMultiplexedProcessor) AddToProcessorMap(name string, processorFunc TProcessorFunction) {
|
||||
components := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2)
|
||||
if len(components) != 2 {
|
||||
if t.DefaultProcessor != nil && len(components) == 1 {
|
||||
t.DefaultProcessor.AddToProcessorMap(components[0], processorFunc)
|
||||
processorName, funcName, found := strings.Cut(name, MULTIPLEXED_SEPARATOR)
|
||||
if !found {
|
||||
if t.DefaultProcessor != nil {
|
||||
t.DefaultProcessor.AddToProcessorMap(processorName, processorFunc)
|
||||
}
|
||||
return
|
||||
}
|
||||
processorName := components[0]
|
||||
funcName := components[1]
|
||||
if processor, ok := t.serviceProcessorMap[processorName]; ok {
|
||||
processor.AddToProcessorMap(funcName, processorFunc)
|
||||
}
|
||||
|
@ -197,9 +195,9 @@ func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol)
|
|||
if typeId != CALL && typeId != ONEWAY {
|
||||
return false, NewTProtocolException(fmt.Errorf("Unexpected message type %v", typeId))
|
||||
}
|
||||
//extract the service name
|
||||
v := strings.SplitN(name, MULTIPLEXED_SEPARATOR, 2)
|
||||
if len(v) != 2 {
|
||||
// extract the service name
|
||||
processorName, funcName, found := strings.Cut(name, MULTIPLEXED_SEPARATOR)
|
||||
if !found {
|
||||
if t.DefaultProcessor != nil {
|
||||
smb := NewStoredMessageProtocol(in, name, typeId, seqid)
|
||||
return t.DefaultProcessor.Process(ctx, smb, out)
|
||||
|
@ -209,18 +207,18 @@ func (t *TMultiplexedProcessor) Process(ctx context.Context, in, out TProtocol)
|
|||
name,
|
||||
))
|
||||
}
|
||||
actualProcessor, ok := t.serviceProcessorMap[v[0]]
|
||||
actualProcessor, ok := t.serviceProcessorMap[processorName]
|
||||
if !ok {
|
||||
return false, NewTProtocolException(fmt.Errorf(
|
||||
"Service name not found: %s. Did you forget to call registerProcessor()?",
|
||||
v[0],
|
||||
processorName,
|
||||
))
|
||||
}
|
||||
smb := NewStoredMessageProtocol(in, v[1], typeId, seqid)
|
||||
smb := NewStoredMessageProtocol(in, funcName, typeId, seqid)
|
||||
return actualProcessor.Process(ctx, smb, out)
|
||||
}
|
||||
|
||||
//Protocol that use stored message for ReadMessageBegin
|
||||
// Protocol that use stored message for ReadMessageBegin
|
||||
type storedMessageProtocol struct {
|
||||
TProtocol
|
||||
name string
|
||||
|
|
|
@ -56,7 +56,7 @@ type stringWriter interface {
|
|||
WriteString(s string) (n int, err error)
|
||||
}
|
||||
|
||||
// This is "enchanced" transport with extra capabilities. You need to use one of these
|
||||
// This is "enhanced" transport with extra capabilities. You need to use one of these
|
||||
// to construct protocol.
|
||||
// Notably, TSocket does not implement this interface, and it is always a mistake to use
|
||||
// TSocket directly in protocol.
|
||||
|
|
|
@ -40,7 +40,7 @@ const (
|
|||
LIST = 15
|
||||
UTF8 = 16
|
||||
UTF16 = 17
|
||||
//BINARY = 18 wrong and unusued
|
||||
//BINARY = 18 wrong and unused
|
||||
)
|
||||
|
||||
var typeNames = map[int]string{
|
||||
|
|
14
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go
generated
vendored
14
vendor/go.opentelemetry.io/otel/exporters/otlp/internal/envconfig/envconfig.go
generated
vendored
|
@ -166,20 +166,20 @@ func stringToHeader(value string) map[string]string {
|
|||
headers := make(map[string]string)
|
||||
|
||||
for _, header := range headersPairs {
|
||||
nameValue := strings.SplitN(header, "=", 2)
|
||||
if len(nameValue) < 2 {
|
||||
global.Error(errors.New("missing '="), "parse headers", "input", nameValue)
|
||||
n, v, found := strings.Cut(header, "=")
|
||||
if !found {
|
||||
global.Error(errors.New("missing '="), "parse headers", "input", header)
|
||||
continue
|
||||
}
|
||||
name, err := url.QueryUnescape(nameValue[0])
|
||||
name, err := url.QueryUnescape(n)
|
||||
if err != nil {
|
||||
global.Error(err, "escape header key", "key", nameValue[0])
|
||||
global.Error(err, "escape header key", "key", n)
|
||||
continue
|
||||
}
|
||||
trimmedName := strings.TrimSpace(name)
|
||||
value, err := url.QueryUnescape(nameValue[1])
|
||||
value, err := url.QueryUnescape(v)
|
||||
if err != nil {
|
||||
global.Error(err, "escape header value", "value", nameValue[1])
|
||||
global.Error(err, "escape header value", "value", v)
|
||||
continue
|
||||
}
|
||||
trimmedValue := strings.TrimSpace(value)
|
||||
|
|
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
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Go Reference](https://pkg.go.dev/badge/go.opentelemetry.io/otel/exporters/otlp/otlptrace.svg)](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace)
|
||||
|
||||
[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/protocol/exporter.md) implementation.
|
||||
[OpenTelemetry Protocol Exporter](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md) implementation.
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -36,7 +36,7 @@ The `otlptracehttp` package implements a client for the span exporter that sends
|
|||
The following environment variables can be used (instead of options objects) to
|
||||
override the default configuration. For more information about how each of
|
||||
these environment variables is interpreted, see [the OpenTelemetry
|
||||
specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/protocol/exporter.md).
|
||||
specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md).
|
||||
|
||||
| Environment variable | Option | Default value |
|
||||
| ------------------------------------------------------------------------ |------------------------------ | -------------------------------------------------------- |
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package internal contains common functionality for all OTLP exporters.
|
||||
package internal // import "go.opentelemetry.io/otel/exporters/otlp/internal"
|
||||
package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal"
|
||||
|
||||
import "go.opentelemetry.io/otel"
|
||||
import (
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
|
||||
)
|
||||
|
||||
// GetUserAgentHeader return an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}"
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#user-agent
|
||||
// GetUserAgentHeader returns an OTLP header value form "OTel OTLP Exporter Go/{{ .Version }}"
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/protocol/exporter.md#user-agent
|
||||
func GetUserAgentHeader() string {
|
||||
return "OTel OTLP Exporter Go/" + otel.Version()
|
||||
return "OTel OTLP Exporter Go/" + otlptrace.Version()
|
||||
}
|
|
@ -27,6 +27,7 @@ import (
|
|||
|
||||
"go.opentelemetry.io/otel/exporters/otlp/internal"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/internal/retry"
|
||||
otinternal "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -97,7 +98,7 @@ func NewGRPCConfig(opts ...GRPCOption) Config {
|
|||
Timeout: DefaultTimeout,
|
||||
},
|
||||
RetryConfig: retry.DefaultConfig,
|
||||
DialOptions: []grpc.DialOption{grpc.WithUserAgent(internal.GetUserAgentHeader())},
|
||||
DialOptions: []grpc.DialOption{grpc.WithUserAgent(otinternal.GetUserAgentHeader())},
|
||||
}
|
||||
cfg = ApplyGRPCEnvConfigs(cfg)
|
||||
for _, opt := range opts {
|
||||
|
|
5
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
generated
vendored
5
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go
generated
vendored
|
@ -130,13 +130,16 @@ var errAlreadyStopped = errors.New("the client is already stopped")
|
|||
// If the client has already stopped, an error will be returned describing
|
||||
// this.
|
||||
func (c *client) Stop(ctx context.Context) error {
|
||||
// Make sure to return context error if the context is done when calling this method.
|
||||
err := ctx.Err()
|
||||
|
||||
// Acquire the c.tscMu lock within the ctx lifetime.
|
||||
acquired := make(chan struct{})
|
||||
go func() {
|
||||
c.tscMu.Lock()
|
||||
close(acquired)
|
||||
}()
|
||||
var err error
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
// The Stop timeout is reached. Kill any remaining exports to force
|
||||
|
|
20
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go
generated
vendored
Normal file
20
vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.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 otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace"
|
||||
|
||||
// Version is the current release version of the OpenTelemetry OTLP trace exporter in use.
|
||||
func Version() string {
|
||||
return "1.16.0"
|
||||
}
|
64
vendor/go.opentelemetry.io/otel/handler.go
generated
vendored
64
vendor/go.opentelemetry.io/otel/handler.go
generated
vendored
|
@ -15,58 +15,16 @@
|
|||
package otel // import "go.opentelemetry.io/otel"
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
)
|
||||
|
||||
var (
|
||||
// globalErrorHandler provides an ErrorHandler that can be used
|
||||
// throughout an OpenTelemetry instrumented project. When a user
|
||||
// specified ErrorHandler is registered (`SetErrorHandler`) all calls to
|
||||
// `Handle` and will be delegated to the registered ErrorHandler.
|
||||
globalErrorHandler = defaultErrorHandler()
|
||||
|
||||
// Compile-time check that delegator implements ErrorHandler.
|
||||
_ ErrorHandler = (*delegator)(nil)
|
||||
// Compile-time check that errLogger implements ErrorHandler.
|
||||
_ ErrorHandler = (*errLogger)(nil)
|
||||
// Compile-time check global.ErrDelegator implements ErrorHandler.
|
||||
_ ErrorHandler = (*global.ErrDelegator)(nil)
|
||||
// Compile-time check global.ErrLogger implements ErrorHandler.
|
||||
_ ErrorHandler = (*global.ErrLogger)(nil)
|
||||
)
|
||||
|
||||
type delegator struct {
|
||||
delegate unsafe.Pointer
|
||||
}
|
||||
|
||||
func (d *delegator) Handle(err error) {
|
||||
d.getDelegate().Handle(err)
|
||||
}
|
||||
|
||||
func (d *delegator) getDelegate() ErrorHandler {
|
||||
return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate))
|
||||
}
|
||||
|
||||
// setDelegate sets the ErrorHandler delegate.
|
||||
func (d *delegator) setDelegate(eh ErrorHandler) {
|
||||
atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh))
|
||||
}
|
||||
|
||||
func defaultErrorHandler() *delegator {
|
||||
d := &delegator{}
|
||||
d.setDelegate(&errLogger{l: log.New(os.Stderr, "", log.LstdFlags)})
|
||||
return d
|
||||
}
|
||||
|
||||
// errLogger logs errors if no delegate is set, otherwise they are delegated.
|
||||
type errLogger struct {
|
||||
l *log.Logger
|
||||
}
|
||||
|
||||
// Handle logs err if no delegate is set, otherwise it is delegated.
|
||||
func (h *errLogger) Handle(err error) {
|
||||
h.l.Print(err)
|
||||
}
|
||||
|
||||
// GetErrorHandler returns the global ErrorHandler instance.
|
||||
//
|
||||
// The default ErrorHandler instance returned will log all errors to STDERR
|
||||
|
@ -76,9 +34,7 @@ func (h *errLogger) Handle(err error) {
|
|||
//
|
||||
// Subsequent calls to SetErrorHandler after the first will not forward errors
|
||||
// to the new ErrorHandler for prior returned instances.
|
||||
func GetErrorHandler() ErrorHandler {
|
||||
return globalErrorHandler
|
||||
}
|
||||
func GetErrorHandler() ErrorHandler { return global.GetErrorHandler() }
|
||||
|
||||
// SetErrorHandler sets the global ErrorHandler to h.
|
||||
//
|
||||
|
@ -86,11 +42,7 @@ func GetErrorHandler() ErrorHandler {
|
|||
// GetErrorHandler will send errors to h instead of the default logging
|
||||
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
|
||||
// delegate errors to h.
|
||||
func SetErrorHandler(h ErrorHandler) {
|
||||
globalErrorHandler.setDelegate(h)
|
||||
}
|
||||
func SetErrorHandler(h ErrorHandler) { global.SetErrorHandler(h) }
|
||||
|
||||
// Handle is a convenience function for ErrorHandler().Handle(err).
|
||||
func Handle(err error) {
|
||||
GetErrorHandler().Handle(err)
|
||||
}
|
||||
func Handle(err error) { global.Handle(err) }
|
||||
|
|
103
vendor/go.opentelemetry.io/otel/internal/global/handler.go
generated
vendored
Normal file
103
vendor/go.opentelemetry.io/otel/internal/global/handler.go
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
// 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/internal/global"
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
var (
|
||||
// GlobalErrorHandler provides an ErrorHandler that can be used
|
||||
// throughout an OpenTelemetry instrumented project. When a user
|
||||
// specified ErrorHandler is registered (`SetErrorHandler`) all calls to
|
||||
// `Handle` and will be delegated to the registered ErrorHandler.
|
||||
GlobalErrorHandler = defaultErrorHandler()
|
||||
|
||||
// Compile-time check that delegator implements ErrorHandler.
|
||||
_ ErrorHandler = (*ErrDelegator)(nil)
|
||||
// Compile-time check that errLogger implements ErrorHandler.
|
||||
_ ErrorHandler = (*ErrLogger)(nil)
|
||||
)
|
||||
|
||||
// ErrorHandler handles irremediable events.
|
||||
type ErrorHandler interface {
|
||||
// Handle handles any error deemed irremediable by an OpenTelemetry
|
||||
// component.
|
||||
Handle(error)
|
||||
}
|
||||
|
||||
type ErrDelegator struct {
|
||||
delegate unsafe.Pointer
|
||||
}
|
||||
|
||||
func (d *ErrDelegator) Handle(err error) {
|
||||
d.getDelegate().Handle(err)
|
||||
}
|
||||
|
||||
func (d *ErrDelegator) getDelegate() ErrorHandler {
|
||||
return *(*ErrorHandler)(atomic.LoadPointer(&d.delegate))
|
||||
}
|
||||
|
||||
// setDelegate sets the ErrorHandler delegate.
|
||||
func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
|
||||
atomic.StorePointer(&d.delegate, unsafe.Pointer(&eh))
|
||||
}
|
||||
|
||||
func defaultErrorHandler() *ErrDelegator {
|
||||
d := &ErrDelegator{}
|
||||
d.setDelegate(&ErrLogger{l: log.New(os.Stderr, "", log.LstdFlags)})
|
||||
return d
|
||||
}
|
||||
|
||||
// ErrLogger logs errors if no delegate is set, otherwise they are delegated.
|
||||
type ErrLogger struct {
|
||||
l *log.Logger
|
||||
}
|
||||
|
||||
// Handle logs err if no delegate is set, otherwise it is delegated.
|
||||
func (h *ErrLogger) Handle(err error) {
|
||||
h.l.Print(err)
|
||||
}
|
||||
|
||||
// GetErrorHandler returns the global ErrorHandler instance.
|
||||
//
|
||||
// The default ErrorHandler instance returned will log all errors to STDERR
|
||||
// until an override ErrorHandler is set with SetErrorHandler. All
|
||||
// ErrorHandler returned prior to this will automatically forward errors to
|
||||
// the set instance instead of logging.
|
||||
//
|
||||
// Subsequent calls to SetErrorHandler after the first will not forward errors
|
||||
// to the new ErrorHandler for prior returned instances.
|
||||
func GetErrorHandler() ErrorHandler {
|
||||
return GlobalErrorHandler
|
||||
}
|
||||
|
||||
// SetErrorHandler sets the global ErrorHandler to h.
|
||||
//
|
||||
// The first time this is called all ErrorHandler previously returned from
|
||||
// GetErrorHandler will send errors to h instead of the default logging
|
||||
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
|
||||
// delegate errors to h.
|
||||
func SetErrorHandler(h ErrorHandler) {
|
||||
GlobalErrorHandler.setDelegate(h)
|
||||
}
|
||||
|
||||
// Handle is a convenience function for ErrorHandler().Handle(err).
|
||||
func Handle(err error) {
|
||||
GetErrorHandler().Handle(err)
|
||||
}
|
359
vendor/go.opentelemetry.io/otel/internal/global/instruments.go
generated
vendored
Normal file
359
vendor/go.opentelemetry.io/otel/internal/global/instruments.go
generated
vendored
Normal file
|
@ -0,0 +1,359 @@
|
|||
// 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/internal/global"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync/atomic"
|
||||
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/embedded"
|
||||
)
|
||||
|
||||
// unwrapper unwraps to return the underlying instrument implementation.
|
||||
type unwrapper interface {
|
||||
Unwrap() metric.Observable
|
||||
}
|
||||
|
||||
type afCounter struct {
|
||||
embedded.Float64ObservableCounter
|
||||
metric.Float64Observable
|
||||
|
||||
name string
|
||||
opts []metric.Float64ObservableCounterOption
|
||||
|
||||
delegate atomic.Value //metric.Float64ObservableCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*afCounter)(nil)
|
||||
var _ metric.Float64ObservableCounter = (*afCounter)(nil)
|
||||
|
||||
func (i *afCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64ObservableCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *afCounter) Unwrap() metric.Observable {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64ObservableCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type afUpDownCounter struct {
|
||||
embedded.Float64ObservableUpDownCounter
|
||||
metric.Float64Observable
|
||||
|
||||
name string
|
||||
opts []metric.Float64ObservableUpDownCounterOption
|
||||
|
||||
delegate atomic.Value //metric.Float64ObservableUpDownCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*afUpDownCounter)(nil)
|
||||
var _ metric.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil)
|
||||
|
||||
func (i *afUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *afUpDownCounter) Unwrap() metric.Observable {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64ObservableUpDownCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type afGauge struct {
|
||||
embedded.Float64ObservableGauge
|
||||
metric.Float64Observable
|
||||
|
||||
name string
|
||||
opts []metric.Float64ObservableGaugeOption
|
||||
|
||||
delegate atomic.Value //metric.Float64ObservableGauge
|
||||
}
|
||||
|
||||
var _ unwrapper = (*afGauge)(nil)
|
||||
var _ metric.Float64ObservableGauge = (*afGauge)(nil)
|
||||
|
||||
func (i *afGauge) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64ObservableGauge(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *afGauge) Unwrap() metric.Observable {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64ObservableGauge)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type aiCounter struct {
|
||||
embedded.Int64ObservableCounter
|
||||
metric.Int64Observable
|
||||
|
||||
name string
|
||||
opts []metric.Int64ObservableCounterOption
|
||||
|
||||
delegate atomic.Value //metric.Int64ObservableCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*aiCounter)(nil)
|
||||
var _ metric.Int64ObservableCounter = (*aiCounter)(nil)
|
||||
|
||||
func (i *aiCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64ObservableCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *aiCounter) Unwrap() metric.Observable {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64ObservableCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type aiUpDownCounter struct {
|
||||
embedded.Int64ObservableUpDownCounter
|
||||
metric.Int64Observable
|
||||
|
||||
name string
|
||||
opts []metric.Int64ObservableUpDownCounterOption
|
||||
|
||||
delegate atomic.Value //metric.Int64ObservableUpDownCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*aiUpDownCounter)(nil)
|
||||
var _ metric.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil)
|
||||
|
||||
func (i *aiUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *aiUpDownCounter) Unwrap() metric.Observable {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64ObservableUpDownCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type aiGauge struct {
|
||||
embedded.Int64ObservableGauge
|
||||
metric.Int64Observable
|
||||
|
||||
name string
|
||||
opts []metric.Int64ObservableGaugeOption
|
||||
|
||||
delegate atomic.Value //metric.Int64ObservableGauge
|
||||
}
|
||||
|
||||
var _ unwrapper = (*aiGauge)(nil)
|
||||
var _ metric.Int64ObservableGauge = (*aiGauge)(nil)
|
||||
|
||||
func (i *aiGauge) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64ObservableGauge(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *aiGauge) Unwrap() metric.Observable {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64ObservableGauge)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sync Instruments.
|
||||
type sfCounter struct {
|
||||
embedded.Float64Counter
|
||||
|
||||
name string
|
||||
opts []metric.Float64CounterOption
|
||||
|
||||
delegate atomic.Value //metric.Float64Counter
|
||||
}
|
||||
|
||||
var _ metric.Float64Counter = (*sfCounter)(nil)
|
||||
|
||||
func (i *sfCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64Counter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
ctr.(metric.Float64Counter).Add(ctx, incr, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
type sfUpDownCounter struct {
|
||||
embedded.Float64UpDownCounter
|
||||
|
||||
name string
|
||||
opts []metric.Float64UpDownCounterOption
|
||||
|
||||
delegate atomic.Value //metric.Float64UpDownCounter
|
||||
}
|
||||
|
||||
var _ metric.Float64UpDownCounter = (*sfUpDownCounter)(nil)
|
||||
|
||||
func (i *sfUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64UpDownCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOption) {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
ctr.(metric.Float64UpDownCounter).Add(ctx, incr, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
type sfHistogram struct {
|
||||
embedded.Float64Histogram
|
||||
|
||||
name string
|
||||
opts []metric.Float64HistogramOption
|
||||
|
||||
delegate atomic.Value //metric.Float64Histogram
|
||||
}
|
||||
|
||||
var _ metric.Float64Histogram = (*sfHistogram)(nil)
|
||||
|
||||
func (i *sfHistogram) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64Histogram(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.RecordOption) {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
ctr.(metric.Float64Histogram).Record(ctx, x, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
type siCounter struct {
|
||||
embedded.Int64Counter
|
||||
|
||||
name string
|
||||
opts []metric.Int64CounterOption
|
||||
|
||||
delegate atomic.Value //metric.Int64Counter
|
||||
}
|
||||
|
||||
var _ metric.Int64Counter = (*siCounter)(nil)
|
||||
|
||||
func (i *siCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64Counter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
ctr.(metric.Int64Counter).Add(ctx, x, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
type siUpDownCounter struct {
|
||||
embedded.Int64UpDownCounter
|
||||
|
||||
name string
|
||||
opts []metric.Int64UpDownCounterOption
|
||||
|
||||
delegate atomic.Value //metric.Int64UpDownCounter
|
||||
}
|
||||
|
||||
var _ metric.Int64UpDownCounter = (*siUpDownCounter)(nil)
|
||||
|
||||
func (i *siUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64UpDownCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption) {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
ctr.(metric.Int64UpDownCounter).Add(ctx, x, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
type siHistogram struct {
|
||||
embedded.Int64Histogram
|
||||
|
||||
name string
|
||||
opts []metric.Int64HistogramOption
|
||||
|
||||
delegate atomic.Value //metric.Int64Histogram
|
||||
}
|
||||
|
||||
var _ metric.Int64Histogram = (*siHistogram)(nil)
|
||||
|
||||
func (i *siHistogram) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64Histogram(i.name, i.opts...)
|
||||
if err != nil {
|
||||
GetErrorHandler().Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.RecordOption) {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
ctr.(metric.Int64Histogram).Record(ctx, x, opts...)
|
||||
}
|
||||
}
|
19
vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
generated
vendored
19
vendor/go.opentelemetry.io/otel/internal/global/internal_logging.go
generated
vendored
|
@ -24,7 +24,7 @@ import (
|
|||
"github.com/go-logr/stdr"
|
||||
)
|
||||
|
||||
// globalLogger is the logging interface used within the otel api and sdk provide deatails of the internals.
|
||||
// globalLogger is the logging interface used within the otel api and sdk provide details of the internals.
|
||||
//
|
||||
// The default logger uses stdr which is backed by the standard `log.Logger`
|
||||
// interface. This logger will only show messages at the Error Level.
|
||||
|
@ -36,8 +36,9 @@ func init() {
|
|||
|
||||
// SetLogger overrides the globalLogger with l.
|
||||
//
|
||||
// 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 Warn messages use a logger with `l.V(1).Enabled() == true`
|
||||
// To see Info messages use a logger with `l.V(4).Enabled() == true`
|
||||
// To see Debug messages use a logger with `l.V(8).Enabled() == true`.
|
||||
func SetLogger(l logr.Logger) {
|
||||
atomic.StorePointer(&globalLogger, unsafe.Pointer(&l))
|
||||
}
|
||||
|
@ -47,9 +48,9 @@ func getLogger() logr.Logger {
|
|||
}
|
||||
|
||||
// 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 than 5 messages a minute.
|
||||
func Info(msg string, keysAndValues ...interface{}) {
|
||||
getLogger().V(1).Info(msg, keysAndValues...)
|
||||
getLogger().V(4).Info(msg, keysAndValues...)
|
||||
}
|
||||
|
||||
// Error prints messages about exceptional states of the API or SDK.
|
||||
|
@ -59,5 +60,11 @@ func Error(err error, msg string, keysAndValues ...interface{}) {
|
|||
|
||||
// Debug prints messages about all internal changes in the API or SDK.
|
||||
func Debug(msg string, keysAndValues ...interface{}) {
|
||||
getLogger().V(5).Info(msg, keysAndValues...)
|
||||
getLogger().V(8).Info(msg, keysAndValues...)
|
||||
}
|
||||
|
||||
// Warn prints messages about warnings in the API or SDK.
|
||||
// Not an error but is likely more important than an informational event.
|
||||
func Warn(msg string, keysAndValues ...interface{}) {
|
||||
getLogger().V(1).Info(msg, keysAndValues...)
|
||||
}
|
||||
|
|
|
@ -12,16 +12,15 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package global // import "go.opentelemetry.io/otel/metric/internal/global"
|
||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
"go.opentelemetry.io/otel/metric/embedded"
|
||||
)
|
||||
|
||||
// meterProvider is a placeholder for a configured SDK MeterProvider.
|
||||
|
@ -29,17 +28,14 @@ import (
|
|||
// All MeterProvider functionality is forwarded to a delegate once
|
||||
// configured.
|
||||
type meterProvider struct {
|
||||
embedded.MeterProvider
|
||||
|
||||
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.
|
||||
//
|
||||
|
@ -100,6 +96,8 @@ func (p *meterProvider) Meter(name string, opts ...metric.MeterOption) metric.Me
|
|||
// All Meter functionality is forwarded to a delegate once configured.
|
||||
// Otherwise, all functionality is forwarded to a NoopMeter.
|
||||
type meter struct {
|
||||
embedded.Meter
|
||||
|
||||
name string
|
||||
opts []metric.MeterOption
|
||||
|
||||
|
@ -142,7 +140,7 @@ func (m *meter) setDelegate(provider metric.MeterProvider) {
|
|||
m.registry.Init()
|
||||
}
|
||||
|
||||
func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error) {
|
||||
func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption) (metric.Int64Counter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Int64Counter(name, options...)
|
||||
}
|
||||
|
@ -153,7 +151,7 @@ func (m *meter) Int64Counter(name string, options ...instrument.Int64Option) (in
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) {
|
||||
func (m *meter) Int64UpDownCounter(name string, options ...metric.Int64UpDownCounterOption) (metric.Int64UpDownCounter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Int64UpDownCounter(name, options...)
|
||||
}
|
||||
|
@ -164,7 +162,7 @@ func (m *meter) Int64UpDownCounter(name string, options ...instrument.Int64Optio
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error) {
|
||||
func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOption) (metric.Int64Histogram, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Int64Histogram(name, options...)
|
||||
}
|
||||
|
@ -175,7 +173,7 @@ func (m *meter) Int64Histogram(name string, options ...instrument.Int64Option) (
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) {
|
||||
func (m *meter) Int64ObservableCounter(name string, options ...metric.Int64ObservableCounterOption) (metric.Int64ObservableCounter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Int64ObservableCounter(name, options...)
|
||||
}
|
||||
|
@ -186,7 +184,7 @@ func (m *meter) Int64ObservableCounter(name string, options ...instrument.Int64O
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) {
|
||||
func (m *meter) Int64ObservableUpDownCounter(name string, options ...metric.Int64ObservableUpDownCounterOption) (metric.Int64ObservableUpDownCounter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Int64ObservableUpDownCounter(name, options...)
|
||||
}
|
||||
|
@ -197,7 +195,7 @@ func (m *meter) Int64ObservableUpDownCounter(name string, options ...instrument.
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) {
|
||||
func (m *meter) Int64ObservableGauge(name string, options ...metric.Int64ObservableGaugeOption) (metric.Int64ObservableGauge, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Int64ObservableGauge(name, options...)
|
||||
}
|
||||
|
@ -208,7 +206,7 @@ func (m *meter) Int64ObservableGauge(name string, options ...instrument.Int64Obs
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error) {
|
||||
func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOption) (metric.Float64Counter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Float64Counter(name, options...)
|
||||
}
|
||||
|
@ -219,7 +217,7 @@ func (m *meter) Float64Counter(name string, options ...instrument.Float64Option)
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) {
|
||||
func (m *meter) Float64UpDownCounter(name string, options ...metric.Float64UpDownCounterOption) (metric.Float64UpDownCounter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Float64UpDownCounter(name, options...)
|
||||
}
|
||||
|
@ -230,7 +228,7 @@ func (m *meter) Float64UpDownCounter(name string, options ...instrument.Float64O
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error) {
|
||||
func (m *meter) Float64Histogram(name string, options ...metric.Float64HistogramOption) (metric.Float64Histogram, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Float64Histogram(name, options...)
|
||||
}
|
||||
|
@ -241,7 +239,7 @@ func (m *meter) Float64Histogram(name string, options ...instrument.Float64Optio
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) {
|
||||
func (m *meter) Float64ObservableCounter(name string, options ...metric.Float64ObservableCounterOption) (metric.Float64ObservableCounter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Float64ObservableCounter(name, options...)
|
||||
}
|
||||
|
@ -252,7 +250,7 @@ func (m *meter) Float64ObservableCounter(name string, options ...instrument.Floa
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) {
|
||||
func (m *meter) Float64ObservableUpDownCounter(name string, options ...metric.Float64ObservableUpDownCounterOption) (metric.Float64ObservableUpDownCounter, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Float64ObservableUpDownCounter(name, options...)
|
||||
}
|
||||
|
@ -263,7 +261,7 @@ func (m *meter) Float64ObservableUpDownCounter(name string, options ...instrumen
|
|||
return i, nil
|
||||
}
|
||||
|
||||
func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) {
|
||||
func (m *meter) Float64ObservableGauge(name string, options ...metric.Float64ObservableGaugeOption) (metric.Float64ObservableGauge, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
return del.Float64ObservableGauge(name, options...)
|
||||
}
|
||||
|
@ -275,7 +273,7 @@ func (m *meter) Float64ObservableGauge(name string, options ...instrument.Float6
|
|||
}
|
||||
|
||||
// RegisterCallback captures the function that will be called during Collect.
|
||||
func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchronous) (metric.Registration, error) {
|
||||
func (m *meter) RegisterCallback(f metric.Callback, insts ...metric.Observable) (metric.Registration, error) {
|
||||
if del, ok := m.delegate.Load().(metric.Meter); ok {
|
||||
insts = unwrapInstruments(insts)
|
||||
return del.RegisterCallback(f, insts...)
|
||||
|
@ -296,11 +294,11 @@ func (m *meter) RegisterCallback(f metric.Callback, insts ...instrument.Asynchro
|
|||
}
|
||||
|
||||
type wrapped interface {
|
||||
unwrap() instrument.Asynchronous
|
||||
unwrap() metric.Observable
|
||||
}
|
||||
|
||||
func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Asynchronous {
|
||||
out := make([]instrument.Asynchronous, 0, len(instruments))
|
||||
func unwrapInstruments(instruments []metric.Observable) []metric.Observable {
|
||||
out := make([]metric.Observable, 0, len(instruments))
|
||||
|
||||
for _, inst := range instruments {
|
||||
if in, ok := inst.(wrapped); ok {
|
||||
|
@ -314,7 +312,9 @@ func unwrapInstruments(instruments []instrument.Asynchronous) []instrument.Async
|
|||
}
|
||||
|
||||
type registration struct {
|
||||
instruments []instrument.Asynchronous
|
||||
embedded.Registration
|
||||
|
||||
instruments []metric.Observable
|
||||
function metric.Callback
|
||||
|
||||
unreg func() error
|
||||
|
@ -334,7 +334,7 @@ func (c *registration) setDelegate(m metric.Meter) {
|
|||
|
||||
reg, err := m.RegisterCallback(c.function, insts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
GetErrorHandler().Handle(err)
|
||||
}
|
||||
|
||||
c.unreg = reg.Unregister
|
45
vendor/go.opentelemetry.io/otel/internal/global/state.go
generated
vendored
45
vendor/go.opentelemetry.io/otel/internal/global/state.go
generated
vendored
|
@ -19,6 +19,7 @@ import (
|
|||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
@ -31,14 +32,20 @@ type (
|
|||
propagatorsHolder struct {
|
||||
tm propagation.TextMapPropagator
|
||||
}
|
||||
|
||||
meterProviderHolder struct {
|
||||
mp metric.MeterProvider
|
||||
}
|
||||
)
|
||||
|
||||
var (
|
||||
globalTracer = defaultTracerValue()
|
||||
globalPropagators = defaultPropagatorsValue()
|
||||
globalTracer = defaultTracerValue()
|
||||
globalPropagators = defaultPropagatorsValue()
|
||||
globalMeterProvider = defaultMeterProvider()
|
||||
|
||||
delegateTraceOnce sync.Once
|
||||
delegateTextMapPropagatorOnce sync.Once
|
||||
delegateMeterOnce sync.Once
|
||||
)
|
||||
|
||||
// TracerProvider is the internal implementation for global.TracerProvider.
|
||||
|
@ -102,6 +109,34 @@ func SetTextMapPropagator(p propagation.TextMapPropagator) {
|
|||
globalPropagators.Store(propagatorsHolder{tm: p})
|
||||
}
|
||||
|
||||
// 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.
|
||||
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 defaultTracerValue() *atomic.Value {
|
||||
v := &atomic.Value{}
|
||||
v.Store(tracerProviderHolder{tp: &tracerProvider{}})
|
||||
|
@ -113,3 +148,9 @@ func defaultPropagatorsValue() *atomic.Value {
|
|||
v.Store(propagatorsHolder{tm: newTextMapPropagator()})
|
||||
return v
|
||||
}
|
||||
|
||||
func defaultMeterProvider() *atomic.Value {
|
||||
v := &atomic.Value{}
|
||||
v.Store(meterProviderHolder{mp: &meterProvider{}})
|
||||
return v
|
||||
}
|
||||
|
|
53
vendor/go.opentelemetry.io/otel/metric.go
generated
vendored
Normal file
53
vendor/go.opentelemetry.io/otel/metric.go
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
// 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 otel // import "go.opentelemetry.io/otel"
|
||||
|
||||
import (
|
||||
"go.opentelemetry.io/otel/internal/global"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
)
|
||||
|
||||
// Meter returns a Meter from the global MeterProvider. The name 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 name is empty, then a implementation defined default name will be
|
||||
// used instead.
|
||||
//
|
||||
// If this is called before a global MeterProvider is registered the returned
|
||||
// Meter will be a No-op implementation of a Meter. When a global MeterProvider
|
||||
// is registered for the first time, the returned Meter, and all the
|
||||
// instruments it has created or will create, are recreated automatically from
|
||||
// the new MeterProvider.
|
||||
//
|
||||
// This is short for GetMeterProvider().Meter(name).
|
||||
func Meter(name string, opts ...metric.MeterOption) metric.Meter {
|
||||
return GetMeterProvider().Meter(name, opts...)
|
||||
}
|
||||
|
||||
// GetMeterProvider returns the registered global meter provider.
|
||||
//
|
||||
// If no global GetMeterProvider has been registered, a No-op GetMeterProvider
|
||||
// implementation is returned. When a global GetMeterProvider is registered for
|
||||
// the first time, the returned GetMeterProvider, and all the Meters it has
|
||||
// created or will create, are recreated automatically from the new
|
||||
// GetMeterProvider.
|
||||
func GetMeterProvider() metric.MeterProvider {
|
||||
return global.MeterProvider()
|
||||
}
|
||||
|
||||
// SetMeterProvider registers mp as the global MeterProvider.
|
||||
func SetMeterProvider(mp metric.MeterProvider) {
|
||||
global.SetMeterProvider(mp)
|
||||
}
|
271
vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go
generated
vendored
Normal file
271
vendor/go.opentelemetry.io/otel/metric/asyncfloat64.go
generated
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
// 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/embedded"
|
||||
)
|
||||
|
||||
// Float64Observable describes a set of instruments used asynchronously to
|
||||
// record float64 measurements once per collection cycle. Observations of
|
||||
// these instruments are only made within a callback.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases.
|
||||
type Float64Observable interface {
|
||||
Observable
|
||||
|
||||
float64Observable()
|
||||
}
|
||||
|
||||
// Float64ObservableCounter is an instrument used to asynchronously record
|
||||
// increasing float64 measurements once per collection cycle. Observations are
|
||||
// only made within a callback for this instrument. The value observed is
|
||||
// assumed the to be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for
|
||||
// unimplemented methods.
|
||||
type Float64ObservableCounter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64ObservableCounter
|
||||
|
||||
Float64Observable
|
||||
}
|
||||
|
||||
// Float64ObservableCounterConfig contains options for asynchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Float64ObservableCounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Float64Callback
|
||||
}
|
||||
|
||||
// NewFloat64ObservableCounterConfig returns a new
|
||||
// [Float64ObservableCounterConfig] with all opts applied.
|
||||
func NewFloat64ObservableCounterConfig(opts ...Float64ObservableCounterOption) Float64ObservableCounterConfig {
|
||||
var config Float64ObservableCounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64ObservableCounter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Float64ObservableCounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Float64ObservableCounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the configured callbacks.
|
||||
func (c Float64ObservableCounterConfig) Callbacks() []Float64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Float64ObservableCounterOption applies options to a
|
||||
// [Float64ObservableCounterConfig]. See [Float64ObservableOption] and
|
||||
// [InstrumentOption] for other options that can be used as a
|
||||
// Float64ObservableCounterOption.
|
||||
type Float64ObservableCounterOption interface {
|
||||
applyFloat64ObservableCounter(Float64ObservableCounterConfig) Float64ObservableCounterConfig
|
||||
}
|
||||
|
||||
// Float64ObservableUpDownCounter is an instrument used to asynchronously
|
||||
// record float64 measurements once per collection cycle. Observations are only
|
||||
// made within a callback for this instrument. The value observed is assumed
|
||||
// the to be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Float64ObservableUpDownCounter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64ObservableUpDownCounter
|
||||
|
||||
Float64Observable
|
||||
}
|
||||
|
||||
// Float64ObservableUpDownCounterConfig contains options for asynchronous
|
||||
// counter instruments that record int64 values.
|
||||
type Float64ObservableUpDownCounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Float64Callback
|
||||
}
|
||||
|
||||
// NewFloat64ObservableUpDownCounterConfig returns a new
|
||||
// [Float64ObservableUpDownCounterConfig] with all opts applied.
|
||||
func NewFloat64ObservableUpDownCounterConfig(opts ...Float64ObservableUpDownCounterOption) Float64ObservableUpDownCounterConfig {
|
||||
var config Float64ObservableUpDownCounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64ObservableUpDownCounter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Float64ObservableUpDownCounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Float64ObservableUpDownCounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the configured callbacks.
|
||||
func (c Float64ObservableUpDownCounterConfig) Callbacks() []Float64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Float64ObservableUpDownCounterOption applies options to a
|
||||
// [Float64ObservableUpDownCounterConfig]. See [Float64ObservableOption] and
|
||||
// [InstrumentOption] for other options that can be used as a
|
||||
// Float64ObservableUpDownCounterOption.
|
||||
type Float64ObservableUpDownCounterOption interface {
|
||||
applyFloat64ObservableUpDownCounter(Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig
|
||||
}
|
||||
|
||||
// Float64ObservableGauge is an instrument used to asynchronously record
|
||||
// instantaneous float64 measurements once per collection cycle. Observations
|
||||
// are only made within a callback for this instrument.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Float64ObservableGauge interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64ObservableGauge
|
||||
|
||||
Float64Observable
|
||||
}
|
||||
|
||||
// Float64ObservableGaugeConfig contains options for asynchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Float64ObservableGaugeConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Float64Callback
|
||||
}
|
||||
|
||||
// NewFloat64ObservableGaugeConfig returns a new [Float64ObservableGaugeConfig]
|
||||
// with all opts applied.
|
||||
func NewFloat64ObservableGaugeConfig(opts ...Float64ObservableGaugeOption) Float64ObservableGaugeConfig {
|
||||
var config Float64ObservableGaugeConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64ObservableGauge(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Float64ObservableGaugeConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Float64ObservableGaugeConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the configured callbacks.
|
||||
func (c Float64ObservableGaugeConfig) Callbacks() []Float64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Float64ObservableGaugeOption applies options to a
|
||||
// [Float64ObservableGaugeConfig]. See [Float64ObservableOption] and
|
||||
// [InstrumentOption] for other options that can be used as a
|
||||
// Float64ObservableGaugeOption.
|
||||
type Float64ObservableGaugeOption interface {
|
||||
applyFloat64ObservableGauge(Float64ObservableGaugeConfig) Float64ObservableGaugeConfig
|
||||
}
|
||||
|
||||
// Float64Observer is a recorder of float64 measurements.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Float64Observer interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64Observer
|
||||
|
||||
// Observe records the float64 value.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Observe(value float64, options ...ObserveOption)
|
||||
}
|
||||
|
||||
// Float64Callback is a function registered with a Meter that makes
|
||||
// observations for a Float64Observerable instrument it is registered with.
|
||||
// Calls to the Float64Observer record measurement values for the
|
||||
// Float64Observable.
|
||||
//
|
||||
// The function needs to complete in a finite amount of time and the deadline
|
||||
// of the passed context is expected to be honored.
|
||||
//
|
||||
// The function needs to make unique observations across all registered
|
||||
// Float64Callbacks. Meaning, it should not report measurements with the same
|
||||
// attributes as another Float64Callbacks also registered for the same
|
||||
// instrument.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
type Float64Callback func(context.Context, Float64Observer) error
|
||||
|
||||
// Float64ObservableOption applies options to float64 Observer instruments.
|
||||
type Float64ObservableOption interface {
|
||||
Float64ObservableCounterOption
|
||||
Float64ObservableUpDownCounterOption
|
||||
Float64ObservableGaugeOption
|
||||
}
|
||||
|
||||
type float64CallbackOpt struct {
|
||||
cback Float64Callback
|
||||
}
|
||||
|
||||
func (o float64CallbackOpt) applyFloat64ObservableCounter(cfg Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, o.cback)
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (o float64CallbackOpt) applyFloat64ObservableUpDownCounter(cfg Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, o.cback)
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (o float64CallbackOpt) applyFloat64ObservableGauge(cfg Float64ObservableGaugeConfig) Float64ObservableGaugeConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, o.cback)
|
||||
return cfg
|
||||
}
|
||||
|
||||
// WithFloat64Callback adds callback to be called for an instrument.
|
||||
func WithFloat64Callback(callback Float64Callback) Float64ObservableOption {
|
||||
return float64CallbackOpt{callback}
|
||||
}
|
269
vendor/go.opentelemetry.io/otel/metric/asyncint64.go
generated
vendored
Normal file
269
vendor/go.opentelemetry.io/otel/metric/asyncint64.go
generated
vendored
Normal file
|
@ -0,0 +1,269 @@
|
|||
// 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/embedded"
|
||||
)
|
||||
|
||||
// Int64Observable describes a set of instruments used asynchronously to record
|
||||
// int64 measurements once per collection cycle. Observations of these
|
||||
// instruments are only made within a callback.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases.
|
||||
type Int64Observable interface {
|
||||
Observable
|
||||
|
||||
int64Observable()
|
||||
}
|
||||
|
||||
// Int64ObservableCounter is an instrument used to asynchronously record
|
||||
// increasing int64 measurements once per collection cycle. Observations are
|
||||
// only made within a callback for this instrument. The value observed is
|
||||
// assumed the to be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64ObservableCounter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64ObservableCounter
|
||||
|
||||
Int64Observable
|
||||
}
|
||||
|
||||
// Int64ObservableCounterConfig contains options for asynchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Int64ObservableCounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Int64Callback
|
||||
}
|
||||
|
||||
// NewInt64ObservableCounterConfig returns a new [Int64ObservableCounterConfig]
|
||||
// with all opts applied.
|
||||
func NewInt64ObservableCounterConfig(opts ...Int64ObservableCounterOption) Int64ObservableCounterConfig {
|
||||
var config Int64ObservableCounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64ObservableCounter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Int64ObservableCounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Int64ObservableCounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the configured callbacks.
|
||||
func (c Int64ObservableCounterConfig) Callbacks() []Int64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Int64ObservableCounterOption applies options to a
|
||||
// [Int64ObservableCounterConfig]. See [Int64ObservableOption] and
|
||||
// [InstrumentOption] for other options that can be used as an
|
||||
// Int64ObservableCounterOption.
|
||||
type Int64ObservableCounterOption interface {
|
||||
applyInt64ObservableCounter(Int64ObservableCounterConfig) Int64ObservableCounterConfig
|
||||
}
|
||||
|
||||
// Int64ObservableUpDownCounter is an instrument used to asynchronously record
|
||||
// int64 measurements once per collection cycle. Observations are only made
|
||||
// within a callback for this instrument. The value observed is assumed the to
|
||||
// be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64ObservableUpDownCounter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64ObservableUpDownCounter
|
||||
|
||||
Int64Observable
|
||||
}
|
||||
|
||||
// Int64ObservableUpDownCounterConfig contains options for asynchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Int64ObservableUpDownCounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Int64Callback
|
||||
}
|
||||
|
||||
// NewInt64ObservableUpDownCounterConfig returns a new
|
||||
// [Int64ObservableUpDownCounterConfig] with all opts applied.
|
||||
func NewInt64ObservableUpDownCounterConfig(opts ...Int64ObservableUpDownCounterOption) Int64ObservableUpDownCounterConfig {
|
||||
var config Int64ObservableUpDownCounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64ObservableUpDownCounter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Int64ObservableUpDownCounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Int64ObservableUpDownCounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the configured callbacks.
|
||||
func (c Int64ObservableUpDownCounterConfig) Callbacks() []Int64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Int64ObservableUpDownCounterOption applies options to a
|
||||
// [Int64ObservableUpDownCounterConfig]. See [Int64ObservableOption] and
|
||||
// [InstrumentOption] for other options that can be used as an
|
||||
// Int64ObservableUpDownCounterOption.
|
||||
type Int64ObservableUpDownCounterOption interface {
|
||||
applyInt64ObservableUpDownCounter(Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig
|
||||
}
|
||||
|
||||
// Int64ObservableGauge is an instrument used to asynchronously record
|
||||
// instantaneous int64 measurements once per collection cycle. Observations are
|
||||
// only made within a callback for this instrument.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64ObservableGauge interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64ObservableGauge
|
||||
|
||||
Int64Observable
|
||||
}
|
||||
|
||||
// Int64ObservableGaugeConfig contains options for asynchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Int64ObservableGaugeConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Int64Callback
|
||||
}
|
||||
|
||||
// NewInt64ObservableGaugeConfig returns a new [Int64ObservableGaugeConfig]
|
||||
// with all opts applied.
|
||||
func NewInt64ObservableGaugeConfig(opts ...Int64ObservableGaugeOption) Int64ObservableGaugeConfig {
|
||||
var config Int64ObservableGaugeConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64ObservableGauge(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Int64ObservableGaugeConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Int64ObservableGaugeConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the configured callbacks.
|
||||
func (c Int64ObservableGaugeConfig) Callbacks() []Int64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Int64ObservableGaugeOption applies options to a
|
||||
// [Int64ObservableGaugeConfig]. See [Int64ObservableOption] and
|
||||
// [InstrumentOption] for other options that can be used as an
|
||||
// Int64ObservableGaugeOption.
|
||||
type Int64ObservableGaugeOption interface {
|
||||
applyInt64ObservableGauge(Int64ObservableGaugeConfig) Int64ObservableGaugeConfig
|
||||
}
|
||||
|
||||
// Int64Observer is a recorder of int64 measurements.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64Observer interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64Observer
|
||||
|
||||
// Observe records the int64 value.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Observe(value int64, options ...ObserveOption)
|
||||
}
|
||||
|
||||
// Int64Callback is a function registered with a Meter that makes observations
|
||||
// for an Int64Observerable instrument it is registered with. Calls to the
|
||||
// Int64Observer record measurement values for the Int64Observable.
|
||||
//
|
||||
// The function needs to complete in a finite amount of time and the deadline
|
||||
// of the passed context is expected to be honored.
|
||||
//
|
||||
// The function needs to make unique observations across all registered
|
||||
// Int64Callbacks. Meaning, it should not report measurements with the same
|
||||
// attributes as another Int64Callbacks also registered for the same
|
||||
// instrument.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
type Int64Callback func(context.Context, Int64Observer) error
|
||||
|
||||
// Int64ObservableOption applies options to int64 Observer instruments.
|
||||
type Int64ObservableOption interface {
|
||||
Int64ObservableCounterOption
|
||||
Int64ObservableUpDownCounterOption
|
||||
Int64ObservableGaugeOption
|
||||
}
|
||||
|
||||
type int64CallbackOpt struct {
|
||||
cback Int64Callback
|
||||
}
|
||||
|
||||
func (o int64CallbackOpt) applyInt64ObservableCounter(cfg Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, o.cback)
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (o int64CallbackOpt) applyInt64ObservableUpDownCounter(cfg Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, o.cback)
|
||||
return cfg
|
||||
}
|
||||
|
||||
func (o int64CallbackOpt) applyInt64ObservableGauge(cfg Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, o.cback)
|
||||
return cfg
|
||||
}
|
||||
|
||||
// WithInt64Callback adds callback to be called for an instrument.
|
||||
func WithInt64Callback(callback Int64Callback) Int64ObservableOption {
|
||||
return int64CallbackOpt{callback}
|
||||
}
|
157
vendor/go.opentelemetry.io/otel/metric/doc.go
generated
vendored
157
vendor/go.opentelemetry.io/otel/metric/doc.go
generated
vendored
|
@ -13,11 +13,158 @@
|
|||
// limitations under the License.
|
||||
|
||||
/*
|
||||
Package metric provides an implementation of the metrics part of the
|
||||
OpenTelemetry API.
|
||||
Package metric provides the OpenTelemetry API used to measure metrics about
|
||||
source code operation.
|
||||
|
||||
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.
|
||||
This API is separate from its implementation so the instrumentation built from
|
||||
it is reusable. See [go.opentelemetry.io/otel/sdk/metric] for the official
|
||||
OpenTelemetry implementation of this API.
|
||||
|
||||
All measurements made with this package are made via instruments. These
|
||||
instruments are created by a [Meter] which itself is created by a
|
||||
[MeterProvider]. Applications need to accept a [MeterProvider] implementation
|
||||
as a starting point when instrumenting. This can be done directly, or by using
|
||||
the OpenTelemetry global MeterProvider via [GetMeterProvider]. Using an
|
||||
appropriately named [Meter] from the accepted [MeterProvider], instrumentation
|
||||
can then be built from the [Meter]'s instruments.
|
||||
|
||||
# Instruments
|
||||
|
||||
Each instrument is designed to make measurements of a particular type. Broadly,
|
||||
all instruments fall into two overlapping logical categories: asynchronous or
|
||||
synchronous, and int64 or float64.
|
||||
|
||||
All synchronous instruments ([Int64Counter], [Int64UpDownCounter],
|
||||
[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and
|
||||
[Float64Histogram]) are used to measure the operation and performance of source
|
||||
code during the source code execution. These instruments only make measurements
|
||||
when the source code they instrument is run.
|
||||
|
||||
All asynchronous instruments ([Int64ObservableCounter],
|
||||
[Int64ObservableUpDownCounter], [Int64ObservableGauge],
|
||||
[Float64ObservableCounter], [Float64ObservableUpDownCounter], and
|
||||
[Float64ObservableGauge]) are used to measure metrics outside of the execution
|
||||
of source code. They are said to make "observations" via a callback function
|
||||
called once every measurement collection cycle.
|
||||
|
||||
Each instrument is also grouped by the value type it measures. Either int64 or
|
||||
float64. The value being measured will dictate which instrument in these
|
||||
categories to use.
|
||||
|
||||
Outside of these two broad categories, instruments are described by the
|
||||
function they are designed to serve. All Counters ([Int64Counter],
|
||||
[Float64Counter], [Int64ObservableCounter], and [Float64ObservableCounter]) are
|
||||
designed to measure values that never decrease in value, but instead only
|
||||
incrementally increase in value. UpDownCounters ([Int64UpDownCounter],
|
||||
[Float64UpDownCounter], [Int64ObservableUpDownCounter], and
|
||||
[Float64ObservableUpDownCounter]) on the other hand, are designed to measure
|
||||
values that can increase and decrease. When more information needs to be
|
||||
conveyed about all the synchronous measurements made during a collection cycle,
|
||||
a Histogram ([Int64Histogram] and [Float64Histogram]) should be used. Finally,
|
||||
when just the most recent measurement needs to be conveyed about an
|
||||
asynchronous measurement, a Gauge ([Int64ObservableGauge] and
|
||||
[Float64ObservableGauge]) should be used.
|
||||
|
||||
See the [OpenTelemetry documentation] for more information about instruments
|
||||
and their intended use.
|
||||
|
||||
# Measurements
|
||||
|
||||
Measurements are made by recording values and information about the values with
|
||||
an instrument. How these measurements are recorded depends on the instrument.
|
||||
|
||||
Measurements for synchronous instruments ([Int64Counter], [Int64UpDownCounter],
|
||||
[Int64Histogram], [Float64Counter], [Float64UpDownCounter], and
|
||||
[Float64Histogram]) are recorded using the instrument methods directly. All
|
||||
counter instruments have an Add method that is used to measure an increment
|
||||
value, and all histogram instruments have a Record method to measure a data
|
||||
point.
|
||||
|
||||
Asynchronous instruments ([Int64ObservableCounter],
|
||||
[Int64ObservableUpDownCounter], [Int64ObservableGauge],
|
||||
[Float64ObservableCounter], [Float64ObservableUpDownCounter], and
|
||||
[Float64ObservableGauge]) record measurements within a callback function. The
|
||||
callback is registered with the Meter which ensures the callback is called once
|
||||
per collection cycle. A callback can be registered two ways: during the
|
||||
instrument's creation using an option, or later using the RegisterCallback
|
||||
method of the [Meter] that created the instrument.
|
||||
|
||||
If the following criteria are met, an option ([WithInt64Callback] or
|
||||
[WithFloat64Callback]) can be used during the asynchronous instrument's
|
||||
creation to register a callback ([Int64Callback] or [Float64Callback],
|
||||
respectively):
|
||||
|
||||
- The measurement process is known when the instrument is created
|
||||
- Only that instrument will make a measurement within the callback
|
||||
- The callback never needs to be unregistered
|
||||
|
||||
If the criteria are not met, use the RegisterCallback method of the [Meter] that
|
||||
created the instrument to register a [Callback].
|
||||
|
||||
# API Implementations
|
||||
|
||||
This package does not conform to the standard Go versioning policy, all of its
|
||||
interfaces may have methods added to them without a package major version bump.
|
||||
This non-standard API evolution could surprise an uninformed implementation
|
||||
author. They could unknowingly build their implementation in a way that would
|
||||
result in a runtime panic for their users that update to the new API.
|
||||
|
||||
The API is designed to help inform an instrumentation author about this
|
||||
non-standard API evolution. It requires them to choose a default behavior for
|
||||
unimplemented interface methods. There are three behavior choices they can
|
||||
make:
|
||||
|
||||
- Compilation failure
|
||||
- Panic
|
||||
- Default to another implementation
|
||||
|
||||
All interfaces in this API embed a corresponding interface from
|
||||
[go.opentelemetry.io/otel/metric/embedded]. If an author wants the default
|
||||
behavior of their implementations to be a compilation failure, signaling to
|
||||
their users they need to update to the latest version of that implementation,
|
||||
they need to embed the corresponding interface from
|
||||
[go.opentelemetry.io/otel/metric/embedded] in their implementation. For
|
||||
example,
|
||||
|
||||
import "go.opentelemetry.io/otel/metric/embedded"
|
||||
|
||||
type MeterProvider struct {
|
||||
embedded.MeterProvider
|
||||
// ...
|
||||
}
|
||||
|
||||
If an author wants the default behavior of their implementations to a panic,
|
||||
they need to embed the API interface directly.
|
||||
|
||||
import "go.opentelemetry.io/otel/metric"
|
||||
|
||||
type MeterProvider struct {
|
||||
metric.MeterProvider
|
||||
// ...
|
||||
}
|
||||
|
||||
This is not a recommended behavior as it could lead to publishing packages that
|
||||
contain runtime panics when users update other package that use newer versions
|
||||
of [go.opentelemetry.io/otel/metric].
|
||||
|
||||
Finally, an author can embed another implementation in theirs. The embedded
|
||||
implementation will be used for methods not defined by the author. For example,
|
||||
an author who want to default to silently dropping the call can use
|
||||
[go.opentelemetry.io/otel/metric/noop]:
|
||||
|
||||
import "go.opentelemetry.io/otel/metric/noop"
|
||||
|
||||
type MeterProvider struct {
|
||||
noop.MeterProvider
|
||||
// ...
|
||||
}
|
||||
|
||||
It is strongly recommended that authors only embed
|
||||
[go.opentelemetry.io/otel/metric/noop] if they choose this default behavior.
|
||||
That implementation is the only one OpenTelemetry authors can guarantee will
|
||||
fully implement all the API interfaces when a user updates their API.
|
||||
|
||||
[OpenTelemetry documentation]: https://opentelemetry.io/docs/concepts/signals/metrics/
|
||||
[GetMeterProvider]: https://pkg.go.dev/go.opentelemetry.io/otel#GetMeterProvider
|
||||
*/
|
||||
package metric // import "go.opentelemetry.io/otel/metric"
|
||||
|
|
234
vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go
generated
vendored
Normal file
234
vendor/go.opentelemetry.io/otel/metric/embedded/embedded.go
generated
vendored
Normal file
|
@ -0,0 +1,234 @@
|
|||
// 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 embedded provides interfaces embedded within the [OpenTelemetry
|
||||
// metric API].
|
||||
//
|
||||
// Implementers of the [OpenTelemetry metric API] can embed the relevant type
|
||||
// from this package into their implementation directly. Doing so will result
|
||||
// in a compilation error for users when the [OpenTelemetry metric API] is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
//
|
||||
// [OpenTelemetry metric API]: https://pkg.go.dev/go.opentelemetry.io/otel/metric
|
||||
package embedded // import "go.opentelemetry.io/otel/metric/embedded"
|
||||
|
||||
// MeterProvider is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.MeterProvider].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.MeterProvider] if you want users to
|
||||
// experience a compilation error, signaling they need to update to your latest
|
||||
// implementation, when the [go.opentelemetry.io/otel/metric.MeterProvider]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type MeterProvider interface{ meterProvider() }
|
||||
|
||||
// Meter is embedded in [go.opentelemetry.io/otel/metric.Meter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Meter] if you want users to experience a
|
||||
// compilation error, signaling they need to update to your latest
|
||||
// implementation, when the [go.opentelemetry.io/otel/metric.Meter] interface
|
||||
// is extended (which is something that can happen without a major version bump
|
||||
// of the API package).
|
||||
type Meter interface{ meter() }
|
||||
|
||||
// Float64Observer is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64Observer].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64Observer] if you want
|
||||
// users to experience a compilation error, signaling they need to update to
|
||||
// your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64Observer] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Float64Observer interface{ float64Observer() }
|
||||
|
||||
// Int64Observer is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64Observer].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64Observer] if you want users
|
||||
// to experience a compilation error, signaling they need to update to your
|
||||
// latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64Observer] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Int64Observer interface{ int64Observer() }
|
||||
|
||||
// Observer is embedded in [go.opentelemetry.io/otel/metric.Observer].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Observer] if you want users to experience a
|
||||
// compilation error, signaling they need to update to your latest
|
||||
// implementation, when the [go.opentelemetry.io/otel/metric.Observer]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Observer interface{ observer() }
|
||||
|
||||
// Registration is embedded in [go.opentelemetry.io/otel/metric.Registration].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Registration] if you want users to
|
||||
// experience a compilation error, signaling they need to update to your latest
|
||||
// implementation, when the [go.opentelemetry.io/otel/metric.Registration]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Registration interface{ registration() }
|
||||
|
||||
// Float64Counter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64Counter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64Counter] if you want
|
||||
// users to experience a compilation error, signaling they need to update to
|
||||
// your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64Counter] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Float64Counter interface{ float64Counter() }
|
||||
|
||||
// Float64Histogram is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64Histogram].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64Histogram] if you want
|
||||
// users to experience a compilation error, signaling they need to update to
|
||||
// your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64Histogram] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Float64Histogram interface{ float64Histogram() }
|
||||
|
||||
// Float64ObservableCounter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableCounter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableCounter] if you
|
||||
// want users to experience a compilation error, signaling they need to update
|
||||
// to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableCounter]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Float64ObservableCounter interface{ float64ObservableCounter() }
|
||||
|
||||
// Float64ObservableGauge is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableGauge].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableGauge] if you
|
||||
// want users to experience a compilation error, signaling they need to update
|
||||
// to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableGauge]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Float64ObservableGauge interface{ float64ObservableGauge() }
|
||||
|
||||
// Float64ObservableUpDownCounter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]
|
||||
// if you want users to experience a compilation error, signaling they need to
|
||||
// update to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64ObservableUpDownCounter]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Float64ObservableUpDownCounter interface{ float64ObservableUpDownCounter() }
|
||||
|
||||
// Float64UpDownCounter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Float64UpDownCounter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] if you
|
||||
// want users to experience a compilation error, signaling they need to update
|
||||
// to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Float64UpDownCounter] interface
|
||||
// is extended (which is something that can happen without a major version bump
|
||||
// of the API package).
|
||||
type Float64UpDownCounter interface{ float64UpDownCounter() }
|
||||
|
||||
// Int64Counter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64Counter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64Counter] if you want users
|
||||
// to experience a compilation error, signaling they need to update to your
|
||||
// latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64Counter] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Int64Counter interface{ int64Counter() }
|
||||
|
||||
// Int64Histogram is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64Histogram].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64Histogram] if you want
|
||||
// users to experience a compilation error, signaling they need to update to
|
||||
// your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64Histogram] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Int64Histogram interface{ int64Histogram() }
|
||||
|
||||
// Int64ObservableCounter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableCounter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableCounter] if you
|
||||
// want users to experience a compilation error, signaling they need to update
|
||||
// to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableCounter]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Int64ObservableCounter interface{ int64ObservableCounter() }
|
||||
|
||||
// Int64ObservableGauge is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableGauge].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] if you
|
||||
// want users to experience a compilation error, signaling they need to update
|
||||
// to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableGauge] interface
|
||||
// is extended (which is something that can happen without a major version bump
|
||||
// of the API package).
|
||||
type Int64ObservableGauge interface{ int64ObservableGauge() }
|
||||
|
||||
// Int64ObservableUpDownCounter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter] if
|
||||
// you want users to experience a compilation error, signaling they need to
|
||||
// update to your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64ObservableUpDownCounter]
|
||||
// interface is extended (which is something that can happen without a major
|
||||
// version bump of the API package).
|
||||
type Int64ObservableUpDownCounter interface{ int64ObservableUpDownCounter() }
|
||||
|
||||
// Int64UpDownCounter is embedded in
|
||||
// [go.opentelemetry.io/otel/metric.Int64UpDownCounter].
|
||||
//
|
||||
// Embed this interface in your implementation of the
|
||||
// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] if you want
|
||||
// users to experience a compilation error, signaling they need to update to
|
||||
// your latest implementation, when the
|
||||
// [go.opentelemetry.io/otel/metric.Int64UpDownCounter] interface is
|
||||
// extended (which is something that can happen without a major version bump of
|
||||
// the API package).
|
||||
type Int64UpDownCounter interface{ int64UpDownCounter() }
|
42
vendor/go.opentelemetry.io/otel/metric/global/global.go
generated
vendored
42
vendor/go.opentelemetry.io/otel/metric/global/global.go
generated
vendored
|
@ -1,42 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package 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 meter 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)
|
||||
}
|
332
vendor/go.opentelemetry.io/otel/metric/instrument.go
generated
vendored
Normal file
332
vendor/go.opentelemetry.io/otel/metric/instrument.go
generated
vendored
Normal file
|
@ -0,0 +1,332 @@
|
|||
// 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 "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
// Observable is used as a grouping mechanism for all instruments that are
|
||||
// updated within a Callback.
|
||||
type Observable interface {
|
||||
observable()
|
||||
}
|
||||
|
||||
// InstrumentOption applies options to all instruments.
|
||||
type InstrumentOption interface {
|
||||
Int64CounterOption
|
||||
Int64UpDownCounterOption
|
||||
Int64HistogramOption
|
||||
Int64ObservableCounterOption
|
||||
Int64ObservableUpDownCounterOption
|
||||
Int64ObservableGaugeOption
|
||||
|
||||
Float64CounterOption
|
||||
Float64UpDownCounterOption
|
||||
Float64HistogramOption
|
||||
Float64ObservableCounterOption
|
||||
Float64ObservableUpDownCounterOption
|
||||
Float64ObservableGaugeOption
|
||||
}
|
||||
|
||||
type descOpt string
|
||||
|
||||
func (o descOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
// WithDescription sets the instrument description.
|
||||
func WithDescription(desc string) InstrumentOption { return descOpt(desc) }
|
||||
|
||||
type unitOpt string
|
||||
|
||||
func (o unitOpt) applyFloat64Counter(c Float64CounterConfig) Float64CounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyFloat64UpDownCounter(c Float64UpDownCounterConfig) Float64UpDownCounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyFloat64Histogram(c Float64HistogramConfig) Float64HistogramConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyFloat64ObservableCounter(c Float64ObservableCounterConfig) Float64ObservableCounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyFloat64ObservableUpDownCounter(c Float64ObservableUpDownCounterConfig) Float64ObservableUpDownCounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyFloat64ObservableGauge(c Float64ObservableGaugeConfig) Float64ObservableGaugeConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64Counter(c Int64CounterConfig) Int64CounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64UpDownCounter(c Int64UpDownCounterConfig) Int64UpDownCounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64Histogram(c Int64HistogramConfig) Int64HistogramConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64ObservableCounter(c Int64ObservableCounterConfig) Int64ObservableCounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64ObservableUpDownCounter(c Int64ObservableUpDownCounterConfig) Int64ObservableUpDownCounterConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64ObservableGaugeConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
// WithUnit sets the instrument unit.
|
||||
func WithUnit(u string) InstrumentOption { return unitOpt(u) }
|
||||
|
||||
// AddOption applies options to an addition measurement. See
|
||||
// [MeasurementOption] for other options that can be used as an AddOption.
|
||||
type AddOption interface {
|
||||
applyAdd(AddConfig) AddConfig
|
||||
}
|
||||
|
||||
// AddConfig contains options for an addition measurement.
|
||||
type AddConfig struct {
|
||||
attrs attribute.Set
|
||||
}
|
||||
|
||||
// NewAddConfig returns a new [AddConfig] with all opts applied.
|
||||
func NewAddConfig(opts []AddOption) AddConfig {
|
||||
config := AddConfig{attrs: *attribute.EmptySet()}
|
||||
for _, o := range opts {
|
||||
config = o.applyAdd(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Attributes returns the configured attribute set.
|
||||
func (c AddConfig) Attributes() attribute.Set {
|
||||
return c.attrs
|
||||
}
|
||||
|
||||
// RecordOption applies options to an addition measurement. See
|
||||
// [MeasurementOption] for other options that can be used as a RecordOption.
|
||||
type RecordOption interface {
|
||||
applyRecord(RecordConfig) RecordConfig
|
||||
}
|
||||
|
||||
// RecordConfig contains options for a recorded measurement.
|
||||
type RecordConfig struct {
|
||||
attrs attribute.Set
|
||||
}
|
||||
|
||||
// NewRecordConfig returns a new [RecordConfig] with all opts applied.
|
||||
func NewRecordConfig(opts []RecordOption) RecordConfig {
|
||||
config := RecordConfig{attrs: *attribute.EmptySet()}
|
||||
for _, o := range opts {
|
||||
config = o.applyRecord(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Attributes returns the configured attribute set.
|
||||
func (c RecordConfig) Attributes() attribute.Set {
|
||||
return c.attrs
|
||||
}
|
||||
|
||||
// ObserveOption applies options to an addition measurement. See
|
||||
// [MeasurementOption] for other options that can be used as a ObserveOption.
|
||||
type ObserveOption interface {
|
||||
applyObserve(ObserveConfig) ObserveConfig
|
||||
}
|
||||
|
||||
// ObserveConfig contains options for an observed measurement.
|
||||
type ObserveConfig struct {
|
||||
attrs attribute.Set
|
||||
}
|
||||
|
||||
// NewObserveConfig returns a new [ObserveConfig] with all opts applied.
|
||||
func NewObserveConfig(opts []ObserveOption) ObserveConfig {
|
||||
config := ObserveConfig{attrs: *attribute.EmptySet()}
|
||||
for _, o := range opts {
|
||||
config = o.applyObserve(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Attributes returns the configured attribute set.
|
||||
func (c ObserveConfig) Attributes() attribute.Set {
|
||||
return c.attrs
|
||||
}
|
||||
|
||||
// MeasurementOption applies options to all instrument measurement.
|
||||
type MeasurementOption interface {
|
||||
AddOption
|
||||
RecordOption
|
||||
ObserveOption
|
||||
}
|
||||
|
||||
type attrOpt struct {
|
||||
set attribute.Set
|
||||
}
|
||||
|
||||
// mergeSets returns the union of keys between a and b. Any duplicate keys will
|
||||
// use the value associated with b.
|
||||
func mergeSets(a, b attribute.Set) attribute.Set {
|
||||
// NewMergeIterator uses the first value for any duplicates.
|
||||
iter := attribute.NewMergeIterator(&b, &a)
|
||||
merged := make([]attribute.KeyValue, 0, a.Len()+b.Len())
|
||||
for iter.Next() {
|
||||
merged = append(merged, iter.Attribute())
|
||||
}
|
||||
return attribute.NewSet(merged...)
|
||||
}
|
||||
|
||||
func (o attrOpt) applyAdd(c AddConfig) AddConfig {
|
||||
switch {
|
||||
case o.set.Len() == 0:
|
||||
case c.attrs.Len() == 0:
|
||||
c.attrs = o.set
|
||||
default:
|
||||
c.attrs = mergeSets(c.attrs, o.set)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func (o attrOpt) applyRecord(c RecordConfig) RecordConfig {
|
||||
switch {
|
||||
case o.set.Len() == 0:
|
||||
case c.attrs.Len() == 0:
|
||||
c.attrs = o.set
|
||||
default:
|
||||
c.attrs = mergeSets(c.attrs, o.set)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func (o attrOpt) applyObserve(c ObserveConfig) ObserveConfig {
|
||||
switch {
|
||||
case o.set.Len() == 0:
|
||||
case c.attrs.Len() == 0:
|
||||
c.attrs = o.set
|
||||
default:
|
||||
c.attrs = mergeSets(c.attrs, o.set)
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
// WithAttributeSet sets the attribute Set associated with a measurement is
|
||||
// made with.
|
||||
//
|
||||
// If multiple WithAttributeSet or WithAttributes options are passed the
|
||||
// attributes will be merged together in the order they are passed. Attributes
|
||||
// with duplicate keys will use the last value passed.
|
||||
func WithAttributeSet(attributes attribute.Set) MeasurementOption {
|
||||
return attrOpt{set: attributes}
|
||||
}
|
||||
|
||||
// WithAttributes converts attributes into an attribute Set and sets the Set to
|
||||
// be associated with a measurement. This is shorthand for:
|
||||
//
|
||||
// cp := make([]attribute.KeyValue, len(attributes))
|
||||
// copy(cp, attributes)
|
||||
// WithAttributes(attribute.NewSet(cp...))
|
||||
//
|
||||
// [attribute.NewSet] may modify the passed attributes so this will make a copy
|
||||
// of attributes before creating a set in order to ensure this function is
|
||||
// concurrent safe. This makes this option function less optimized in
|
||||
// comparison to [WithAttributeSet]. Therefore, [WithAttributeSet] should be
|
||||
// preferred for performance sensitive code.
|
||||
//
|
||||
// See [WithAttributeSet] for information about how multiple WithAttributes are
|
||||
// merged.
|
||||
func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption {
|
||||
cp := make([]attribute.KeyValue, len(attributes))
|
||||
copy(cp, attributes)
|
||||
return attrOpt{set: attribute.NewSet(cp...)}
|
||||
}
|
130
vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64.go
generated
vendored
130
vendor/go.opentelemetry.io/otel/metric/instrument/asyncfloat64.go
generated
vendored
|
@ -1,130 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package instrument // import "go.opentelemetry.io/otel/metric/instrument"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// Float64Observable describes a set of instruments used asynchronously to
|
||||
// record float64 measurements once per collection cycle. Observations of
|
||||
// these instruments are only made within a callback.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64Observable interface {
|
||||
Asynchronous
|
||||
|
||||
float64Observable()
|
||||
}
|
||||
|
||||
// Float64ObservableCounter is an instrument used to asynchronously record
|
||||
// increasing float64 measurements once per collection cycle. Observations are
|
||||
// only made within a callback for this instrument. The value observed is
|
||||
// assumed the to be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64ObservableCounter interface{ Float64Observable }
|
||||
|
||||
// Float64ObservableUpDownCounter is an instrument used to asynchronously
|
||||
// record float64 measurements once per collection cycle. Observations are only
|
||||
// made within a callback for this instrument. The value observed is assumed
|
||||
// the to be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64ObservableUpDownCounter interface{ Float64Observable }
|
||||
|
||||
// Float64ObservableGauge is an instrument used to asynchronously record
|
||||
// instantaneous float64 measurements once per collection cycle. Observations
|
||||
// are only made within a callback for this instrument.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64ObservableGauge interface{ Float64Observable }
|
||||
|
||||
// Float64Observer is a recorder of float64 measurements.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64Observer interface {
|
||||
Observe(value float64, attributes ...attribute.KeyValue)
|
||||
}
|
||||
|
||||
// Float64Callback is a function registered with a Meter that makes
|
||||
// observations for a Float64Observerable instrument it is registered with.
|
||||
// Calls to the Float64Observer record measurement values for the
|
||||
// Float64Observable.
|
||||
//
|
||||
// The function needs to complete in a finite amount of time and the deadline
|
||||
// of the passed context is expected to be honored.
|
||||
//
|
||||
// The function needs to make unique observations across all registered
|
||||
// Float64Callbacks. Meaning, it should not report measurements with the same
|
||||
// attributes as another Float64Callbacks also registered for the same
|
||||
// instrument.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
type Float64Callback func(context.Context, Float64Observer) error
|
||||
|
||||
// Float64ObserverConfig contains options for Asynchronous instruments that
|
||||
// observe float64 values.
|
||||
type Float64ObserverConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Float64Callback
|
||||
}
|
||||
|
||||
// NewFloat64ObserverConfig returns a new Float64ObserverConfig with all opts
|
||||
// applied.
|
||||
func NewFloat64ObserverConfig(opts ...Float64ObserverOption) Float64ObserverConfig {
|
||||
var config Float64ObserverConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64Observer(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the Config description.
|
||||
func (c Float64ObserverConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the Config unit.
|
||||
func (c Float64ObserverConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the Config callbacks.
|
||||
func (c Float64ObserverConfig) Callbacks() []Float64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Float64ObserverOption applies options to float64 Observer instruments.
|
||||
type Float64ObserverOption interface {
|
||||
applyFloat64Observer(Float64ObserverConfig) Float64ObserverConfig
|
||||
}
|
||||
|
||||
type float64ObserverOptionFunc func(Float64ObserverConfig) Float64ObserverConfig
|
||||
|
||||
func (fn float64ObserverOptionFunc) applyFloat64Observer(cfg Float64ObserverConfig) Float64ObserverConfig {
|
||||
return fn(cfg)
|
||||
}
|
||||
|
||||
// WithFloat64Callback adds callback to be called for an instrument.
|
||||
func WithFloat64Callback(callback Float64Callback) Float64ObserverOption {
|
||||
return float64ObserverOptionFunc(func(cfg Float64ObserverConfig) Float64ObserverConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, callback)
|
||||
return cfg
|
||||
})
|
||||
}
|
130
vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64.go
generated
vendored
130
vendor/go.opentelemetry.io/otel/metric/instrument/asyncint64.go
generated
vendored
|
@ -1,130 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package instrument // import "go.opentelemetry.io/otel/metric/instrument"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// Int64Observable describes a set of instruments used asynchronously to record
|
||||
// int64 measurements once per collection cycle. Observations of these
|
||||
// instruments are only made within a callback.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64Observable interface {
|
||||
Asynchronous
|
||||
|
||||
int64Observable()
|
||||
}
|
||||
|
||||
// Int64ObservableCounter is an instrument used to asynchronously record
|
||||
// increasing int64 measurements once per collection cycle. Observations are
|
||||
// only made within a callback for this instrument. The value observed is
|
||||
// assumed the to be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64ObservableCounter interface{ Int64Observable }
|
||||
|
||||
// Int64ObservableUpDownCounter is an instrument used to asynchronously record
|
||||
// int64 measurements once per collection cycle. Observations are only made
|
||||
// within a callback for this instrument. The value observed is assumed the to
|
||||
// be the cumulative sum of the count.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64ObservableUpDownCounter interface{ Int64Observable }
|
||||
|
||||
// Int64ObservableGauge is an instrument used to asynchronously record
|
||||
// instantaneous int64 measurements once per collection cycle. Observations are
|
||||
// only made within a callback for this instrument.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64ObservableGauge interface{ Int64Observable }
|
||||
|
||||
// Int64Observer is a recorder of int64 measurements.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64Observer interface {
|
||||
Observe(value int64, attributes ...attribute.KeyValue)
|
||||
}
|
||||
|
||||
// Int64Callback is a function registered with a Meter that makes
|
||||
// observations for a Int64Observerable instrument it is registered with.
|
||||
// Calls to the Int64Observer record measurement values for the
|
||||
// Int64Observable.
|
||||
//
|
||||
// The function needs to complete in a finite amount of time and the deadline
|
||||
// of the passed context is expected to be honored.
|
||||
//
|
||||
// The function needs to make unique observations across all registered
|
||||
// Int64Callback. Meaning, it should not report measurements with the same
|
||||
// attributes as another Int64Callbacks also registered for the same
|
||||
// instrument.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
type Int64Callback func(context.Context, Int64Observer) error
|
||||
|
||||
// Int64ObserverConfig contains options for Asynchronous instruments that
|
||||
// observe int64 values.
|
||||
type Int64ObserverConfig struct {
|
||||
description string
|
||||
unit string
|
||||
callbacks []Int64Callback
|
||||
}
|
||||
|
||||
// NewInt64ObserverConfig returns a new Int64ObserverConfig with all opts
|
||||
// applied.
|
||||
func NewInt64ObserverConfig(opts ...Int64ObserverOption) Int64ObserverConfig {
|
||||
var config Int64ObserverConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64Observer(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the Config description.
|
||||
func (c Int64ObserverConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the Config unit.
|
||||
func (c Int64ObserverConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Callbacks returns the Config callbacks.
|
||||
func (c Int64ObserverConfig) Callbacks() []Int64Callback {
|
||||
return c.callbacks
|
||||
}
|
||||
|
||||
// Int64ObserverOption applies options to int64 Observer instruments.
|
||||
type Int64ObserverOption interface {
|
||||
applyInt64Observer(Int64ObserverConfig) Int64ObserverConfig
|
||||
}
|
||||
|
||||
type int64ObserverOptionFunc func(Int64ObserverConfig) Int64ObserverConfig
|
||||
|
||||
func (fn int64ObserverOptionFunc) applyInt64Observer(cfg Int64ObserverConfig) Int64ObserverConfig {
|
||||
return fn(cfg)
|
||||
}
|
||||
|
||||
// WithInt64Callback adds callback to be called for an instrument.
|
||||
func WithInt64Callback(callback Int64Callback) Int64ObserverOption {
|
||||
return int64ObserverOptionFunc(func(cfg Int64ObserverConfig) Int64ObserverConfig {
|
||||
cfg.callbacks = append(cfg.callbacks, callback)
|
||||
return cfg
|
||||
})
|
||||
}
|
88
vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go
generated
vendored
88
vendor/go.opentelemetry.io/otel/metric/instrument/instrument.go
generated
vendored
|
@ -1,88 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package 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()
|
||||
}
|
||||
|
||||
// Option applies options to all instruments.
|
||||
type Option interface {
|
||||
Float64ObserverOption
|
||||
Int64ObserverOption
|
||||
Float64Option
|
||||
Int64Option
|
||||
}
|
||||
|
||||
type descOpt string
|
||||
|
||||
func (o descOpt) applyFloat64(c Float64Config) Float64Config {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64(c Int64Config) Int64Config {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o descOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig {
|
||||
c.description = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
// WithDescription sets the instrument description.
|
||||
func WithDescription(desc string) Option { return descOpt(desc) }
|
||||
|
||||
type unitOpt string
|
||||
|
||||
func (o unitOpt) applyFloat64(c Float64Config) Float64Config {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64(c Int64Config) Int64Config {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyFloat64Observer(c Float64ObserverConfig) Float64ObserverConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
func (o unitOpt) applyInt64Observer(c Int64ObserverConfig) Int64ObserverConfig {
|
||||
c.unit = string(o)
|
||||
return c
|
||||
}
|
||||
|
||||
// WithUnit sets the instrument unit.
|
||||
func WithUnit(u string) Option { return unitOpt(u) }
|
85
vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64.go
generated
vendored
85
vendor/go.opentelemetry.io/otel/metric/instrument/syncfloat64.go
generated
vendored
|
@ -1,85 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package instrument // import "go.opentelemetry.io/otel/metric/instrument"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// Float64Counter is an instrument that records increasing float64 values.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64Counter interface {
|
||||
// Add records a change to the counter.
|
||||
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
|
||||
|
||||
Synchronous
|
||||
}
|
||||
|
||||
// Float64UpDownCounter is an instrument that records increasing or decreasing
|
||||
// float64 values.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64UpDownCounter interface {
|
||||
// Add records a change to the counter.
|
||||
Add(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
|
||||
|
||||
Synchronous
|
||||
}
|
||||
|
||||
// Float64Histogram is an instrument that records a distribution of float64
|
||||
// values.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Float64Histogram interface {
|
||||
// Record adds an additional value to the distribution.
|
||||
Record(ctx context.Context, incr float64, attrs ...attribute.KeyValue)
|
||||
|
||||
Synchronous
|
||||
}
|
||||
|
||||
// Float64Config contains options for Asynchronous instruments that
|
||||
// observe float64 values.
|
||||
type Float64Config struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// Float64Config contains options for Synchronous instruments that record
|
||||
// float64 values.
|
||||
func NewFloat64Config(opts ...Float64Option) Float64Config {
|
||||
var config Float64Config
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the Config description.
|
||||
func (c Float64Config) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the Config unit.
|
||||
func (c Float64Config) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Float64Option applies options to synchronous float64 instruments.
|
||||
type Float64Option interface {
|
||||
applyFloat64(Float64Config) Float64Config
|
||||
}
|
85
vendor/go.opentelemetry.io/otel/metric/instrument/syncint64.go
generated
vendored
85
vendor/go.opentelemetry.io/otel/metric/instrument/syncint64.go
generated
vendored
|
@ -1,85 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package instrument // import "go.opentelemetry.io/otel/metric/instrument"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// Int64Counter is an instrument that records increasing int64 values.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64Counter interface {
|
||||
// Add records a change to the counter.
|
||||
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
|
||||
|
||||
Synchronous
|
||||
}
|
||||
|
||||
// Int64UpDownCounter is an instrument that records increasing or decreasing
|
||||
// int64 values.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64UpDownCounter interface {
|
||||
// Add records a change to the counter.
|
||||
Add(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
|
||||
|
||||
Synchronous
|
||||
}
|
||||
|
||||
// Int64Histogram is an instrument that records a distribution of int64
|
||||
// values.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
type Int64Histogram interface {
|
||||
// Record adds an additional value to the distribution.
|
||||
Record(ctx context.Context, incr int64, attrs ...attribute.KeyValue)
|
||||
|
||||
Synchronous
|
||||
}
|
||||
|
||||
// Int64Config contains options for Synchronous instruments that record int64
|
||||
// values.
|
||||
type Int64Config struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewInt64Config returns a new Int64Config with all opts
|
||||
// applied.
|
||||
func NewInt64Config(opts ...Int64Option) Int64Config {
|
||||
var config Int64Config
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the Config description.
|
||||
func (c Int64Config) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the Config unit.
|
||||
func (c Int64Config) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Int64Option applies options to synchronous int64 instruments.
|
||||
type Int64Option interface {
|
||||
applyInt64(Int64Config) Int64Config
|
||||
}
|
355
vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
generated
vendored
355
vendor/go.opentelemetry.io/otel/metric/internal/global/instruments.go
generated
vendored
|
@ -1,355 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package 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"
|
||||
)
|
||||
|
||||
// unwrapper unwraps to return the underlying instrument implementation.
|
||||
type unwrapper interface {
|
||||
Unwrap() instrument.Asynchronous
|
||||
}
|
||||
|
||||
type afCounter struct {
|
||||
instrument.Float64Observable
|
||||
|
||||
name string
|
||||
opts []instrument.Float64ObserverOption
|
||||
|
||||
delegate atomic.Value //instrument.Float64ObservableCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*afCounter)(nil)
|
||||
var _ instrument.Float64ObservableCounter = (*afCounter)(nil)
|
||||
|
||||
func (i *afCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64ObservableCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *afCounter) Unwrap() instrument.Asynchronous {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(instrument.Float64ObservableCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type afUpDownCounter struct {
|
||||
instrument.Float64Observable
|
||||
|
||||
name string
|
||||
opts []instrument.Float64ObserverOption
|
||||
|
||||
delegate atomic.Value //instrument.Float64ObservableUpDownCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*afUpDownCounter)(nil)
|
||||
var _ instrument.Float64ObservableUpDownCounter = (*afUpDownCounter)(nil)
|
||||
|
||||
func (i *afUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64ObservableUpDownCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *afUpDownCounter) Unwrap() instrument.Asynchronous {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(instrument.Float64ObservableUpDownCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type afGauge struct {
|
||||
instrument.Float64Observable
|
||||
|
||||
name string
|
||||
opts []instrument.Float64ObserverOption
|
||||
|
||||
delegate atomic.Value //instrument.Float64ObservableGauge
|
||||
}
|
||||
|
||||
var _ unwrapper = (*afGauge)(nil)
|
||||
var _ instrument.Float64ObservableGauge = (*afGauge)(nil)
|
||||
|
||||
func (i *afGauge) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64ObservableGauge(i.name, i.opts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *afGauge) Unwrap() instrument.Asynchronous {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(instrument.Float64ObservableGauge)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type aiCounter struct {
|
||||
instrument.Int64Observable
|
||||
|
||||
name string
|
||||
opts []instrument.Int64ObserverOption
|
||||
|
||||
delegate atomic.Value //instrument.Int64ObservableCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*aiCounter)(nil)
|
||||
var _ instrument.Int64ObservableCounter = (*aiCounter)(nil)
|
||||
|
||||
func (i *aiCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64ObservableCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *aiCounter) Unwrap() instrument.Asynchronous {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(instrument.Int64ObservableCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type aiUpDownCounter struct {
|
||||
instrument.Int64Observable
|
||||
|
||||
name string
|
||||
opts []instrument.Int64ObserverOption
|
||||
|
||||
delegate atomic.Value //instrument.Int64ObservableUpDownCounter
|
||||
}
|
||||
|
||||
var _ unwrapper = (*aiUpDownCounter)(nil)
|
||||
var _ instrument.Int64ObservableUpDownCounter = (*aiUpDownCounter)(nil)
|
||||
|
||||
func (i *aiUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64ObservableUpDownCounter(i.name, i.opts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *aiUpDownCounter) Unwrap() instrument.Asynchronous {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(instrument.Int64ObservableUpDownCounter)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type aiGauge struct {
|
||||
instrument.Int64Observable
|
||||
|
||||
name string
|
||||
opts []instrument.Int64ObserverOption
|
||||
|
||||
delegate atomic.Value //instrument.Int64ObservableGauge
|
||||
}
|
||||
|
||||
var _ unwrapper = (*aiGauge)(nil)
|
||||
var _ instrument.Int64ObservableGauge = (*aiGauge)(nil)
|
||||
|
||||
func (i *aiGauge) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64ObservableGauge(i.name, i.opts...)
|
||||
if err != nil {
|
||||
otel.Handle(err)
|
||||
return
|
||||
}
|
||||
i.delegate.Store(ctr)
|
||||
}
|
||||
|
||||
func (i *aiGauge) Unwrap() instrument.Asynchronous {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(instrument.Int64ObservableGauge)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sync Instruments.
|
||||
type sfCounter struct {
|
||||
name string
|
||||
opts []instrument.Float64Option
|
||||
|
||||
delegate atomic.Value //instrument.Float64Counter
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var _ instrument.Float64Counter = (*sfCounter)(nil)
|
||||
|
||||
func (i *sfCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64Counter(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.(instrument.Float64Counter).Add(ctx, incr, attrs...)
|
||||
}
|
||||
}
|
||||
|
||||
type sfUpDownCounter struct {
|
||||
name string
|
||||
opts []instrument.Float64Option
|
||||
|
||||
delegate atomic.Value //instrument.Float64UpDownCounter
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var _ instrument.Float64UpDownCounter = (*sfUpDownCounter)(nil)
|
||||
|
||||
func (i *sfUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64UpDownCounter(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.(instrument.Float64UpDownCounter).Add(ctx, incr, attrs...)
|
||||
}
|
||||
}
|
||||
|
||||
type sfHistogram struct {
|
||||
name string
|
||||
opts []instrument.Float64Option
|
||||
|
||||
delegate atomic.Value //instrument.Float64Histogram
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var _ instrument.Float64Histogram = (*sfHistogram)(nil)
|
||||
|
||||
func (i *sfHistogram) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Float64Histogram(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.(instrument.Float64Histogram).Record(ctx, x, attrs...)
|
||||
}
|
||||
}
|
||||
|
||||
type siCounter struct {
|
||||
name string
|
||||
opts []instrument.Int64Option
|
||||
|
||||
delegate atomic.Value //instrument.Int64Counter
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var _ instrument.Int64Counter = (*siCounter)(nil)
|
||||
|
||||
func (i *siCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64Counter(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.(instrument.Int64Counter).Add(ctx, x, attrs...)
|
||||
}
|
||||
}
|
||||
|
||||
type siUpDownCounter struct {
|
||||
name string
|
||||
opts []instrument.Int64Option
|
||||
|
||||
delegate atomic.Value //instrument.Int64UpDownCounter
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var _ instrument.Int64UpDownCounter = (*siUpDownCounter)(nil)
|
||||
|
||||
func (i *siUpDownCounter) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64UpDownCounter(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.(instrument.Int64UpDownCounter).Add(ctx, x, attrs...)
|
||||
}
|
||||
}
|
||||
|
||||
type siHistogram struct {
|
||||
name string
|
||||
opts []instrument.Int64Option
|
||||
|
||||
delegate atomic.Value //instrument.Int64Histogram
|
||||
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var _ instrument.Int64Histogram = (*siHistogram)(nil)
|
||||
|
||||
func (i *siHistogram) setDelegate(m metric.Meter) {
|
||||
ctr, err := m.Int64Histogram(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.(instrument.Int64Histogram).Record(ctx, x, attrs...)
|
||||
}
|
||||
}
|
68
vendor/go.opentelemetry.io/otel/metric/internal/global/state.go
generated
vendored
68
vendor/go.opentelemetry.io/otel/metric/internal/global/state.go
generated
vendored
|
@ -1,68 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// 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
|
||||
}
|
202
vendor/go.opentelemetry.io/otel/metric/meter.go
generated
vendored
202
vendor/go.opentelemetry.io/otel/metric/meter.go
generated
vendored
|
@ -17,80 +17,134 @@ 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/embedded"
|
||||
)
|
||||
|
||||
// MeterProvider provides access to named Meter instances, for instrumenting
|
||||
// an application or library.
|
||||
// an application or package.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type MeterProvider interface {
|
||||
// Meter creates an instance of a `Meter` interface. The name 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 name is empty, then a implementation defined
|
||||
// default name will be used instead.
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.MeterProvider
|
||||
|
||||
// Meter returns a new Meter with the provided name and configuration.
|
||||
//
|
||||
// A Meter should be scoped at most to a single package. The name needs to
|
||||
// be unique so it does not collide with other names used by
|
||||
// an application, nor other applications. To achieve this, the import path
|
||||
// of the instrumentation package is recommended to be used as name.
|
||||
//
|
||||
// If the name is empty, then an implementation defined default name will
|
||||
// be used instead.
|
||||
Meter(name string, opts ...MeterOption) Meter
|
||||
}
|
||||
|
||||
// Meter provides access to instrument instances for recording metrics.
|
||||
//
|
||||
// Warning: methods may be added to this interface in minor releases.
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Meter interface {
|
||||
// Int64Counter returns a new instrument identified by name and configured
|
||||
// with options. The instrument is used to synchronously record increasing
|
||||
// int64 measurements during a computational operation.
|
||||
Int64Counter(name string, options ...instrument.Int64Option) (instrument.Int64Counter, error)
|
||||
// Int64UpDownCounter returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to synchronously record
|
||||
// int64 measurements during a computational operation.
|
||||
Int64UpDownCounter(name string, options ...instrument.Int64Option) (instrument.Int64UpDownCounter, error)
|
||||
// Int64Histogram returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to synchronously record
|
||||
// the distribution of int64 measurements during a computational operation.
|
||||
Int64Histogram(name string, options ...instrument.Int64Option) (instrument.Int64Histogram, error)
|
||||
// Int64ObservableCounter returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to asynchronously record
|
||||
// increasing int64 measurements once per a measurement collection cycle.
|
||||
Int64ObservableCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error)
|
||||
// Int64ObservableUpDownCounter returns a new instrument identified by name
|
||||
// and configured with options. The instrument is used to asynchronously
|
||||
// record int64 measurements once per a measurement collection cycle.
|
||||
Int64ObservableUpDownCounter(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error)
|
||||
// Int64ObservableGauge returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to asynchronously record
|
||||
// instantaneous int64 measurements once per a measurement collection
|
||||
// cycle.
|
||||
Int64ObservableGauge(name string, options ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error)
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Meter
|
||||
|
||||
// Float64Counter returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to synchronously record
|
||||
// increasing float64 measurements during a computational operation.
|
||||
Float64Counter(name string, options ...instrument.Float64Option) (instrument.Float64Counter, error)
|
||||
// Float64UpDownCounter returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to synchronously record
|
||||
// float64 measurements during a computational operation.
|
||||
Float64UpDownCounter(name string, options ...instrument.Float64Option) (instrument.Float64UpDownCounter, error)
|
||||
// Float64Histogram returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to synchronously record
|
||||
// the distribution of float64 measurements during a computational
|
||||
// Int64Counter returns a new Int64Counter instrument identified by name
|
||||
// and configured with options. The instrument is used to synchronously
|
||||
// record increasing int64 measurements during a computational operation.
|
||||
Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
|
||||
// Int64UpDownCounter returns a new Int64UpDownCounter instrument
|
||||
// identified by name and configured with options. The instrument is used
|
||||
// to synchronously record int64 measurements during a computational
|
||||
// operation.
|
||||
Float64Histogram(name string, options ...instrument.Float64Option) (instrument.Float64Histogram, error)
|
||||
// Float64ObservableCounter returns a new instrument identified by name and
|
||||
// configured with options. The instrument is used to asynchronously record
|
||||
// increasing float64 measurements once per a measurement collection cycle.
|
||||
Float64ObservableCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error)
|
||||
// Float64ObservableUpDownCounter returns a new instrument identified by
|
||||
Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
|
||||
// Int64Histogram returns a new Int64Histogram instrument identified by
|
||||
// name and configured with options. The instrument is used to
|
||||
// asynchronously record float64 measurements once per a measurement
|
||||
// collection cycle.
|
||||
Float64ObservableUpDownCounter(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error)
|
||||
// Float64ObservableGauge returns a new instrument identified by name and
|
||||
// synchronously record the distribution of int64 measurements during a
|
||||
// computational operation.
|
||||
Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
|
||||
// Int64ObservableCounter returns a new Int64ObservableCounter identified
|
||||
// by name and configured with options. The instrument is used to
|
||||
// asynchronously record increasing int64 measurements once per a
|
||||
// measurement collection cycle.
|
||||
//
|
||||
// Measurements for the returned instrument are made via a callback. Use
|
||||
// the WithInt64Callback option to register the callback here, or use the
|
||||
// RegisterCallback method of this Meter to register one later. See the
|
||||
// Measurements section of the package documentation for more information.
|
||||
Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
|
||||
// Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter
|
||||
// instrument identified by name and configured with options. The
|
||||
// instrument is used to asynchronously record int64 measurements once per
|
||||
// a measurement collection cycle.
|
||||
//
|
||||
// Measurements for the returned instrument are made via a callback. Use
|
||||
// the WithInt64Callback option to register the callback here, or use the
|
||||
// RegisterCallback method of this Meter to register one later. See the
|
||||
// Measurements section of the package documentation for more information.
|
||||
Int64ObservableUpDownCounter(name string, options ...Int64ObservableUpDownCounterOption) (Int64ObservableUpDownCounter, error)
|
||||
// Int64ObservableGauge returns a new Int64ObservableGauge instrument
|
||||
// identified by name and configured with options. The instrument is used
|
||||
// to asynchronously record instantaneous int64 measurements once per a
|
||||
// measurement collection cycle.
|
||||
//
|
||||
// Measurements for the returned instrument are made via a callback. Use
|
||||
// the WithInt64Callback option to register the callback here, or use the
|
||||
// RegisterCallback method of this Meter to register one later. See the
|
||||
// Measurements section of the package documentation for more information.
|
||||
Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
|
||||
|
||||
// Float64Counter returns a new Float64Counter instrument identified by
|
||||
// name and configured with options. The instrument is used to
|
||||
// synchronously record increasing float64 measurements during a
|
||||
// computational operation.
|
||||
Float64Counter(name string, options ...Float64CounterOption) (Float64Counter, error)
|
||||
// Float64UpDownCounter returns a new Float64UpDownCounter instrument
|
||||
// identified by name and configured with options. The instrument is used
|
||||
// to synchronously record float64 measurements during a computational
|
||||
// operation.
|
||||
Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
|
||||
// Float64Histogram returns a new Float64Histogram instrument identified by
|
||||
// name and configured with options. The instrument is used to
|
||||
// synchronously record the distribution of float64 measurements during a
|
||||
// computational operation.
|
||||
Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
|
||||
// Float64ObservableCounter returns a new Float64ObservableCounter
|
||||
// instrument identified by name and configured with options. The
|
||||
// instrument is used to asynchronously record increasing float64
|
||||
// measurements once per a measurement collection cycle.
|
||||
//
|
||||
// Measurements for the returned instrument are made via a callback. Use
|
||||
// the WithFloat64Callback option to register the callback here, or use the
|
||||
// RegisterCallback method of this Meter to register one later. See the
|
||||
// Measurements section of the package documentation for more information.
|
||||
Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
|
||||
// Float64ObservableUpDownCounter returns a new
|
||||
// Float64ObservableUpDownCounter instrument identified by name and
|
||||
// configured with options. The instrument is used to asynchronously record
|
||||
// instantaneous float64 measurements once per a measurement collection
|
||||
// cycle.
|
||||
Float64ObservableGauge(name string, options ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error)
|
||||
// float64 measurements once per a measurement collection cycle.
|
||||
//
|
||||
// Measurements for the returned instrument are made via a callback. Use
|
||||
// the WithFloat64Callback option to register the callback here, or use the
|
||||
// RegisterCallback method of this Meter to register one later. See the
|
||||
// Measurements section of the package documentation for more information.
|
||||
Float64ObservableUpDownCounter(name string, options ...Float64ObservableUpDownCounterOption) (Float64ObservableUpDownCounter, error)
|
||||
// Float64ObservableGauge returns a new Float64ObservableGauge instrument
|
||||
// identified by name and configured with options. The instrument is used
|
||||
// to asynchronously record instantaneous float64 measurements once per a
|
||||
// measurement collection cycle.
|
||||
//
|
||||
// Measurements for the returned instrument are made via a callback. Use
|
||||
// the WithFloat64Callback option to register the callback here, or use the
|
||||
// RegisterCallback method of this Meter to register one later. See the
|
||||
// Measurements section of the package documentation for more information.
|
||||
Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
|
||||
|
||||
// RegisterCallback registers f to be called during the collection of a
|
||||
// measurement cycle.
|
||||
|
@ -103,12 +157,12 @@ type Meter interface {
|
|||
//
|
||||
// If no instruments are passed, f should not be registered nor called
|
||||
// during collection.
|
||||
RegisterCallback(f Callback, instruments ...instrument.Asynchronous) (Registration, error)
|
||||
RegisterCallback(f Callback, instruments ...Observable) (Registration, error)
|
||||
}
|
||||
|
||||
// Callback is a function registered with a Meter that makes observations for
|
||||
// the set of instruments it is registered with. The Observer parameter is used
|
||||
// to record measurment observations for these instruments.
|
||||
// to record measurement observations for these instruments.
|
||||
//
|
||||
// The function needs to complete in a finite amount of time and the deadline
|
||||
// of the passed context is expected to be honored.
|
||||
|
@ -121,16 +175,34 @@ type Meter interface {
|
|||
type Callback func(context.Context, Observer) error
|
||||
|
||||
// Observer records measurements for multiple instruments in a Callback.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Observer interface {
|
||||
// ObserveFloat64 records the float64 value with attributes for obsrv.
|
||||
ObserveFloat64(obsrv instrument.Float64Observable, value float64, attributes ...attribute.KeyValue)
|
||||
// ObserveInt64 records the int64 value with attributes for obsrv.
|
||||
ObserveInt64(obsrv instrument.Int64Observable, value int64, attributes ...attribute.KeyValue)
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Observer
|
||||
|
||||
// ObserveFloat64 records the float64 value for obsrv.
|
||||
ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
|
||||
// ObserveInt64 records the int64 value for obsrv.
|
||||
ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
|
||||
}
|
||||
|
||||
// Registration is an token representing the unique registration of a callback
|
||||
// for a set of instruments with a Meter.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Registration interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Registration
|
||||
|
||||
// Unregister removes the callback registration from a Meter.
|
||||
//
|
||||
// This method needs to be idempotent and concurrent safe.
|
||||
|
|
143
vendor/go.opentelemetry.io/otel/metric/noop.go
generated
vendored
143
vendor/go.opentelemetry.io/otel/metric/noop.go
generated
vendored
|
@ -1,143 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package metric // import "go.opentelemetry.io/otel/metric"
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/metric/instrument"
|
||||
)
|
||||
|
||||
// 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{}
|
||||
|
||||
func (noopMeter) Int64Counter(string, ...instrument.Int64Option) (instrument.Int64Counter, error) {
|
||||
return nonrecordingSyncInt64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Int64UpDownCounter(string, ...instrument.Int64Option) (instrument.Int64UpDownCounter, error) {
|
||||
return nonrecordingSyncInt64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Int64Histogram(string, ...instrument.Int64Option) (instrument.Int64Histogram, error) {
|
||||
return nonrecordingSyncInt64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Int64ObservableCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableCounter, error) {
|
||||
return nonrecordingAsyncInt64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Int64ObservableUpDownCounter(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableUpDownCounter, error) {
|
||||
return nonrecordingAsyncInt64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Int64ObservableGauge(string, ...instrument.Int64ObserverOption) (instrument.Int64ObservableGauge, error) {
|
||||
return nonrecordingAsyncInt64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Float64Counter(string, ...instrument.Float64Option) (instrument.Float64Counter, error) {
|
||||
return nonrecordingSyncFloat64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Float64UpDownCounter(string, ...instrument.Float64Option) (instrument.Float64UpDownCounter, error) {
|
||||
return nonrecordingSyncFloat64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Float64Histogram(string, ...instrument.Float64Option) (instrument.Float64Histogram, error) {
|
||||
return nonrecordingSyncFloat64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Float64ObservableCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableCounter, error) {
|
||||
return nonrecordingAsyncFloat64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Float64ObservableUpDownCounter(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableUpDownCounter, error) {
|
||||
return nonrecordingAsyncFloat64Instrument{}, nil
|
||||
}
|
||||
|
||||
func (noopMeter) Float64ObservableGauge(string, ...instrument.Float64ObserverOption) (instrument.Float64ObservableGauge, error) {
|
||||
return nonrecordingAsyncFloat64Instrument{}, nil
|
||||
}
|
||||
|
||||
// RegisterCallback creates a register callback that does not record any metrics.
|
||||
func (noopMeter) RegisterCallback(Callback, ...instrument.Asynchronous) (Registration, error) {
|
||||
return noopReg{}, nil
|
||||
}
|
||||
|
||||
type noopReg struct{}
|
||||
|
||||
func (noopReg) Unregister() error { return nil }
|
||||
|
||||
type nonrecordingAsyncFloat64Instrument struct {
|
||||
instrument.Float64Observable
|
||||
}
|
||||
|
||||
var (
|
||||
_ instrument.Float64ObservableCounter = nonrecordingAsyncFloat64Instrument{}
|
||||
_ instrument.Float64ObservableUpDownCounter = nonrecordingAsyncFloat64Instrument{}
|
||||
_ instrument.Float64ObservableGauge = nonrecordingAsyncFloat64Instrument{}
|
||||
)
|
||||
|
||||
type nonrecordingAsyncInt64Instrument struct {
|
||||
instrument.Int64Observable
|
||||
}
|
||||
|
||||
var (
|
||||
_ instrument.Int64ObservableCounter = nonrecordingAsyncInt64Instrument{}
|
||||
_ instrument.Int64ObservableUpDownCounter = nonrecordingAsyncInt64Instrument{}
|
||||
_ instrument.Int64ObservableGauge = nonrecordingAsyncInt64Instrument{}
|
||||
)
|
||||
|
||||
type nonrecordingSyncFloat64Instrument struct {
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var (
|
||||
_ instrument.Float64Counter = nonrecordingSyncFloat64Instrument{}
|
||||
_ instrument.Float64UpDownCounter = nonrecordingSyncFloat64Instrument{}
|
||||
_ instrument.Float64Histogram = nonrecordingSyncFloat64Instrument{}
|
||||
)
|
||||
|
||||
func (nonrecordingSyncFloat64Instrument) Add(context.Context, float64, ...attribute.KeyValue) {}
|
||||
func (nonrecordingSyncFloat64Instrument) Record(context.Context, float64, ...attribute.KeyValue) {}
|
||||
|
||||
type nonrecordingSyncInt64Instrument struct {
|
||||
instrument.Synchronous
|
||||
}
|
||||
|
||||
var (
|
||||
_ instrument.Int64Counter = nonrecordingSyncInt64Instrument{}
|
||||
_ instrument.Int64UpDownCounter = nonrecordingSyncInt64Instrument{}
|
||||
_ instrument.Int64Histogram = nonrecordingSyncInt64Instrument{}
|
||||
)
|
||||
|
||||
func (nonrecordingSyncInt64Instrument) Add(context.Context, int64, ...attribute.KeyValue) {}
|
||||
func (nonrecordingSyncInt64Instrument) Record(context.Context, int64, ...attribute.KeyValue) {}
|
179
vendor/go.opentelemetry.io/otel/metric/syncfloat64.go
generated
vendored
Normal file
179
vendor/go.opentelemetry.io/otel/metric/syncfloat64.go
generated
vendored
Normal file
|
@ -0,0 +1,179 @@
|
|||
// 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/embedded"
|
||||
)
|
||||
|
||||
// Float64Counter is an instrument that records increasing float64 values.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Float64Counter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64Counter
|
||||
|
||||
// Add records a change to the counter.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Add(ctx context.Context, incr float64, options ...AddOption)
|
||||
}
|
||||
|
||||
// Float64CounterConfig contains options for synchronous counter instruments that
|
||||
// record int64 values.
|
||||
type Float64CounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewFloat64CounterConfig returns a new [Float64CounterConfig] with all opts
|
||||
// applied.
|
||||
func NewFloat64CounterConfig(opts ...Float64CounterOption) Float64CounterConfig {
|
||||
var config Float64CounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64Counter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Float64CounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Float64CounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Float64CounterOption applies options to a [Float64CounterConfig]. See
|
||||
// [InstrumentOption] for other options that can be used as a
|
||||
// Float64CounterOption.
|
||||
type Float64CounterOption interface {
|
||||
applyFloat64Counter(Float64CounterConfig) Float64CounterConfig
|
||||
}
|
||||
|
||||
// Float64UpDownCounter is an instrument that records increasing or decreasing
|
||||
// float64 values.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Float64UpDownCounter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64UpDownCounter
|
||||
|
||||
// Add records a change to the counter.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Add(ctx context.Context, incr float64, options ...AddOption)
|
||||
}
|
||||
|
||||
// Float64UpDownCounterConfig contains options for synchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Float64UpDownCounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewFloat64UpDownCounterConfig returns a new [Float64UpDownCounterConfig]
|
||||
// with all opts applied.
|
||||
func NewFloat64UpDownCounterConfig(opts ...Float64UpDownCounterOption) Float64UpDownCounterConfig {
|
||||
var config Float64UpDownCounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64UpDownCounter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Float64UpDownCounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Float64UpDownCounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Float64UpDownCounterOption applies options to a
|
||||
// [Float64UpDownCounterConfig]. See [InstrumentOption] for other options that
|
||||
// can be used as a Float64UpDownCounterOption.
|
||||
type Float64UpDownCounterOption interface {
|
||||
applyFloat64UpDownCounter(Float64UpDownCounterConfig) Float64UpDownCounterConfig
|
||||
}
|
||||
|
||||
// Float64Histogram is an instrument that records a distribution of float64
|
||||
// values.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Float64Histogram interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Float64Histogram
|
||||
|
||||
// Record adds an additional value to the distribution.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Record(ctx context.Context, incr float64, options ...RecordOption)
|
||||
}
|
||||
|
||||
// Float64HistogramConfig contains options for synchronous counter instruments
|
||||
// that record int64 values.
|
||||
type Float64HistogramConfig struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewFloat64HistogramConfig returns a new [Float64HistogramConfig] with all
|
||||
// opts applied.
|
||||
func NewFloat64HistogramConfig(opts ...Float64HistogramOption) Float64HistogramConfig {
|
||||
var config Float64HistogramConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyFloat64Histogram(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Float64HistogramConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Float64HistogramConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Float64HistogramOption applies options to a [Float64HistogramConfig]. See
|
||||
// [InstrumentOption] for other options that can be used as a
|
||||
// Float64HistogramOption.
|
||||
type Float64HistogramOption interface {
|
||||
applyFloat64Histogram(Float64HistogramConfig) Float64HistogramConfig
|
||||
}
|
179
vendor/go.opentelemetry.io/otel/metric/syncint64.go
generated
vendored
Normal file
179
vendor/go.opentelemetry.io/otel/metric/syncint64.go
generated
vendored
Normal file
|
@ -0,0 +1,179 @@
|
|||
// 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/embedded"
|
||||
)
|
||||
|
||||
// Int64Counter is an instrument that records increasing int64 values.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64Counter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64Counter
|
||||
|
||||
// Add records a change to the counter.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Add(ctx context.Context, incr int64, options ...AddOption)
|
||||
}
|
||||
|
||||
// Int64CounterConfig contains options for synchronous counter instruments that
|
||||
// record int64 values.
|
||||
type Int64CounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewInt64CounterConfig returns a new [Int64CounterConfig] with all opts
|
||||
// applied.
|
||||
func NewInt64CounterConfig(opts ...Int64CounterOption) Int64CounterConfig {
|
||||
var config Int64CounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64Counter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Int64CounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Int64CounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Int64CounterOption applies options to a [Int64CounterConfig]. See
|
||||
// [InstrumentOption] for other options that can be used as an
|
||||
// Int64CounterOption.
|
||||
type Int64CounterOption interface {
|
||||
applyInt64Counter(Int64CounterConfig) Int64CounterConfig
|
||||
}
|
||||
|
||||
// Int64UpDownCounter is an instrument that records increasing or decreasing
|
||||
// int64 values.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64UpDownCounter interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64UpDownCounter
|
||||
|
||||
// Add records a change to the counter.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Add(ctx context.Context, incr int64, options ...AddOption)
|
||||
}
|
||||
|
||||
// Int64UpDownCounterConfig contains options for synchronous counter
|
||||
// instruments that record int64 values.
|
||||
type Int64UpDownCounterConfig struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewInt64UpDownCounterConfig returns a new [Int64UpDownCounterConfig] with
|
||||
// all opts applied.
|
||||
func NewInt64UpDownCounterConfig(opts ...Int64UpDownCounterOption) Int64UpDownCounterConfig {
|
||||
var config Int64UpDownCounterConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64UpDownCounter(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Int64UpDownCounterConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Int64UpDownCounterConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Int64UpDownCounterOption applies options to a [Int64UpDownCounterConfig].
|
||||
// See [InstrumentOption] for other options that can be used as an
|
||||
// Int64UpDownCounterOption.
|
||||
type Int64UpDownCounterOption interface {
|
||||
applyInt64UpDownCounter(Int64UpDownCounterConfig) Int64UpDownCounterConfig
|
||||
}
|
||||
|
||||
// Int64Histogram is an instrument that records a distribution of int64
|
||||
// values.
|
||||
//
|
||||
// Warning: Methods may be added to this interface in minor releases. See
|
||||
// package documentation on API implementation for information on how to set
|
||||
// default behavior for unimplemented methods.
|
||||
type Int64Histogram interface {
|
||||
// Users of the interface can ignore this. This embedded type is only used
|
||||
// by implementations of this interface. See the "API Implementations"
|
||||
// section of the package documentation for more information.
|
||||
embedded.Int64Histogram
|
||||
|
||||
// Record adds an additional value to the distribution.
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
Record(ctx context.Context, incr int64, options ...RecordOption)
|
||||
}
|
||||
|
||||
// Int64HistogramConfig contains options for synchronous counter instruments
|
||||
// that record int64 values.
|
||||
type Int64HistogramConfig struct {
|
||||
description string
|
||||
unit string
|
||||
}
|
||||
|
||||
// NewInt64HistogramConfig returns a new [Int64HistogramConfig] with all opts
|
||||
// applied.
|
||||
func NewInt64HistogramConfig(opts ...Int64HistogramOption) Int64HistogramConfig {
|
||||
var config Int64HistogramConfig
|
||||
for _, o := range opts {
|
||||
config = o.applyInt64Histogram(config)
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// Description returns the configured description.
|
||||
func (c Int64HistogramConfig) Description() string {
|
||||
return c.description
|
||||
}
|
||||
|
||||
// Unit returns the configured unit.
|
||||
func (c Int64HistogramConfig) Unit() string {
|
||||
return c.unit
|
||||
}
|
||||
|
||||
// Int64HistogramOption applies options to a [Int64HistogramConfig]. See
|
||||
// [InstrumentOption] for other options that can be used as an
|
||||
// Int64HistogramOption.
|
||||
type Int64HistogramOption interface {
|
||||
applyInt64Histogram(Int64HistogramConfig) Int64HistogramConfig
|
||||
}
|
1
vendor/go.opentelemetry.io/otel/requirements.txt
generated
vendored
Normal file
1
vendor/go.opentelemetry.io/otel/requirements.txt
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
codespell==2.2.4
|
10
vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
generated
vendored
10
vendor/go.opentelemetry.io/otel/sdk/internal/env/env.go
generated
vendored
|
@ -70,8 +70,8 @@ const (
|
|||
// returned.
|
||||
func firstInt(defaultValue int, keys ...string) int {
|
||||
for _, key := range keys {
|
||||
value, ok := os.LookupEnv(key)
|
||||
if !ok {
|
||||
value := os.Getenv(key)
|
||||
if value == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -88,10 +88,10 @@ func firstInt(defaultValue int, keys ...string) int {
|
|||
}
|
||||
|
||||
// IntEnvOr returns the int value of the environment variable with name key if
|
||||
// it exists and the value is an int. Otherwise, defaultValue is returned.
|
||||
// it exists, it is not empty, and the value is an int. Otherwise, defaultValue is returned.
|
||||
func IntEnvOr(key string, defaultValue int) int {
|
||||
value, ok := os.LookupEnv(key)
|
||||
if !ok {
|
||||
value := os.Getenv(key)
|
||||
if value == "" {
|
||||
return defaultValue
|
||||
}
|
||||
|
||||
|
|
11
vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
generated
vendored
11
vendor/go.opentelemetry.io/otel/sdk/internal/internal.go
generated
vendored
|
@ -14,16 +14,7 @@
|
|||
|
||||
package internal // import "go.opentelemetry.io/otel/sdk/internal"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
)
|
||||
|
||||
// UserAgent is the user agent to be added to the outgoing
|
||||
// requests from the exporters.
|
||||
var UserAgent = fmt.Sprintf("opentelemetry-go/%s", otel.Version())
|
||||
import "time"
|
||||
|
||||
// MonotonicEndTime returns the end time at present
|
||||
// but offset from start, monotonically.
|
||||
|
|
58
vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
generated
vendored
58
vendor/go.opentelemetry.io/otel/sdk/resource/auto.go
generated
vendored
|
@ -18,6 +18,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -45,28 +46,65 @@ type Detector interface {
|
|||
// Detect calls all input detectors sequentially and merges each result with the previous one.
|
||||
// It returns the merged error too.
|
||||
func Detect(ctx context.Context, detectors ...Detector) (*Resource, error) {
|
||||
var autoDetectedRes *Resource
|
||||
var errInfo []string
|
||||
r := new(Resource)
|
||||
return r, detect(ctx, r, detectors)
|
||||
}
|
||||
|
||||
// detect runs all detectors using ctx and merges the result into res. This
|
||||
// assumes res is allocated and not nil, it will panic otherwise.
|
||||
func detect(ctx context.Context, res *Resource, detectors []Detector) error {
|
||||
var (
|
||||
r *Resource
|
||||
errs detectErrs
|
||||
err error
|
||||
)
|
||||
|
||||
for _, detector := range detectors {
|
||||
if detector == nil {
|
||||
continue
|
||||
}
|
||||
res, err := detector.Detect(ctx)
|
||||
r, err = detector.Detect(ctx)
|
||||
if err != nil {
|
||||
errInfo = append(errInfo, err.Error())
|
||||
errs = append(errs, err)
|
||||
if !errors.Is(err, ErrPartialResource) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
autoDetectedRes, err = Merge(autoDetectedRes, res)
|
||||
r, err = Merge(res, r)
|
||||
if err != nil {
|
||||
errInfo = append(errInfo, err.Error())
|
||||
errs = append(errs, err)
|
||||
}
|
||||
*res = *r
|
||||
}
|
||||
|
||||
var aggregatedError error
|
||||
if len(errInfo) > 0 {
|
||||
aggregatedError = fmt.Errorf("detecting resources: %s", errInfo)
|
||||
if len(errs) == 0 {
|
||||
return nil
|
||||
}
|
||||
return autoDetectedRes, aggregatedError
|
||||
return errs
|
||||
}
|
||||
|
||||
type detectErrs []error
|
||||
|
||||
func (e detectErrs) Error() string {
|
||||
errStr := make([]string, len(e))
|
||||
for i, err := range e {
|
||||
errStr[i] = fmt.Sprintf("* %s", err)
|
||||
}
|
||||
|
||||
format := "%d errors occurred detecting resource:\n\t%s"
|
||||
return fmt.Sprintf(format, len(e), strings.Join(errStr, "\n\t"))
|
||||
}
|
||||
|
||||
func (e detectErrs) Unwrap() error {
|
||||
switch len(e) {
|
||||
case 0:
|
||||
return nil
|
||||
case 1:
|
||||
return e[0]
|
||||
}
|
||||
return e[1:]
|
||||
}
|
||||
|
||||
func (e detectErrs) Is(target error) bool {
|
||||
return len(e) != 0 && errors.Is(e[0], target)
|
||||
}
|
||||
|
|
4
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
4
vendor/go.opentelemetry.io/otel/sdk/resource/builtin.go
generated
vendored
|
@ -20,8 +20,8 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/sdk"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||
)
|
||||
|
||||
|
@ -62,7 +62,7 @@ func (telemetrySDK) Detect(context.Context) (*Resource, error) {
|
|||
semconv.SchemaURL,
|
||||
semconv.TelemetrySDKName("opentelemetry"),
|
||||
semconv.TelemetrySDKLanguageGo,
|
||||
semconv.TelemetrySDKVersion(otel.Version()),
|
||||
semconv.TelemetrySDKVersion(sdk.Version()),
|
||||
), nil
|
||||
}
|
||||
|
||||
|
|
5
vendor/go.opentelemetry.io/otel/sdk/resource/config.go
generated
vendored
5
vendor/go.opentelemetry.io/otel/sdk/resource/config.go
generated
vendored
|
@ -71,6 +71,11 @@ func WithHost() Option {
|
|||
return WithDetectors(host{})
|
||||
}
|
||||
|
||||
// WithHostID adds host ID information to the configured resource.
|
||||
func WithHostID() Option {
|
||||
return WithDetectors(hostIDDetector{})
|
||||
}
|
||||
|
||||
// WithTelemetrySDK adds TelemetrySDK version info to the configured resource.
|
||||
func WithTelemetrySDK() Option {
|
||||
return WithDetectors(telemetrySDK{})
|
||||
|
|
3
vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
generated
vendored
3
vendor/go.opentelemetry.io/otel/sdk/resource/doc.go
generated
vendored
|
@ -25,4 +25,7 @@
|
|||
// OTEL_RESOURCE_ATTRIBUTES the FromEnv Detector can be used. It will interpret
|
||||
// the value as a list of comma delimited key/value pairs
|
||||
// (e.g. `<key1>=<value1>,<key2>=<value2>,...`).
|
||||
//
|
||||
// While this package provides a stable API,
|
||||
// the attributes added by resource detectors may change.
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
|
14
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
14
vendor/go.opentelemetry.io/otel/sdk/resource/env.go
generated
vendored
|
@ -82,23 +82,23 @@ func constructOTResources(s string) (*Resource, error) {
|
|||
return Empty(), nil
|
||||
}
|
||||
pairs := strings.Split(s, ",")
|
||||
attrs := []attribute.KeyValue{}
|
||||
var attrs []attribute.KeyValue
|
||||
var invalid []string
|
||||
for _, p := range pairs {
|
||||
field := strings.SplitN(p, "=", 2)
|
||||
if len(field) != 2 {
|
||||
k, v, found := strings.Cut(p, "=")
|
||||
if !found {
|
||||
invalid = append(invalid, p)
|
||||
continue
|
||||
}
|
||||
k := strings.TrimSpace(field[0])
|
||||
v, err := url.QueryUnescape(strings.TrimSpace(field[1]))
|
||||
key := strings.TrimSpace(k)
|
||||
val, err := url.QueryUnescape(strings.TrimSpace(v))
|
||||
if err != nil {
|
||||
// Retain original value if decoding fails, otherwise it will be
|
||||
// an empty string.
|
||||
v = field[1]
|
||||
val = v
|
||||
otel.Handle(err)
|
||||
}
|
||||
attrs = append(attrs, attribute.String(k, v))
|
||||
attrs = append(attrs, attribute.String(key, val))
|
||||
}
|
||||
var err error
|
||||
if len(invalid) > 0 {
|
||||
|
|
120
vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
generated
vendored
Normal file
120
vendor/go.opentelemetry.io/otel/sdk/resource/host_id.go
generated
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
// 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 resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.17.0"
|
||||
)
|
||||
|
||||
type hostIDProvider func() (string, error)
|
||||
|
||||
var defaultHostIDProvider hostIDProvider = platformHostIDReader.read
|
||||
|
||||
var hostID = defaultHostIDProvider
|
||||
|
||||
type hostIDReader interface {
|
||||
read() (string, error)
|
||||
}
|
||||
|
||||
type fileReader func(string) (string, error)
|
||||
|
||||
type commandExecutor func(string, ...string) (string, error)
|
||||
|
||||
// hostIDReaderBSD implements hostIDReader.
|
||||
type hostIDReaderBSD struct {
|
||||
execCommand commandExecutor
|
||||
readFile fileReader
|
||||
}
|
||||
|
||||
// read attempts to read the machine-id from /etc/hostid. If not found it will
|
||||
// execute `kenv -q smbios.system.uuid`. If neither location yields an id an
|
||||
// error will be returned.
|
||||
func (r *hostIDReaderBSD) read() (string, error) {
|
||||
if result, err := r.readFile("/etc/hostid"); err == nil {
|
||||
return strings.TrimSpace(result), nil
|
||||
}
|
||||
|
||||
if result, err := r.execCommand("kenv", "-q", "smbios.system.uuid"); err == nil {
|
||||
return strings.TrimSpace(result), nil
|
||||
}
|
||||
|
||||
return "", errors.New("host id not found in: /etc/hostid or kenv")
|
||||
}
|
||||
|
||||
// hostIDReaderDarwin implements hostIDReader.
|
||||
type hostIDReaderDarwin struct {
|
||||
execCommand commandExecutor
|
||||
}
|
||||
|
||||
// read executes `ioreg -rd1 -c "IOPlatformExpertDevice"` and parses host id
|
||||
// from the IOPlatformUUID line. If the command fails or the uuid cannot be
|
||||
// parsed an error will be returned.
|
||||
func (r *hostIDReaderDarwin) read() (string, error) {
|
||||
result, err := r.execCommand("ioreg", "-rd1", "-c", "IOPlatformExpertDevice")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
lines := strings.Split(result, "\n")
|
||||
for _, line := range lines {
|
||||
if strings.Contains(line, "IOPlatformUUID") {
|
||||
parts := strings.Split(line, " = ")
|
||||
if len(parts) == 2 {
|
||||
return strings.Trim(parts[1], "\""), nil
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return "", errors.New("could not parse IOPlatformUUID")
|
||||
}
|
||||
|
||||
type hostIDReaderLinux struct {
|
||||
readFile fileReader
|
||||
}
|
||||
|
||||
// read attempts to read the machine-id from /etc/machine-id followed by
|
||||
// /var/lib/dbus/machine-id. If neither location yields an ID an error will
|
||||
// be returned.
|
||||
func (r *hostIDReaderLinux) read() (string, error) {
|
||||
if result, err := r.readFile("/etc/machine-id"); err == nil {
|
||||
return strings.TrimSpace(result), nil
|
||||
}
|
||||
|
||||
if result, err := r.readFile("/var/lib/dbus/machine-id"); err == nil {
|
||||
return strings.TrimSpace(result), nil
|
||||
}
|
||||
|
||||
return "", errors.New("host id not found in: /etc/machine-id or /var/lib/dbus/machine-id")
|
||||
}
|
||||
|
||||
type hostIDDetector struct{}
|
||||
|
||||
// Detect returns a *Resource containing the platform specific host id.
|
||||
func (hostIDDetector) Detect(ctx context.Context) (*Resource, error) {
|
||||
hostID, err := hostID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewWithAttributes(
|
||||
semconv.SchemaURL,
|
||||
semconv.HostID(hostID),
|
||||
), nil
|
||||
}
|
23
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.go
generated
vendored
Normal file
23
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_bsd.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.
|
||||
|
||||
//go:build dragonfly || freebsd || netbsd || openbsd || solaris
|
||||
// +build dragonfly freebsd netbsd openbsd solaris
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
var platformHostIDReader hostIDReader = &hostIDReaderBSD{
|
||||
execCommand: execCommand,
|
||||
readFile: readFile,
|
||||
}
|
19
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
generated
vendored
Normal file
19
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_darwin.go
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
// 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 resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
var platformHostIDReader hostIDReader = &hostIDReaderDarwin{
|
||||
execCommand: execCommand,
|
||||
}
|
29
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
generated
vendored
Normal file
29
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_exec.go
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// 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.
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || netbsd || openbsd || solaris
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
import "os/exec"
|
||||
|
||||
func execCommand(name string, arg ...string) (string, error) {
|
||||
cmd := exec.Command(name, arg...)
|
||||
b, err := cmd.Output()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(b), nil
|
||||
}
|
22
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
generated
vendored
Normal file
22
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_linux.go
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
// 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.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
var platformHostIDReader hostIDReader = &hostIDReaderLinux{
|
||||
readFile: readFile,
|
||||
}
|
28
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
generated
vendored
Normal file
28
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_readfile.go
generated
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
// 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.
|
||||
|
||||
//go:build linux || dragonfly || freebsd || netbsd || openbsd || solaris
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
import "os"
|
||||
|
||||
func readFile(filename string) (string, error) {
|
||||
b, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return string(b), nil
|
||||
}
|
36
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
generated
vendored
Normal file
36
vendor/go.opentelemetry.io/otel/sdk/resource/host_id_unsupported.go
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// 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.
|
||||
|
||||
// +build !darwin
|
||||
// +build !dragonfly
|
||||
// +build !freebsd
|
||||
// +build !linux
|
||||
// +build !netbsd
|
||||
// +build !openbsd
|
||||
// +build !solaris
|
||||
// +build !windows
|
||||
|
||||
package resource // import "go.opentelemetry.io/otel/sdk/resource"
|
||||
|
||||
// hostIDReaderUnsupported is a placeholder implementation for operating systems
|
||||
// for which this project currently doesn't support host.id
|
||||
// attribute detection. See build tags declaration early on this file
|
||||
// for a list of unsupported OSes.
|
||||
type hostIDReaderUnsupported struct{}
|
||||
|
||||
func (*hostIDReaderUnsupported) read() (string, error) {
|
||||
return "<unknown>", nil
|
||||
}
|
||||
|
||||
var platformHostIDReader hostIDReader = &hostIDReaderUnsupported{}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue