mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 04:06:24 +00:00
Align otel dependency with k8s v1.41.0
This commit is contained in:
@@ -77,9 +77,9 @@ require (
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
|
||||
go.opentelemetry.io/otel v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.39.0 // indirect
|
||||
go.opentelemetry.io/otel v1.41.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.41.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.41.0 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/crypto v0.48.0 // indirect
|
||||
|
||||
@@ -1187,8 +1187,8 @@ go.opentelemetry.io/otel v0.20.0/go.mod h1:Y3ugLH2oa81t5QO+Lty+zXf8zC9L26ax4Nzox
|
||||
go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
|
||||
go.opentelemetry.io/otel v1.6.0/go.mod h1:bfJD2DZVw0LBxghOTlgnlI0CV3hLDu9XF/QKOUXMTQQ=
|
||||
go.opentelemetry.io/otel v1.6.1/go.mod h1:blzUabWHkX6LJewxvadmzafgh/wnvBSDBdOuwkAtrWQ=
|
||||
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
|
||||
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
|
||||
go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c=
|
||||
go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE=
|
||||
go.opentelemetry.io/otel/exporters/otlp v0.20.0/go.mod h1:YIieizyaN77rtLJra0buKiNBOm9XQfkPEKBeuhoMwAM=
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4=
|
||||
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.6.1/go.mod h1:NEu79Xo32iVb+0gVNV8PMd7GoWqnyDXRlj04yFjqz40=
|
||||
@@ -1200,8 +1200,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0/go.mod h1
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.6.1/go.mod h1:DAKwdo06hFLc0U88O10x4xnb5sc7dDRDqRuiN+io8JE=
|
||||
go.opentelemetry.io/otel/metric v0.20.0/go.mod h1:598I5tYlH1vzBjn+BTuhzTCSb/9debfNp6R3s7Pr1eU=
|
||||
go.opentelemetry.io/otel/metric v0.28.0/go.mod h1:TrzsfQAmQaB1PDcdhBauLMk7nyyg9hm+GoQq/ekE9Iw=
|
||||
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
|
||||
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
|
||||
go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ=
|
||||
go.opentelemetry.io/otel/metric v1.41.0/go.mod h1:xPvCwd9pU0VN8tPZYzDZV/BMj9CM9vs00GuBjeKhJps=
|
||||
go.opentelemetry.io/otel/oteltest v0.20.0/go.mod h1:L7bgKf9ZB7qCwT9Up7i9/pn0PWIa9FqQ2IQ8LoxiGnw=
|
||||
go.opentelemetry.io/otel/sdk v0.20.0/go.mod h1:g/IcepuwNsoiX5Byy2nNV0ySUF1em498m7hBWC279Yc=
|
||||
go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
|
||||
@@ -1216,8 +1216,8 @@ go.opentelemetry.io/otel/trace v0.20.0/go.mod h1:6GjCW8zgDjwGHGa6GkyeB8+/5vjT16g
|
||||
go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
|
||||
go.opentelemetry.io/otel/trace v1.6.0/go.mod h1:qs7BrU5cZ8dXQHBGxHMOxwME/27YH2qEp4/+tZLLwJE=
|
||||
go.opentelemetry.io/otel/trace v1.6.1/go.mod h1:RkFRM1m0puWIq10oxImnGEduNBzxiN7TXluRBtE+5j0=
|
||||
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
|
||||
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
|
||||
go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0=
|
||||
go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis=
|
||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||
go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ=
|
||||
go.opentelemetry.io/proto/otlp v0.12.1/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
|
||||
|
||||
+5
@@ -16,6 +16,7 @@ linters:
|
||||
- govet
|
||||
- ineffassign
|
||||
- misspell
|
||||
- modernize
|
||||
- perfsprint
|
||||
- revive
|
||||
- staticcheck
|
||||
@@ -111,6 +112,9 @@ linters:
|
||||
locale: US
|
||||
ignore-rules:
|
||||
- cancelled
|
||||
modernize:
|
||||
disable:
|
||||
- omitzero
|
||||
perfsprint:
|
||||
int-conversion: true
|
||||
err-error: true
|
||||
@@ -190,6 +194,7 @@ linters:
|
||||
arguments:
|
||||
- ["ID"] # AllowList
|
||||
- ["Otel", "Aws", "Gcp"] # DenyList
|
||||
- - skip-package-name-collision-with-go-std: true
|
||||
- name: waitgroup-by-value
|
||||
testifylint:
|
||||
enable-all: true
|
||||
|
||||
+59
-1
@@ -8,9 +8,64 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.41.0/0.63.0/0.17.0/0.0.15] 2026-03-02
|
||||
|
||||
This release is the last to support [Go 1.24].
|
||||
The next release will require at least [Go 1.25].
|
||||
|
||||
### Added
|
||||
|
||||
- Support testing of [Go 1.26]. (#7902)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Update `Baggage` in `go.opentelemetry.io/otel/propagation` and `Parse` and `New` in `go.opentelemetry.io/otel/baggage` to comply with W3C Baggage specification limits.
|
||||
`New` and `Parse` now return partial baggage along with an error when limits are exceeded.
|
||||
Errors from baggage extraction are reported to the global error handler. (#7880)
|
||||
- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7914)
|
||||
- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#7914)
|
||||
- Return an error when the endpoint is configured as insecure and with TLS configuration in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7914)
|
||||
|
||||
<!-- Released section -->
|
||||
<!-- Don't change this section unless doing release -->
|
||||
|
||||
## [1.40.0/0.62.0/0.16.0] 2026-02-02
|
||||
|
||||
### Added
|
||||
|
||||
- Add `AlwaysRecord` sampler in `go.opentelemetry.io/otel/sdk/trace`. (#7724)
|
||||
- Add `Enabled` method to all synchronous instrument interfaces (`Float64Counter`, `Float64UpDownCounter`, `Float64Histogram`, `Float64Gauge`, `Int64Counter`, `Int64UpDownCounter`, `Int64Histogram`, `Int64Gauge`,) in `go.opentelemetry.io/otel/metric`.
|
||||
This stabilizes the synchronous instrument enabled feature, allowing users to check if an instrument will process measurements before performing computationally expensive operations. (#7763)
|
||||
- Add `go.opentelemetry.io/otel/semconv/v1.39.0` package.
|
||||
The package contains semantic conventions from the `v1.39.0` version of the OpenTelemetry Semantic Conventions.
|
||||
See the [migration documentation](./semconv/v1.39.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.38.0.` (#7783, #7789)
|
||||
|
||||
### Changed
|
||||
|
||||
- Improve the concurrent performance of `HistogramReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar` by 4x. (#7443)
|
||||
- Improve the concurrent performance of `FixedSizeReservoir` in `go.opentelemetry.io/otel/sdk/metric/exemplar`. (#7447)
|
||||
- Improve performance of concurrent histogram measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7474)
|
||||
- Improve performance of concurrent synchronous gauge measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7478)
|
||||
- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/stdout/stdoutmetric`. (#7492)
|
||||
- `Exporter` in `go.opentelemetry.io/otel/exporters/prometheus` ignores metrics with the scope `go.opentelemetry.io/contrib/bridges/prometheus`.
|
||||
This prevents scrape failures when the Prometheus exporter is misconfigured to get data from the Prometheus bridge. (#7688)
|
||||
- Improve performance of concurrent exponential histogram measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7702)
|
||||
- The `rpc.grpc.status_code` attribute in the experimental metrics emitted from `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc` is replaced with the `rpc.response.status_code` attribute to align with the semantic conventions. (#7854)
|
||||
- The `rpc.grpc.status_code` attribute in the experimental metrics emitted from `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc` is replaced with the `rpc.response.status_code` attribute to align with the semantic conventions. (#7854)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix bad log message when key-value pairs are dropped because of key duplication in `go.opentelemetry.io/otel/sdk/log`. (#7662)
|
||||
- Fix `DroppedAttributes` on `Record` in `go.opentelemetry.io/otel/sdk/log` to not count the non-attribute key-value pairs dropped because of key duplication. (#7662)
|
||||
- Fix `SetAttributes` on `Record` in `go.opentelemetry.io/otel/sdk/log` to not log that attributes are dropped when they are actually not dropped. (#7662)
|
||||
- Fix missing `request.GetBody` in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp` to correctly handle HTTP/2 `GOAWAY` frame. (#7794)
|
||||
- `WithHostID` detector in `go.opentelemetry.io/otel/sdk/resource` to use full path for `ioreg` command on Darwin (macOS). (#7818)
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Deprecate `go.opentelemetry.io/otel/exporters/zipkin`.
|
||||
For more information, see the [OTel blog post deprecating the Zipkin exporter](https://opentelemetry.io/blog/2025/deprecating-zipkin-exporters/). (#7670)
|
||||
|
||||
## [1.39.0/0.61.0/0.15.0/0.0.14] 2025-12-05
|
||||
|
||||
### Added
|
||||
@@ -3498,7 +3553,9 @@ 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.39.0...HEAD
|
||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.41.0...HEAD
|
||||
[1.41.0/0.63.0/0.17.0/0.0.15]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.41.0
|
||||
[1.40.0/0.62.0/0.16.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.40.0
|
||||
[1.39.0/0.61.0/0.15.0/0.0.14]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.39.0
|
||||
[1.38.0/0.60.0/0.14.0/0.0.13]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.38.0
|
||||
[0.59.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/exporters/prometheus/v0.59.1
|
||||
@@ -3597,6 +3654,7 @@ It contains api and sdk for trace and meter.
|
||||
|
||||
<!-- Released section ended -->
|
||||
|
||||
[Go 1.26]: https://go.dev/doc/go1.26
|
||||
[Go 1.25]: https://go.dev/doc/go1.25
|
||||
[Go 1.24]: https://go.dev/doc/go1.24
|
||||
[Go 1.23]: https://go.dev/doc/go1.23
|
||||
|
||||
+3
-3
@@ -746,8 +746,8 @@ Encapsulate setup in constructor functions, ensuring clear ownership and scope:
|
||||
import (
|
||||
"errors"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.37.0/otelconv"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.39.0/otelconv"
|
||||
)
|
||||
|
||||
type SDKComponent struct {
|
||||
@@ -1039,7 +1039,7 @@ func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan)
|
||||
|
||||
All observability metrics should follow the [OpenTelemetry Semantic Conventions for SDK metrics](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/otel/sdk-metrics.md).
|
||||
|
||||
Use the metric semantic conventions convenience package [otelconv](./semconv/v1.37.0/otelconv/metric.go).
|
||||
Use the metric semantic conventions convenience package [otelconv](./semconv/v1.39.0/otelconv/metric.go).
|
||||
|
||||
##### Component Identification
|
||||
|
||||
|
||||
+1
-1
@@ -215,7 +215,7 @@ go-mod-tidy/%: crosslink
|
||||
&& $(GO) mod tidy -compat=1.21
|
||||
|
||||
.PHONY: lint
|
||||
lint: misspell go-mod-tidy golangci-lint govulncheck
|
||||
lint: misspell go-mod-tidy golangci-lint
|
||||
|
||||
.PHONY: vanity-import-check
|
||||
vanity-import-check: $(PORTO)
|
||||
|
||||
+7
@@ -53,18 +53,25 @@ Currently, this project supports the following environments.
|
||||
|
||||
| OS | Go Version | Architecture |
|
||||
|----------|------------|--------------|
|
||||
| Ubuntu | 1.26 | amd64 |
|
||||
| Ubuntu | 1.25 | amd64 |
|
||||
| Ubuntu | 1.24 | amd64 |
|
||||
| Ubuntu | 1.26 | 386 |
|
||||
| Ubuntu | 1.25 | 386 |
|
||||
| Ubuntu | 1.24 | 386 |
|
||||
| Ubuntu | 1.26 | arm64 |
|
||||
| Ubuntu | 1.25 | arm64 |
|
||||
| Ubuntu | 1.24 | arm64 |
|
||||
| macOS | 1.26 | amd64 |
|
||||
| macOS | 1.25 | amd64 |
|
||||
| macOS | 1.24 | amd64 |
|
||||
| macOS | 1.26 | arm64 |
|
||||
| macOS | 1.25 | arm64 |
|
||||
| macOS | 1.24 | arm64 |
|
||||
| Windows | 1.26 | amd64 |
|
||||
| Windows | 1.25 | amd64 |
|
||||
| Windows | 1.24 | amd64 |
|
||||
| Windows | 1.26 | 386 |
|
||||
| Windows | 1.25 | 386 |
|
||||
| Windows | 1.24 | 386 |
|
||||
|
||||
|
||||
+4
-8
@@ -13,32 +13,28 @@ import (
|
||||
|
||||
// BoolSliceValue converts a bool slice into an array with same elements as slice.
|
||||
func BoolSliceValue(v []bool) any {
|
||||
var zero bool
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[bool]())).Elem()
|
||||
reflect.Copy(cp, reflect.ValueOf(v))
|
||||
return cp.Interface()
|
||||
}
|
||||
|
||||
// Int64SliceValue converts an int64 slice into an array with same elements as slice.
|
||||
func Int64SliceValue(v []int64) any {
|
||||
var zero int64
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[int64]())).Elem()
|
||||
reflect.Copy(cp, reflect.ValueOf(v))
|
||||
return cp.Interface()
|
||||
}
|
||||
|
||||
// Float64SliceValue converts a float64 slice into an array with same elements as slice.
|
||||
func Float64SliceValue(v []float64) any {
|
||||
var zero float64
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[float64]())).Elem()
|
||||
reflect.Copy(cp, reflect.ValueOf(v))
|
||||
return cp.Interface()
|
||||
}
|
||||
|
||||
// StringSliceValue converts a string slice into an array with same elements as slice.
|
||||
func StringSliceValue(v []string) any {
|
||||
var zero string
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(zero))).Elem()
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[string]())).Elem()
|
||||
reflect.Copy(cp, reflect.ValueOf(v))
|
||||
return cp.Interface()
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ func isComparable[T comparable](t T) T { return t }
|
||||
|
||||
var (
|
||||
// keyValueType is used in computeDistinctReflect.
|
||||
keyValueType = reflect.TypeOf(KeyValue{})
|
||||
keyValueType = reflect.TypeFor[KeyValue]()
|
||||
|
||||
// emptyHash is the hash of an empty set.
|
||||
emptyHash = xxhash.New().Sum64()
|
||||
|
||||
+1
-2
@@ -66,8 +66,7 @@ func IntValue(v int) Value {
|
||||
|
||||
// IntSliceValue creates an INTSLICE Value.
|
||||
func IntSliceValue(v []int) Value {
|
||||
var int64Val int64
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeOf(int64Val)))
|
||||
cp := reflect.New(reflect.ArrayOf(len(v), reflect.TypeFor[int64]()))
|
||||
for i, val := range v {
|
||||
cp.Elem().Index(i).SetInt(int64(val))
|
||||
}
|
||||
|
||||
+85
-28
@@ -14,8 +14,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
maxMembers = 180
|
||||
maxBytesPerMembers = 4096
|
||||
maxMembers = 64
|
||||
maxBytesPerBaggageString = 8192
|
||||
|
||||
listDelimiter = ","
|
||||
@@ -29,7 +28,6 @@ var (
|
||||
errInvalidProperty = errors.New("invalid baggage list-member property")
|
||||
errInvalidMember = errors.New("invalid baggage list-member")
|
||||
errMemberNumber = errors.New("too many list-members in baggage-string")
|
||||
errMemberBytes = errors.New("list-member too large")
|
||||
errBaggageBytes = errors.New("baggage-string too large")
|
||||
)
|
||||
|
||||
@@ -309,15 +307,11 @@ func newInvalidMember() Member {
|
||||
// an error if the input is invalid according to the W3C Baggage
|
||||
// specification.
|
||||
func parseMember(member string) (Member, error) {
|
||||
if n := len(member); n > maxBytesPerMembers {
|
||||
return newInvalidMember(), fmt.Errorf("%w: %d", errMemberBytes, n)
|
||||
}
|
||||
|
||||
var props properties
|
||||
keyValue, properties, found := strings.Cut(member, propertyDelimiter)
|
||||
if found {
|
||||
// Parse the member properties.
|
||||
for _, pStr := range strings.Split(properties, propertyDelimiter) {
|
||||
for pStr := range strings.SplitSeq(properties, propertyDelimiter) {
|
||||
p, err := parseProperty(pStr)
|
||||
if err != nil {
|
||||
return newInvalidMember(), err
|
||||
@@ -430,6 +424,10 @@ type Baggage struct { //nolint:golint
|
||||
// New returns a new valid Baggage. It returns an error if it results in a
|
||||
// Baggage exceeding limits set in that specification.
|
||||
//
|
||||
// If the resulting Baggage exceeds the maximum allowed members or bytes,
|
||||
// members are dropped until the limits are satisfied and an error is returned
|
||||
// along with the partial result.
|
||||
//
|
||||
// It expects all the provided members to have already been validated.
|
||||
func New(members ...Member) (Baggage, error) {
|
||||
if len(members) == 0 {
|
||||
@@ -441,7 +439,6 @@ func New(members ...Member) (Baggage, error) {
|
||||
if !m.hasData {
|
||||
return Baggage{}, errInvalidMember
|
||||
}
|
||||
|
||||
// OpenTelemetry resolves duplicates by last-one-wins.
|
||||
b[m.key] = baggage.Item{
|
||||
Value: m.value,
|
||||
@@ -449,17 +446,42 @@ func New(members ...Member) (Baggage, error) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check member numbers after deduplication.
|
||||
var truncateErr error
|
||||
|
||||
// Check member count after deduplication.
|
||||
if len(b) > maxMembers {
|
||||
return Baggage{}, errMemberNumber
|
||||
truncateErr = errors.Join(truncateErr, errMemberNumber)
|
||||
for k := range b {
|
||||
if len(b) <= maxMembers {
|
||||
break
|
||||
}
|
||||
delete(b, k)
|
||||
}
|
||||
}
|
||||
|
||||
bag := Baggage{b}
|
||||
if n := len(bag.String()); n > maxBytesPerBaggageString {
|
||||
return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n)
|
||||
// Check byte size and drop members if necessary.
|
||||
totalBytes := 0
|
||||
first := true
|
||||
for k := range b {
|
||||
m := Member{
|
||||
key: k,
|
||||
value: b[k].Value,
|
||||
properties: fromInternalProperties(b[k].Properties),
|
||||
}
|
||||
memberSize := len(m.String())
|
||||
if !first {
|
||||
memberSize++ // comma separator
|
||||
}
|
||||
if totalBytes+memberSize > maxBytesPerBaggageString {
|
||||
truncateErr = errors.Join(truncateErr, fmt.Errorf("%w: %d", errBaggageBytes, totalBytes+memberSize))
|
||||
delete(b, k)
|
||||
continue
|
||||
}
|
||||
totalBytes += memberSize
|
||||
first = false
|
||||
}
|
||||
|
||||
return bag, nil
|
||||
return Baggage{b}, truncateErr
|
||||
}
|
||||
|
||||
// Parse attempts to decode a baggage-string from the passed string. It
|
||||
@@ -470,36 +492,71 @@ func New(members ...Member) (Baggage, error) {
|
||||
// defined (reading left-to-right) will be the only one kept. This diverges
|
||||
// from the W3C Baggage specification which allows duplicate list-members, but
|
||||
// conforms to the OpenTelemetry Baggage specification.
|
||||
//
|
||||
// If the baggage-string exceeds the maximum allowed members (64) or bytes
|
||||
// (8192), members are dropped until the limits are satisfied and an error is
|
||||
// returned along with the partial result.
|
||||
//
|
||||
// Invalid members are skipped and the error is returned along with the
|
||||
// partial result containing the valid members.
|
||||
func Parse(bStr string) (Baggage, error) {
|
||||
if bStr == "" {
|
||||
return Baggage{}, nil
|
||||
}
|
||||
|
||||
if n := len(bStr); n > maxBytesPerBaggageString {
|
||||
return Baggage{}, fmt.Errorf("%w: %d", errBaggageBytes, n)
|
||||
}
|
||||
|
||||
b := make(baggage.List)
|
||||
for _, memberStr := range strings.Split(bStr, listDelimiter) {
|
||||
sizes := make(map[string]int) // Track per-key byte sizes
|
||||
var totalBytes int
|
||||
var truncateErr error
|
||||
for memberStr := range strings.SplitSeq(bStr, listDelimiter) {
|
||||
// Check member count limit.
|
||||
if len(b) >= maxMembers {
|
||||
truncateErr = errors.Join(truncateErr, errMemberNumber)
|
||||
break
|
||||
}
|
||||
|
||||
m, err := parseMember(memberStr)
|
||||
if err != nil {
|
||||
return Baggage{}, err
|
||||
truncateErr = errors.Join(truncateErr, err)
|
||||
continue // skip invalid member, keep processing
|
||||
}
|
||||
|
||||
// Check byte size limit.
|
||||
// Account for comma separator between members.
|
||||
memberBytes := len(m.String())
|
||||
_, existingKey := b[m.key]
|
||||
if !existingKey && len(b) > 0 {
|
||||
memberBytes++ // comma separator only for new keys
|
||||
}
|
||||
|
||||
// Calculate new totalBytes if we add/overwrite this key
|
||||
var newTotalBytes int
|
||||
if oldSize, exists := sizes[m.key]; exists {
|
||||
// Overwriting existing key: subtract old size, add new size
|
||||
newTotalBytes = totalBytes - oldSize + memberBytes
|
||||
} else {
|
||||
// New key
|
||||
newTotalBytes = totalBytes + memberBytes
|
||||
}
|
||||
|
||||
if newTotalBytes > maxBytesPerBaggageString {
|
||||
truncateErr = errors.Join(truncateErr, errBaggageBytes)
|
||||
break
|
||||
}
|
||||
|
||||
// OpenTelemetry resolves duplicates by last-one-wins.
|
||||
b[m.key] = baggage.Item{
|
||||
Value: m.value,
|
||||
Properties: m.properties.asInternal(),
|
||||
}
|
||||
sizes[m.key] = memberBytes
|
||||
totalBytes = newTotalBytes
|
||||
}
|
||||
|
||||
// OpenTelemetry does not allow for duplicate list-members, but the W3C
|
||||
// specification does. Now that we have deduplicated, ensure the baggage
|
||||
// does not exceed list-member limits.
|
||||
if len(b) > maxMembers {
|
||||
return Baggage{}, errMemberNumber
|
||||
if len(b) == 0 {
|
||||
return Baggage{}, truncateErr
|
||||
}
|
||||
|
||||
return Baggage{b}, nil
|
||||
return Baggage{b}, truncateErr
|
||||
}
|
||||
|
||||
// Member returns the baggage list-member identified by key.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# This is a renovate-friendly source of Docker images.
|
||||
FROM python:3.13.6-slim-bullseye@sha256:e98b521460ee75bca92175c16247bdf7275637a8faaeb2bcfa19d879ae5c4b9a AS python
|
||||
FROM otel/weaver:v0.19.0@sha256:3d20814cef548f1d31f27f054fb4cd6a05125641a9f7cc29fc7eb234e8052cd9 AS weaver
|
||||
FROM otel/weaver:v0.21.2@sha256:2401de985c38bdb98b43918e2f43aa36b2afed4aa5669ac1c1de0a17301cd36d AS weaver
|
||||
FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package errorhandler provides the global error handler for OpenTelemetry.
|
||||
//
|
||||
// This package has no OTel dependencies, allowing it to be imported by any
|
||||
// package in the module without creating import cycles.
|
||||
package errorhandler // import "go.opentelemetry.io/otel/internal/errorhandler"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
// ErrorHandler handles irremediable events.
|
||||
type ErrorHandler interface {
|
||||
// Handle handles any error deemed irremediable by an OpenTelemetry
|
||||
// component.
|
||||
Handle(error)
|
||||
}
|
||||
|
||||
type ErrDelegator struct {
|
||||
delegate atomic.Pointer[ErrorHandler]
|
||||
}
|
||||
|
||||
// Compile-time check that delegator implements ErrorHandler.
|
||||
var _ ErrorHandler = (*ErrDelegator)(nil)
|
||||
|
||||
func (d *ErrDelegator) Handle(err error) {
|
||||
if eh := d.delegate.Load(); eh != nil {
|
||||
(*eh).Handle(err)
|
||||
return
|
||||
}
|
||||
log.Print(err)
|
||||
}
|
||||
|
||||
// setDelegate sets the ErrorHandler delegate.
|
||||
func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
|
||||
d.delegate.Store(&eh)
|
||||
}
|
||||
|
||||
type errorHandlerHolder struct {
|
||||
eh ErrorHandler
|
||||
}
|
||||
|
||||
var (
|
||||
globalErrorHandler = defaultErrorHandler()
|
||||
delegateErrorHandlerOnce sync.Once
|
||||
)
|
||||
|
||||
// GetErrorHandler returns the global ErrorHandler instance.
|
||||
//
|
||||
// The default ErrorHandler instance returned will log all errors to STDERR
|
||||
// until an override ErrorHandler is set with SetErrorHandler. All
|
||||
// ErrorHandler returned prior to this will automatically forward errors to
|
||||
// the set instance instead of logging.
|
||||
//
|
||||
// Subsequent calls to SetErrorHandler after the first will not forward errors
|
||||
// to the new ErrorHandler for prior returned instances.
|
||||
func GetErrorHandler() ErrorHandler {
|
||||
return globalErrorHandler.Load().(errorHandlerHolder).eh
|
||||
}
|
||||
|
||||
// SetErrorHandler sets the global ErrorHandler to h.
|
||||
//
|
||||
// The first time this is called all ErrorHandler previously returned from
|
||||
// GetErrorHandler will send errors to h instead of the default logging
|
||||
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
|
||||
// delegate errors to h.
|
||||
func SetErrorHandler(h ErrorHandler) {
|
||||
current := GetErrorHandler()
|
||||
|
||||
if _, cOk := current.(*ErrDelegator); cOk {
|
||||
if _, ehOk := h.(*ErrDelegator); ehOk && current == h {
|
||||
// Do not assign to the delegate of the default ErrDelegator to be
|
||||
// itself.
|
||||
log.Print(errors.New("no ErrorHandler delegate configured"), " ErrorHandler remains its current value.")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
delegateErrorHandlerOnce.Do(func() {
|
||||
if def, ok := current.(*ErrDelegator); ok {
|
||||
def.setDelegate(h)
|
||||
}
|
||||
})
|
||||
globalErrorHandler.Store(errorHandlerHolder{eh: h})
|
||||
}
|
||||
|
||||
func defaultErrorHandler() *atomic.Value {
|
||||
v := &atomic.Value{}
|
||||
v.Store(errorHandlerHolder{eh: &ErrDelegator{}})
|
||||
return v
|
||||
}
|
||||
+7
-27
@@ -5,33 +5,13 @@
|
||||
package global // import "go.opentelemetry.io/otel/internal/global"
|
||||
|
||||
import (
|
||||
"log"
|
||||
"sync/atomic"
|
||||
"go.opentelemetry.io/otel/internal/errorhandler"
|
||||
)
|
||||
|
||||
// ErrorHandler handles irremediable events.
|
||||
type ErrorHandler interface {
|
||||
// Handle handles any error deemed irremediable by an OpenTelemetry
|
||||
// component.
|
||||
Handle(error)
|
||||
}
|
||||
// ErrorHandler is an alias for errorhandler.ErrorHandler, kept for backward
|
||||
// compatibility with existing callers of internal/global.
|
||||
type ErrorHandler = errorhandler.ErrorHandler
|
||||
|
||||
type ErrDelegator struct {
|
||||
delegate atomic.Pointer[ErrorHandler]
|
||||
}
|
||||
|
||||
// Compile-time check that delegator implements ErrorHandler.
|
||||
var _ ErrorHandler = (*ErrDelegator)(nil)
|
||||
|
||||
func (d *ErrDelegator) Handle(err error) {
|
||||
if eh := d.delegate.Load(); eh != nil {
|
||||
(*eh).Handle(err)
|
||||
return
|
||||
}
|
||||
log.Print(err)
|
||||
}
|
||||
|
||||
// setDelegate sets the ErrorHandler delegate.
|
||||
func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
|
||||
d.delegate.Store(&eh)
|
||||
}
|
||||
// ErrDelegator is an alias for errorhandler.ErrDelegator, kept for backward
|
||||
// compatibility with existing callers of internal/global.
|
||||
type ErrDelegator = errorhandler.ErrDelegator
|
||||
|
||||
+56
@@ -229,6 +229,13 @@ func (i *sfCounter) Add(ctx context.Context, incr float64, opts ...metric.AddOpt
|
||||
}
|
||||
}
|
||||
|
||||
func (i *sfCounter) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64Counter).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type sfUpDownCounter struct {
|
||||
embedded.Float64UpDownCounter
|
||||
|
||||
@@ -255,6 +262,13 @@ func (i *sfUpDownCounter) Add(ctx context.Context, incr float64, opts ...metric.
|
||||
}
|
||||
}
|
||||
|
||||
func (i *sfUpDownCounter) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64UpDownCounter).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type sfHistogram struct {
|
||||
embedded.Float64Histogram
|
||||
|
||||
@@ -281,6 +295,13 @@ func (i *sfHistogram) Record(ctx context.Context, x float64, opts ...metric.Reco
|
||||
}
|
||||
}
|
||||
|
||||
func (i *sfHistogram) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64Histogram).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type sfGauge struct {
|
||||
embedded.Float64Gauge
|
||||
|
||||
@@ -307,6 +328,13 @@ func (i *sfGauge) Record(ctx context.Context, x float64, opts ...metric.RecordOp
|
||||
}
|
||||
}
|
||||
|
||||
func (i *sfGauge) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Float64Gauge).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type siCounter struct {
|
||||
embedded.Int64Counter
|
||||
|
||||
@@ -333,6 +361,13 @@ func (i *siCounter) Add(ctx context.Context, x int64, opts ...metric.AddOption)
|
||||
}
|
||||
}
|
||||
|
||||
func (i *siCounter) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64Counter).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type siUpDownCounter struct {
|
||||
embedded.Int64UpDownCounter
|
||||
|
||||
@@ -359,6 +394,13 @@ func (i *siUpDownCounter) Add(ctx context.Context, x int64, opts ...metric.AddOp
|
||||
}
|
||||
}
|
||||
|
||||
func (i *siUpDownCounter) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64UpDownCounter).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type siHistogram struct {
|
||||
embedded.Int64Histogram
|
||||
|
||||
@@ -385,6 +427,13 @@ func (i *siHistogram) Record(ctx context.Context, x int64, opts ...metric.Record
|
||||
}
|
||||
}
|
||||
|
||||
func (i *siHistogram) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64Histogram).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type siGauge struct {
|
||||
embedded.Int64Gauge
|
||||
|
||||
@@ -410,3 +459,10 @@ func (i *siGauge) Record(ctx context.Context, x int64, opts ...metric.RecordOpti
|
||||
ctr.(metric.Int64Gauge).Record(ctx, x, opts...)
|
||||
}
|
||||
}
|
||||
|
||||
func (i *siGauge) Enabled(ctx context.Context) bool {
|
||||
if ctr := i.delegate.Load(); ctr != nil {
|
||||
return ctr.(metric.Int64Gauge).Enabled(ctx)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
+14
-14
@@ -157,7 +157,7 @@ func (m *meter) Int64Counter(name string, options ...metric.Int64CounterOption)
|
||||
cfg := metric.NewInt64CounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*siCounter)(nil)),
|
||||
kind: reflect.TypeFor[*siCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -183,7 +183,7 @@ func (m *meter) Int64UpDownCounter(
|
||||
cfg := metric.NewInt64UpDownCounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*siUpDownCounter)(nil)),
|
||||
kind: reflect.TypeFor[*siUpDownCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -206,7 +206,7 @@ func (m *meter) Int64Histogram(name string, options ...metric.Int64HistogramOpti
|
||||
cfg := metric.NewInt64HistogramConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*siHistogram)(nil)),
|
||||
kind: reflect.TypeFor[*siHistogram](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -229,7 +229,7 @@ func (m *meter) Int64Gauge(name string, options ...metric.Int64GaugeOption) (met
|
||||
cfg := metric.NewInt64GaugeConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*siGauge)(nil)),
|
||||
kind: reflect.TypeFor[*siGauge](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -255,7 +255,7 @@ func (m *meter) Int64ObservableCounter(
|
||||
cfg := metric.NewInt64ObservableCounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*aiCounter)(nil)),
|
||||
kind: reflect.TypeFor[*aiCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -281,7 +281,7 @@ func (m *meter) Int64ObservableUpDownCounter(
|
||||
cfg := metric.NewInt64ObservableUpDownCounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*aiUpDownCounter)(nil)),
|
||||
kind: reflect.TypeFor[*aiUpDownCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -307,7 +307,7 @@ func (m *meter) Int64ObservableGauge(
|
||||
cfg := metric.NewInt64ObservableGaugeConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*aiGauge)(nil)),
|
||||
kind: reflect.TypeFor[*aiGauge](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -330,7 +330,7 @@ func (m *meter) Float64Counter(name string, options ...metric.Float64CounterOpti
|
||||
cfg := metric.NewFloat64CounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*sfCounter)(nil)),
|
||||
kind: reflect.TypeFor[*sfCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -356,7 +356,7 @@ func (m *meter) Float64UpDownCounter(
|
||||
cfg := metric.NewFloat64UpDownCounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*sfUpDownCounter)(nil)),
|
||||
kind: reflect.TypeFor[*sfUpDownCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -382,7 +382,7 @@ func (m *meter) Float64Histogram(
|
||||
cfg := metric.NewFloat64HistogramConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*sfHistogram)(nil)),
|
||||
kind: reflect.TypeFor[*sfHistogram](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -405,7 +405,7 @@ func (m *meter) Float64Gauge(name string, options ...metric.Float64GaugeOption)
|
||||
cfg := metric.NewFloat64GaugeConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*sfGauge)(nil)),
|
||||
kind: reflect.TypeFor[*sfGauge](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -431,7 +431,7 @@ func (m *meter) Float64ObservableCounter(
|
||||
cfg := metric.NewFloat64ObservableCounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*afCounter)(nil)),
|
||||
kind: reflect.TypeFor[*afCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -457,7 +457,7 @@ func (m *meter) Float64ObservableUpDownCounter(
|
||||
cfg := metric.NewFloat64ObservableUpDownCounterConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*afUpDownCounter)(nil)),
|
||||
kind: reflect.TypeFor[*afUpDownCounter](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
@@ -483,7 +483,7 @@ func (m *meter) Float64ObservableGauge(
|
||||
cfg := metric.NewFloat64ObservableGaugeConfig(options...)
|
||||
id := instID{
|
||||
name: name,
|
||||
kind: reflect.TypeOf((*afGauge)(nil)),
|
||||
kind: reflect.TypeFor[*afGauge](),
|
||||
description: cfg.Description(),
|
||||
unit: cfg.Unit(),
|
||||
}
|
||||
|
||||
+3
-33
@@ -8,16 +8,13 @@ import (
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
|
||||
"go.opentelemetry.io/otel/internal/errorhandler"
|
||||
"go.opentelemetry.io/otel/metric"
|
||||
"go.opentelemetry.io/otel/propagation"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
type (
|
||||
errorHandlerHolder struct {
|
||||
eh ErrorHandler
|
||||
}
|
||||
|
||||
tracerProviderHolder struct {
|
||||
tp trace.TracerProvider
|
||||
}
|
||||
@@ -32,12 +29,10 @@ type (
|
||||
)
|
||||
|
||||
var (
|
||||
globalErrorHandler = defaultErrorHandler()
|
||||
globalTracer = defaultTracerValue()
|
||||
globalPropagators = defaultPropagatorsValue()
|
||||
globalMeterProvider = defaultMeterProvider()
|
||||
|
||||
delegateErrorHandlerOnce sync.Once
|
||||
delegateTraceOnce sync.Once
|
||||
delegateTextMapPropagatorOnce sync.Once
|
||||
delegateMeterOnce sync.Once
|
||||
@@ -53,7 +48,7 @@ var (
|
||||
// Subsequent calls to SetErrorHandler after the first will not forward errors
|
||||
// to the new ErrorHandler for prior returned instances.
|
||||
func GetErrorHandler() ErrorHandler {
|
||||
return globalErrorHandler.Load().(errorHandlerHolder).eh
|
||||
return errorhandler.GetErrorHandler()
|
||||
}
|
||||
|
||||
// SetErrorHandler sets the global ErrorHandler to h.
|
||||
@@ -63,26 +58,7 @@ func GetErrorHandler() ErrorHandler {
|
||||
// ErrorHandler. Subsequent calls will set the global ErrorHandler, but not
|
||||
// delegate errors to h.
|
||||
func SetErrorHandler(h ErrorHandler) {
|
||||
current := GetErrorHandler()
|
||||
|
||||
if _, cOk := current.(*ErrDelegator); cOk {
|
||||
if _, ehOk := h.(*ErrDelegator); ehOk && current == h {
|
||||
// Do not assign to the delegate of the default ErrDelegator to be
|
||||
// itself.
|
||||
Error(
|
||||
errors.New("no ErrorHandler delegate configured"),
|
||||
"ErrorHandler remains its current value.",
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
delegateErrorHandlerOnce.Do(func() {
|
||||
if def, ok := current.(*ErrDelegator); ok {
|
||||
def.setDelegate(h)
|
||||
}
|
||||
})
|
||||
globalErrorHandler.Store(errorHandlerHolder{eh: h})
|
||||
errorhandler.SetErrorHandler(h)
|
||||
}
|
||||
|
||||
// TracerProvider is the internal implementation for global.TracerProvider.
|
||||
@@ -174,12 +150,6 @@ func SetMeterProvider(mp metric.MeterProvider) {
|
||||
globalMeterProvider.Store(meterProviderHolder{mp: mp})
|
||||
}
|
||||
|
||||
func defaultErrorHandler() *atomic.Value {
|
||||
v := &atomic.Value{}
|
||||
v.Store(errorHandlerHolder{eh: &ErrDelegator{}})
|
||||
return v
|
||||
}
|
||||
|
||||
func defaultTracerValue() *atomic.Value {
|
||||
v := &atomic.Value{}
|
||||
v.Store(tracerProviderHolder{tp: &tracerProvider{}})
|
||||
|
||||
+8
-1
@@ -211,6 +211,9 @@ type Float64Observer interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Observe(value float64, options ...ObserveOption)
|
||||
}
|
||||
|
||||
@@ -227,7 +230,11 @@ type Float64Observer interface {
|
||||
// attributes as another Float64Callbacks also registered for the same
|
||||
// instrument.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
// The function needs to be reentrant and concurrent safe.
|
||||
//
|
||||
// Note that Go's mutexes are not reentrant, and locking a mutex takes
|
||||
// an indefinite amount of time. It is therefore advised to avoid
|
||||
// using mutexes inside callbacks.
|
||||
type Float64Callback func(context.Context, Float64Observer) error
|
||||
|
||||
// Float64ObservableOption applies options to float64 Observer instruments.
|
||||
|
||||
+8
-1
@@ -210,6 +210,9 @@ type Int64Observer interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Observe(value int64, options ...ObserveOption)
|
||||
}
|
||||
|
||||
@@ -225,7 +228,11 @@ type Int64Observer interface {
|
||||
// attributes as another Int64Callbacks also registered for the same
|
||||
// instrument.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
// The function needs to be reentrant and concurrent safe.
|
||||
//
|
||||
// Note that Go's mutexes are not reentrant, and locking a mutex takes
|
||||
// an indefinite amount of time. It is therefore advised to avoid
|
||||
// using mutexes inside callbacks.
|
||||
type Int64Callback func(context.Context, Int64Observer) error
|
||||
|
||||
// Int64ObservableOption applies options to int64 Observer instruments.
|
||||
|
||||
+58
-2
@@ -30,6 +30,9 @@ type MeterProvider interface {
|
||||
//
|
||||
// If the name is empty, then an implementation defined default name will
|
||||
// be used instead.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Meter(name string, opts ...MeterOption) Meter
|
||||
}
|
||||
|
||||
@@ -51,6 +54,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64Counter(name string, options ...Int64CounterOption) (Int64Counter, error)
|
||||
|
||||
// Int64UpDownCounter returns a new Int64UpDownCounter instrument
|
||||
@@ -61,6 +67,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64UpDownCounter(name string, options ...Int64UpDownCounterOption) (Int64UpDownCounter, error)
|
||||
|
||||
// Int64Histogram returns a new Int64Histogram instrument identified by
|
||||
@@ -71,6 +80,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64Histogram(name string, options ...Int64HistogramOption) (Int64Histogram, error)
|
||||
|
||||
// Int64Gauge returns a new Int64Gauge instrument identified by name and
|
||||
@@ -80,6 +92,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64Gauge(name string, options ...Int64GaugeOption) (Int64Gauge, error)
|
||||
|
||||
// Int64ObservableCounter returns a new Int64ObservableCounter identified
|
||||
@@ -95,6 +110,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64ObservableCounter(name string, options ...Int64ObservableCounterOption) (Int64ObservableCounter, error)
|
||||
|
||||
// Int64ObservableUpDownCounter returns a new Int64ObservableUpDownCounter
|
||||
@@ -110,6 +128,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64ObservableUpDownCounter(
|
||||
name string,
|
||||
options ...Int64ObservableUpDownCounterOption,
|
||||
@@ -128,6 +149,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Int64ObservableGauge(name string, options ...Int64ObservableGaugeOption) (Int64ObservableGauge, error)
|
||||
|
||||
// Float64Counter returns a new Float64Counter instrument identified by
|
||||
@@ -148,6 +172,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Float64UpDownCounter(name string, options ...Float64UpDownCounterOption) (Float64UpDownCounter, error)
|
||||
|
||||
// Float64Histogram returns a new Float64Histogram instrument identified by
|
||||
@@ -158,6 +185,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Float64Histogram(name string, options ...Float64HistogramOption) (Float64Histogram, error)
|
||||
|
||||
// Float64Gauge returns a new Float64Gauge instrument identified by name and
|
||||
@@ -167,6 +197,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Float64Gauge(name string, options ...Float64GaugeOption) (Float64Gauge, error)
|
||||
|
||||
// Float64ObservableCounter returns a new Float64ObservableCounter
|
||||
@@ -182,6 +215,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Float64ObservableCounter(name string, options ...Float64ObservableCounterOption) (Float64ObservableCounter, error)
|
||||
|
||||
// Float64ObservableUpDownCounter returns a new
|
||||
@@ -197,6 +233,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Float64ObservableUpDownCounter(
|
||||
name string,
|
||||
options ...Float64ObservableUpDownCounterOption,
|
||||
@@ -215,6 +254,9 @@ type Meter interface {
|
||||
// The name needs to conform to the OpenTelemetry instrument name syntax.
|
||||
// See the Instrument Name section of the package documentation for more
|
||||
// information.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Float64ObservableGauge(name string, options ...Float64ObservableGaugeOption) (Float64ObservableGauge, error)
|
||||
|
||||
// RegisterCallback registers f to be called during the collection of a
|
||||
@@ -229,6 +271,9 @@ type Meter interface {
|
||||
// If no instruments are passed, f should not be registered nor called
|
||||
// during collection.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
//
|
||||
// The function f needs to be concurrent safe.
|
||||
RegisterCallback(f Callback, instruments ...Observable) (Registration, error)
|
||||
}
|
||||
@@ -244,7 +289,11 @@ type Meter interface {
|
||||
// Callbacks. Meaning, it should not report measurements for an instrument with
|
||||
// the same attributes as another Callback will report.
|
||||
//
|
||||
// The function needs to be concurrent safe.
|
||||
// The function needs to be reentrant and concurrent safe.
|
||||
//
|
||||
// Note that Go's mutexes are not reentrant, and locking a mutex takes
|
||||
// an indefinite amount of time. It is therefore advised to avoid
|
||||
// using mutexes inside callbacks.
|
||||
type Callback func(context.Context, Observer) error
|
||||
|
||||
// Observer records measurements for multiple instruments in a Callback.
|
||||
@@ -259,9 +308,15 @@ type Observer interface {
|
||||
embedded.Observer
|
||||
|
||||
// ObserveFloat64 records the float64 value for obsrv.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
ObserveFloat64(obsrv Float64Observable, value float64, opts ...ObserveOption)
|
||||
|
||||
// ObserveInt64 records the int64 value for obsrv.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
ObserveInt64(obsrv Int64Observable, value int64, opts ...ObserveOption)
|
||||
}
|
||||
|
||||
@@ -279,6 +334,7 @@ type Registration interface {
|
||||
|
||||
// Unregister removes the callback registration from a Meter.
|
||||
//
|
||||
// This method needs to be idempotent and concurrent safe.
|
||||
// Implementations of this method need to be idempotent and safe for a user
|
||||
// to call concurrently.
|
||||
Unregister() error
|
||||
}
|
||||
|
||||
+24
@@ -191,6 +191,9 @@ type Int64Counter struct{ embedded.Int64Counter }
|
||||
// Add performs no operation.
|
||||
func (Int64Counter) Add(context.Context, int64, ...metric.AddOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Int64Counter) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Float64Counter is an OpenTelemetry Counter used to record float64
|
||||
// measurements. It produces no telemetry.
|
||||
type Float64Counter struct{ embedded.Float64Counter }
|
||||
@@ -198,6 +201,9 @@ type Float64Counter struct{ embedded.Float64Counter }
|
||||
// Add performs no operation.
|
||||
func (Float64Counter) Add(context.Context, float64, ...metric.AddOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Float64Counter) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Int64UpDownCounter is an OpenTelemetry UpDownCounter used to record int64
|
||||
// measurements. It produces no telemetry.
|
||||
type Int64UpDownCounter struct{ embedded.Int64UpDownCounter }
|
||||
@@ -205,6 +211,9 @@ type Int64UpDownCounter struct{ embedded.Int64UpDownCounter }
|
||||
// Add performs no operation.
|
||||
func (Int64UpDownCounter) Add(context.Context, int64, ...metric.AddOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Int64UpDownCounter) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Float64UpDownCounter is an OpenTelemetry UpDownCounter used to record
|
||||
// float64 measurements. It produces no telemetry.
|
||||
type Float64UpDownCounter struct{ embedded.Float64UpDownCounter }
|
||||
@@ -212,6 +221,9 @@ type Float64UpDownCounter struct{ embedded.Float64UpDownCounter }
|
||||
// Add performs no operation.
|
||||
func (Float64UpDownCounter) Add(context.Context, float64, ...metric.AddOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Float64UpDownCounter) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Int64Histogram is an OpenTelemetry Histogram used to record int64
|
||||
// measurements. It produces no telemetry.
|
||||
type Int64Histogram struct{ embedded.Int64Histogram }
|
||||
@@ -219,6 +231,9 @@ type Int64Histogram struct{ embedded.Int64Histogram }
|
||||
// Record performs no operation.
|
||||
func (Int64Histogram) Record(context.Context, int64, ...metric.RecordOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Int64Histogram) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Float64Histogram is an OpenTelemetry Histogram used to record float64
|
||||
// measurements. It produces no telemetry.
|
||||
type Float64Histogram struct{ embedded.Float64Histogram }
|
||||
@@ -226,6 +241,9 @@ type Float64Histogram struct{ embedded.Float64Histogram }
|
||||
// Record performs no operation.
|
||||
func (Float64Histogram) Record(context.Context, float64, ...metric.RecordOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Float64Histogram) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Int64Gauge is an OpenTelemetry Gauge used to record instantaneous int64
|
||||
// measurements. It produces no telemetry.
|
||||
type Int64Gauge struct{ embedded.Int64Gauge }
|
||||
@@ -233,6 +251,9 @@ type Int64Gauge struct{ embedded.Int64Gauge }
|
||||
// Record performs no operation.
|
||||
func (Int64Gauge) Record(context.Context, int64, ...metric.RecordOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Int64Gauge) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Float64Gauge is an OpenTelemetry Gauge used to record instantaneous float64
|
||||
// measurements. It produces no telemetry.
|
||||
type Float64Gauge struct{ embedded.Float64Gauge }
|
||||
@@ -240,6 +261,9 @@ type Float64Gauge struct{ embedded.Float64Gauge }
|
||||
// Record performs no operation.
|
||||
func (Float64Gauge) Record(context.Context, float64, ...metric.RecordOption) {}
|
||||
|
||||
// Enabled performs no operation.
|
||||
func (Float64Gauge) Enabled(context.Context) bool { return false }
|
||||
|
||||
// Int64ObservableCounter is an OpenTelemetry ObservableCounter used to record
|
||||
// int64 measurements. It produces no telemetry.
|
||||
type Int64ObservableCounter struct {
|
||||
|
||||
+48
@@ -24,7 +24,19 @@ type Float64Counter interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Add(ctx context.Context, incr float64, options ...AddOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Float64CounterConfig contains options for synchronous counter instruments that
|
||||
@@ -77,7 +89,19 @@ type Float64UpDownCounter interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Add(ctx context.Context, incr float64, options ...AddOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Float64UpDownCounterConfig contains options for synchronous counter
|
||||
@@ -130,7 +154,19 @@ type Float64Histogram interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Record(ctx context.Context, incr float64, options ...RecordOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Float64HistogramConfig contains options for synchronous histogram
|
||||
@@ -188,7 +224,19 @@ type Float64Gauge interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Record(ctx context.Context, value float64, options ...RecordOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Float64GaugeConfig contains options for synchronous gauge instruments that
|
||||
|
||||
+48
@@ -24,7 +24,19 @@ type Int64Counter interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Add(ctx context.Context, incr int64, options ...AddOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Int64CounterConfig contains options for synchronous counter instruments that
|
||||
@@ -77,7 +89,19 @@ type Int64UpDownCounter interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Add(ctx context.Context, incr int64, options ...AddOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Int64UpDownCounterConfig contains options for synchronous counter
|
||||
@@ -130,7 +154,19 @@ type Int64Histogram interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Record(ctx context.Context, incr int64, options ...RecordOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Int64HistogramConfig contains options for synchronous histogram instruments
|
||||
@@ -188,7 +224,19 @@ type Int64Gauge interface {
|
||||
//
|
||||
// Use the WithAttributeSet (or, if performance is not a concern,
|
||||
// the WithAttributes) option to include measurement attributes.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Record(ctx context.Context, value int64, options ...RecordOption)
|
||||
|
||||
// Enabled reports whether the instrument will process measurements for the given context.
|
||||
//
|
||||
// This function can be used in places where measuring an instrument
|
||||
// would result in computationally expensive operations.
|
||||
//
|
||||
// Implementations of this method need to be safe for a user to call
|
||||
// concurrently.
|
||||
Enabled(context.Context) bool
|
||||
}
|
||||
|
||||
// Int64GaugeConfig contains options for synchronous gauge instruments that
|
||||
|
||||
+22
-2
@@ -7,9 +7,16 @@ import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/baggage"
|
||||
"go.opentelemetry.io/otel/internal/errorhandler"
|
||||
)
|
||||
|
||||
const baggageHeader = "baggage"
|
||||
const (
|
||||
baggageHeader = "baggage"
|
||||
|
||||
// W3C Baggage specification limits.
|
||||
// https://www.w3.org/TR/baggage/#limits
|
||||
maxMembers = 64
|
||||
)
|
||||
|
||||
// Baggage is a propagator that supports the W3C Baggage format.
|
||||
//
|
||||
@@ -50,6 +57,9 @@ func extractSingleBaggage(parent context.Context, carrier TextMapCarrier) contex
|
||||
|
||||
bag, err := baggage.Parse(bStr)
|
||||
if err != nil {
|
||||
errorhandler.GetErrorHandler().Handle(err)
|
||||
}
|
||||
if bag.Len() == 0 {
|
||||
return parent
|
||||
}
|
||||
return baggage.ContextWithBaggage(parent, bag)
|
||||
@@ -60,17 +70,27 @@ func extractMultiBaggage(parent context.Context, carrier ValuesGetter) context.C
|
||||
if len(bVals) == 0 {
|
||||
return parent
|
||||
}
|
||||
|
||||
var members []baggage.Member
|
||||
for _, bStr := range bVals {
|
||||
currBag, err := baggage.Parse(bStr)
|
||||
if err != nil {
|
||||
errorhandler.GetErrorHandler().Handle(err)
|
||||
}
|
||||
if currBag.Len() == 0 {
|
||||
continue
|
||||
}
|
||||
members = append(members, currBag.Members()...)
|
||||
if len(members) >= maxMembers {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
b, err := baggage.New(members...)
|
||||
if err != nil || b.Len() == 0 {
|
||||
if err != nil {
|
||||
errorhandler.GetErrorHandler().Handle(err)
|
||||
}
|
||||
if b.Len() == 0 {
|
||||
return parent
|
||||
}
|
||||
return baggage.ContextWithBaggage(parent, b)
|
||||
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
<!-- Generated. DO NOT MODIFY. -->
|
||||
# Migration from v1.38.0 to v1.39.0
|
||||
|
||||
The `go.opentelemetry.io/otel/semconv/v1.39.0` package should be a drop-in replacement for `go.opentelemetry.io/otel/semconv/v1.38.0` with the following exceptions.
|
||||
|
||||
## Removed
|
||||
|
||||
The following declarations have been removed.
|
||||
Refer to the [OpenTelemetry Semantic Conventions documentation] for deprecation instructions.
|
||||
|
||||
If the type is not listed in the documentation as deprecated, it has been removed in this version due to lack of applicability or use.
|
||||
If you use any of these non-deprecated declarations in your Go application, please [open an issue] describing your use-case.
|
||||
|
||||
- `LinuxMemorySlabStateKey`
|
||||
- `LinuxMemorySlabStateReclaimable`
|
||||
- `LinuxMemorySlabStateUnreclaimable`
|
||||
- `PeerService`
|
||||
- `PeerServiceKey`
|
||||
- `RPCConnectRPCErrorCodeAborted`
|
||||
- `RPCConnectRPCErrorCodeAlreadyExists`
|
||||
- `RPCConnectRPCErrorCodeCancelled`
|
||||
- `RPCConnectRPCErrorCodeDataLoss`
|
||||
- `RPCConnectRPCErrorCodeDeadlineExceeded`
|
||||
- `RPCConnectRPCErrorCodeFailedPrecondition`
|
||||
- `RPCConnectRPCErrorCodeInternal`
|
||||
- `RPCConnectRPCErrorCodeInvalidArgument`
|
||||
- `RPCConnectRPCErrorCodeKey`
|
||||
- `RPCConnectRPCErrorCodeNotFound`
|
||||
- `RPCConnectRPCErrorCodeOutOfRange`
|
||||
- `RPCConnectRPCErrorCodePermissionDenied`
|
||||
- `RPCConnectRPCErrorCodeResourceExhausted`
|
||||
- `RPCConnectRPCErrorCodeUnauthenticated`
|
||||
- `RPCConnectRPCErrorCodeUnavailable`
|
||||
- `RPCConnectRPCErrorCodeUnimplemented`
|
||||
- `RPCConnectRPCErrorCodeUnknown`
|
||||
- `RPCConnectRPCRequestMetadata`
|
||||
- `RPCConnectRPCResponseMetadata`
|
||||
- `RPCGRPCRequestMetadata`
|
||||
- `RPCGRPCResponseMetadata`
|
||||
- `RPCGRPCStatusCodeAborted`
|
||||
- `RPCGRPCStatusCodeAlreadyExists`
|
||||
- `RPCGRPCStatusCodeCancelled`
|
||||
- `RPCGRPCStatusCodeDataLoss`
|
||||
- `RPCGRPCStatusCodeDeadlineExceeded`
|
||||
- `RPCGRPCStatusCodeFailedPrecondition`
|
||||
- `RPCGRPCStatusCodeInternal`
|
||||
- `RPCGRPCStatusCodeInvalidArgument`
|
||||
- `RPCGRPCStatusCodeKey`
|
||||
- `RPCGRPCStatusCodeNotFound`
|
||||
- `RPCGRPCStatusCodeOk`
|
||||
- `RPCGRPCStatusCodeOutOfRange`
|
||||
- `RPCGRPCStatusCodePermissionDenied`
|
||||
- `RPCGRPCStatusCodeResourceExhausted`
|
||||
- `RPCGRPCStatusCodeUnauthenticated`
|
||||
- `RPCGRPCStatusCodeUnavailable`
|
||||
- `RPCGRPCStatusCodeUnimplemented`
|
||||
- `RPCGRPCStatusCodeUnknown`
|
||||
- `RPCJSONRPCErrorCode`
|
||||
- `RPCJSONRPCErrorCodeKey`
|
||||
- `RPCJSONRPCErrorMessage`
|
||||
- `RPCJSONRPCErrorMessageKey`
|
||||
- `RPCJSONRPCRequestID`
|
||||
- `RPCJSONRPCRequestIDKey`
|
||||
- `RPCJSONRPCVersion`
|
||||
- `RPCJSONRPCVersionKey`
|
||||
- `RPCService`
|
||||
- `RPCServiceKey`
|
||||
- `RPCSystemApacheDubbo`
|
||||
- `RPCSystemConnectRPC`
|
||||
- `RPCSystemDotnetWcf`
|
||||
- `RPCSystemGRPC`
|
||||
- `RPCSystemJSONRPC`
|
||||
- `RPCSystemJavaRmi`
|
||||
- `RPCSystemKey`
|
||||
- `RPCSystemOncRPC`
|
||||
|
||||
[OpenTelemetry Semantic Conventions documentation]: https://github.com/open-telemetry/semantic-conventions
|
||||
[open an issue]: https://github.com/open-telemetry/opentelemetry-go/issues/new?template=Blank+issue
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
# Semconv v1.39.0
|
||||
|
||||
[](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.39.0)
|
||||
+16239
File diff suppressed because it is too large
Load Diff
+9
@@ -0,0 +1,9 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package semconv implements OpenTelemetry semantic conventions.
|
||||
//
|
||||
// OpenTelemetry semantic conventions are agreed standardized naming
|
||||
// patterns for OpenTelemetry things. This package represents the v1.39.0
|
||||
// version of the OpenTelemetry semantic conventions.
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// ErrorType returns an [attribute.KeyValue] identifying the error type of err.
|
||||
//
|
||||
// If err is nil, the returned attribute has the default value
|
||||
// [ErrorTypeOther].
|
||||
//
|
||||
// If err's type has the method
|
||||
//
|
||||
// ErrorType() string
|
||||
//
|
||||
// then the returned attribute has the value of err.ErrorType(). Otherwise, the
|
||||
// returned attribute has a value derived from the concrete type of err.
|
||||
//
|
||||
// The key of the returned attribute is [ErrorTypeKey].
|
||||
func ErrorType(err error) attribute.KeyValue {
|
||||
if err == nil {
|
||||
return ErrorTypeOther
|
||||
}
|
||||
|
||||
return ErrorTypeKey.String(errorType(err))
|
||||
}
|
||||
|
||||
func errorType(err error) string {
|
||||
var s string
|
||||
if et, ok := err.(interface{ ErrorType() string }); ok {
|
||||
// Prioritize the ErrorType method if available.
|
||||
s = et.ErrorType()
|
||||
}
|
||||
if s == "" {
|
||||
// Fallback to reflection if the ErrorType method is not supported or
|
||||
// returns an empty value.
|
||||
|
||||
t := reflect.TypeOf(err)
|
||||
pkg, name := t.PkgPath(), t.Name()
|
||||
if pkg != "" && name != "" {
|
||||
s = pkg + "." + name
|
||||
} else {
|
||||
// The type has no package path or name (predeclared, not-defined,
|
||||
// or alias for a not-defined type).
|
||||
//
|
||||
// This is not guaranteed to be unique, but is a best effort.
|
||||
s = t.String()
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
|
||||
const (
|
||||
// ExceptionEventName is the name of the Span event representing an exception.
|
||||
ExceptionEventName = "exception"
|
||||
)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
|
||||
// SchemaURL is the schema URL that matches the version of the semantic conventions
|
||||
// that this package defines. Semconv packages starting from v1.4.0 must declare
|
||||
// non-empty schema URL in the form https://opentelemetry.io/schemas/<version>
|
||||
const SchemaURL = "https://opentelemetry.io/schemas/1.39.0"
|
||||
+1
-1
@@ -20,7 +20,7 @@ import (
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/codes"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.39.0"
|
||||
"go.opentelemetry.io/otel/trace/embedded"
|
||||
"go.opentelemetry.io/otel/trace/internal/telemetry"
|
||||
)
|
||||
|
||||
+3
@@ -61,6 +61,9 @@ func checkValue(val string) bool {
|
||||
func checkKeyRemain(key string) bool {
|
||||
// ( lcalpha / DIGIT / "_" / "-"/ "*" / "/" )
|
||||
for _, v := range key {
|
||||
if v > 127 {
|
||||
return false
|
||||
}
|
||||
if isAlphaNum(byte(v)) {
|
||||
continue
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,5 +5,5 @@ package otel // import "go.opentelemetry.io/otel"
|
||||
|
||||
// Version is the current release version of OpenTelemetry in use.
|
||||
func Version() string {
|
||||
return "1.39.0"
|
||||
return "1.41.0"
|
||||
}
|
||||
|
||||
+7
-4
@@ -3,7 +3,7 @@
|
||||
|
||||
module-sets:
|
||||
stable-v1:
|
||||
version: v1.39.0
|
||||
version: v1.41.0
|
||||
modules:
|
||||
- go.opentelemetry.io/otel
|
||||
- go.opentelemetry.io/otel/bridge/opencensus
|
||||
@@ -22,11 +22,11 @@ module-sets:
|
||||
- go.opentelemetry.io/otel/sdk/metric
|
||||
- go.opentelemetry.io/otel/trace
|
||||
experimental-metrics:
|
||||
version: v0.61.0
|
||||
version: v0.63.0
|
||||
modules:
|
||||
- go.opentelemetry.io/otel/exporters/prometheus
|
||||
experimental-logs:
|
||||
version: v0.15.0
|
||||
version: v0.17.0
|
||||
modules:
|
||||
- go.opentelemetry.io/otel/log
|
||||
- go.opentelemetry.io/otel/log/logtest
|
||||
@@ -36,7 +36,7 @@ module-sets:
|
||||
- go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp
|
||||
- go.opentelemetry.io/otel/exporters/stdout/stdoutlog
|
||||
experimental-schema:
|
||||
version: v0.0.14
|
||||
version: v0.0.15
|
||||
modules:
|
||||
- go.opentelemetry.io/otel/schema
|
||||
excluded-modules:
|
||||
@@ -46,6 +46,9 @@ modules:
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/prometheus:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
|
||||
Vendored
+5
-3
@@ -346,7 +346,7 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil
|
||||
# go.opentelemetry.io/otel v1.39.0
|
||||
# go.opentelemetry.io/otel v1.41.0
|
||||
## explicit; go 1.24.0
|
||||
go.opentelemetry.io/otel
|
||||
go.opentelemetry.io/otel/attribute
|
||||
@@ -355,18 +355,20 @@ go.opentelemetry.io/otel/attribute/internal/xxhash
|
||||
go.opentelemetry.io/otel/baggage
|
||||
go.opentelemetry.io/otel/codes
|
||||
go.opentelemetry.io/otel/internal/baggage
|
||||
go.opentelemetry.io/otel/internal/errorhandler
|
||||
go.opentelemetry.io/otel/internal/global
|
||||
go.opentelemetry.io/otel/propagation
|
||||
go.opentelemetry.io/otel/semconv/v1.20.0
|
||||
go.opentelemetry.io/otel/semconv/v1.26.0
|
||||
go.opentelemetry.io/otel/semconv/v1.30.0
|
||||
go.opentelemetry.io/otel/semconv/v1.37.0
|
||||
# go.opentelemetry.io/otel/metric v1.39.0
|
||||
go.opentelemetry.io/otel/semconv/v1.39.0
|
||||
# go.opentelemetry.io/otel/metric v1.41.0
|
||||
## explicit; go 1.24.0
|
||||
go.opentelemetry.io/otel/metric
|
||||
go.opentelemetry.io/otel/metric/embedded
|
||||
go.opentelemetry.io/otel/metric/noop
|
||||
# go.opentelemetry.io/otel/trace v1.39.0
|
||||
# go.opentelemetry.io/otel/trace v1.41.0
|
||||
## explicit; go 1.24.0
|
||||
go.opentelemetry.io/otel/trace
|
||||
go.opentelemetry.io/otel/trace/embedded
|
||||
|
||||
Reference in New Issue
Block a user