mirror of
https://github.com/openshift/source-to-image.git
synced 2026-02-05 03:45:02 +01:00
chore(deps): update opentelemetry-go monorepo to v1.39.0
Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
4dcc198c9b
commit
1658380c87
7
go.mod
7
go.mod
@@ -24,6 +24,7 @@ require (
|
||||
github.com/BurntSushi/toml v1.5.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/Microsoft/hcsshim v0.14.0-rc.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/containerd/cgroups/v3 v3.1.2 // indirect
|
||||
github.com/containerd/errdefs/pkg v0.3.0 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.18.1 // indirect
|
||||
@@ -69,9 +70,9 @@ require (
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
|
||||
go.opentelemetry.io/otel v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.38.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
|
||||
golang.org/x/mod v0.30.0 // indirect
|
||||
golang.org/x/sync v0.18.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
|
||||
12
go.sum
12
go.sum
@@ -221,20 +221,20 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
|
||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
||||
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/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0 h1:aTL7F04bJHUlztTsNGJ2l+6he8c+y/b//eR0jjjemT4=
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.38.0/go.mod h1:kldtb7jDTeol0l3ewcmd8SDvx3EmIE7lyvqbasU3QC4=
|
||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
||||
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/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E=
|
||||
go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA=
|
||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
||||
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/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
|
||||
go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
|
||||
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
|
||||
|
||||
22
vendor/github.com/cespare/xxhash/v2/LICENSE.txt
generated
vendored
Normal file
22
vendor/github.com/cespare/xxhash/v2/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Copyright (c) 2016 Caleb Spare
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
74
vendor/github.com/cespare/xxhash/v2/README.md
generated
vendored
Normal file
74
vendor/github.com/cespare/xxhash/v2/README.md
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
# xxhash
|
||||
|
||||
[](https://pkg.go.dev/github.com/cespare/xxhash/v2)
|
||||
[](https://github.com/cespare/xxhash/actions/workflows/test.yml)
|
||||
|
||||
xxhash is a Go implementation of the 64-bit [xxHash] algorithm, XXH64. This is a
|
||||
high-quality hashing algorithm that is much faster than anything in the Go
|
||||
standard library.
|
||||
|
||||
This package provides a straightforward API:
|
||||
|
||||
```
|
||||
func Sum64(b []byte) uint64
|
||||
func Sum64String(s string) uint64
|
||||
type Digest struct{ ... }
|
||||
func New() *Digest
|
||||
```
|
||||
|
||||
The `Digest` type implements hash.Hash64. Its key methods are:
|
||||
|
||||
```
|
||||
func (*Digest) Write([]byte) (int, error)
|
||||
func (*Digest) WriteString(string) (int, error)
|
||||
func (*Digest) Sum64() uint64
|
||||
```
|
||||
|
||||
The package is written with optimized pure Go and also contains even faster
|
||||
assembly implementations for amd64 and arm64. If desired, the `purego` build tag
|
||||
opts into using the Go code even on those architectures.
|
||||
|
||||
[xxHash]: http://cyan4973.github.io/xxHash/
|
||||
|
||||
## Compatibility
|
||||
|
||||
This package is in a module and the latest code is in version 2 of the module.
|
||||
You need a version of Go with at least "minimal module compatibility" to use
|
||||
github.com/cespare/xxhash/v2:
|
||||
|
||||
* 1.9.7+ for Go 1.9
|
||||
* 1.10.3+ for Go 1.10
|
||||
* Go 1.11 or later
|
||||
|
||||
I recommend using the latest release of Go.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Here are some quick benchmarks comparing the pure-Go and assembly
|
||||
implementations of Sum64.
|
||||
|
||||
| input size | purego | asm |
|
||||
| ---------- | --------- | --------- |
|
||||
| 4 B | 1.3 GB/s | 1.2 GB/s |
|
||||
| 16 B | 2.9 GB/s | 3.5 GB/s |
|
||||
| 100 B | 6.9 GB/s | 8.1 GB/s |
|
||||
| 4 KB | 11.7 GB/s | 16.7 GB/s |
|
||||
| 10 MB | 12.0 GB/s | 17.3 GB/s |
|
||||
|
||||
These numbers were generated on Ubuntu 20.04 with an Intel Xeon Platinum 8252C
|
||||
CPU using the following commands under Go 1.19.2:
|
||||
|
||||
```
|
||||
benchstat <(go test -tags purego -benchtime 500ms -count 15 -bench 'Sum64$')
|
||||
benchstat <(go test -benchtime 500ms -count 15 -bench 'Sum64$')
|
||||
```
|
||||
|
||||
## Projects using this package
|
||||
|
||||
- [InfluxDB](https://github.com/influxdata/influxdb)
|
||||
- [Prometheus](https://github.com/prometheus/prometheus)
|
||||
- [VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics)
|
||||
- [FreeCache](https://github.com/coocood/freecache)
|
||||
- [FastCache](https://github.com/VictoriaMetrics/fastcache)
|
||||
- [Ristretto](https://github.com/dgraph-io/ristretto)
|
||||
- [Badger](https://github.com/dgraph-io/badger)
|
||||
10
vendor/github.com/cespare/xxhash/v2/testall.sh
generated
vendored
Normal file
10
vendor/github.com/cespare/xxhash/v2/testall.sh
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Small convenience script for running the tests with various combinations of
|
||||
# arch/tags. This assumes we're running on amd64 and have qemu available.
|
||||
|
||||
go test ./...
|
||||
go test -tags purego ./...
|
||||
GOARCH=arm64 go test
|
||||
GOARCH=arm64 go test -tags purego
|
||||
243
vendor/github.com/cespare/xxhash/v2/xxhash.go
generated
vendored
Normal file
243
vendor/github.com/cespare/xxhash/v2/xxhash.go
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described
|
||||
// at http://cyan4973.github.io/xxHash/.
|
||||
package xxhash
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"math/bits"
|
||||
)
|
||||
|
||||
const (
|
||||
prime1 uint64 = 11400714785074694791
|
||||
prime2 uint64 = 14029467366897019727
|
||||
prime3 uint64 = 1609587929392839161
|
||||
prime4 uint64 = 9650029242287828579
|
||||
prime5 uint64 = 2870177450012600261
|
||||
)
|
||||
|
||||
// Store the primes in an array as well.
|
||||
//
|
||||
// The consts are used when possible in Go code to avoid MOVs but we need a
|
||||
// contiguous array for the assembly code.
|
||||
var primes = [...]uint64{prime1, prime2, prime3, prime4, prime5}
|
||||
|
||||
// Digest implements hash.Hash64.
|
||||
//
|
||||
// Note that a zero-valued Digest is not ready to receive writes.
|
||||
// Call Reset or create a Digest using New before calling other methods.
|
||||
type Digest struct {
|
||||
v1 uint64
|
||||
v2 uint64
|
||||
v3 uint64
|
||||
v4 uint64
|
||||
total uint64
|
||||
mem [32]byte
|
||||
n int // how much of mem is used
|
||||
}
|
||||
|
||||
// New creates a new Digest with a zero seed.
|
||||
func New() *Digest {
|
||||
return NewWithSeed(0)
|
||||
}
|
||||
|
||||
// NewWithSeed creates a new Digest with the given seed.
|
||||
func NewWithSeed(seed uint64) *Digest {
|
||||
var d Digest
|
||||
d.ResetWithSeed(seed)
|
||||
return &d
|
||||
}
|
||||
|
||||
// Reset clears the Digest's state so that it can be reused.
|
||||
// It uses a seed value of zero.
|
||||
func (d *Digest) Reset() {
|
||||
d.ResetWithSeed(0)
|
||||
}
|
||||
|
||||
// ResetWithSeed clears the Digest's state so that it can be reused.
|
||||
// It uses the given seed to initialize the state.
|
||||
func (d *Digest) ResetWithSeed(seed uint64) {
|
||||
d.v1 = seed + prime1 + prime2
|
||||
d.v2 = seed + prime2
|
||||
d.v3 = seed
|
||||
d.v4 = seed - prime1
|
||||
d.total = 0
|
||||
d.n = 0
|
||||
}
|
||||
|
||||
// Size always returns 8 bytes.
|
||||
func (d *Digest) Size() int { return 8 }
|
||||
|
||||
// BlockSize always returns 32 bytes.
|
||||
func (d *Digest) BlockSize() int { return 32 }
|
||||
|
||||
// Write adds more data to d. It always returns len(b), nil.
|
||||
func (d *Digest) Write(b []byte) (n int, err error) {
|
||||
n = len(b)
|
||||
d.total += uint64(n)
|
||||
|
||||
memleft := d.mem[d.n&(len(d.mem)-1):]
|
||||
|
||||
if d.n+n < 32 {
|
||||
// This new data doesn't even fill the current block.
|
||||
copy(memleft, b)
|
||||
d.n += n
|
||||
return
|
||||
}
|
||||
|
||||
if d.n > 0 {
|
||||
// Finish off the partial block.
|
||||
c := copy(memleft, b)
|
||||
d.v1 = round(d.v1, u64(d.mem[0:8]))
|
||||
d.v2 = round(d.v2, u64(d.mem[8:16]))
|
||||
d.v3 = round(d.v3, u64(d.mem[16:24]))
|
||||
d.v4 = round(d.v4, u64(d.mem[24:32]))
|
||||
b = b[c:]
|
||||
d.n = 0
|
||||
}
|
||||
|
||||
if len(b) >= 32 {
|
||||
// One or more full blocks left.
|
||||
nw := writeBlocks(d, b)
|
||||
b = b[nw:]
|
||||
}
|
||||
|
||||
// Store any remaining partial block.
|
||||
copy(d.mem[:], b)
|
||||
d.n = len(b)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Sum appends the current hash to b and returns the resulting slice.
|
||||
func (d *Digest) Sum(b []byte) []byte {
|
||||
s := d.Sum64()
|
||||
return append(
|
||||
b,
|
||||
byte(s>>56),
|
||||
byte(s>>48),
|
||||
byte(s>>40),
|
||||
byte(s>>32),
|
||||
byte(s>>24),
|
||||
byte(s>>16),
|
||||
byte(s>>8),
|
||||
byte(s),
|
||||
)
|
||||
}
|
||||
|
||||
// Sum64 returns the current hash.
|
||||
func (d *Digest) Sum64() uint64 {
|
||||
var h uint64
|
||||
|
||||
if d.total >= 32 {
|
||||
v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
|
||||
h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
|
||||
h = mergeRound(h, v1)
|
||||
h = mergeRound(h, v2)
|
||||
h = mergeRound(h, v3)
|
||||
h = mergeRound(h, v4)
|
||||
} else {
|
||||
h = d.v3 + prime5
|
||||
}
|
||||
|
||||
h += d.total
|
||||
|
||||
b := d.mem[:d.n&(len(d.mem)-1)]
|
||||
for ; len(b) >= 8; b = b[8:] {
|
||||
k1 := round(0, u64(b[:8]))
|
||||
h ^= k1
|
||||
h = rol27(h)*prime1 + prime4
|
||||
}
|
||||
if len(b) >= 4 {
|
||||
h ^= uint64(u32(b[:4])) * prime1
|
||||
h = rol23(h)*prime2 + prime3
|
||||
b = b[4:]
|
||||
}
|
||||
for ; len(b) > 0; b = b[1:] {
|
||||
h ^= uint64(b[0]) * prime5
|
||||
h = rol11(h) * prime1
|
||||
}
|
||||
|
||||
h ^= h >> 33
|
||||
h *= prime2
|
||||
h ^= h >> 29
|
||||
h *= prime3
|
||||
h ^= h >> 32
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
const (
|
||||
magic = "xxh\x06"
|
||||
marshaledSize = len(magic) + 8*5 + 32
|
||||
)
|
||||
|
||||
// MarshalBinary implements the encoding.BinaryMarshaler interface.
|
||||
func (d *Digest) MarshalBinary() ([]byte, error) {
|
||||
b := make([]byte, 0, marshaledSize)
|
||||
b = append(b, magic...)
|
||||
b = appendUint64(b, d.v1)
|
||||
b = appendUint64(b, d.v2)
|
||||
b = appendUint64(b, d.v3)
|
||||
b = appendUint64(b, d.v4)
|
||||
b = appendUint64(b, d.total)
|
||||
b = append(b, d.mem[:d.n]...)
|
||||
b = b[:len(b)+len(d.mem)-d.n]
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
|
||||
func (d *Digest) UnmarshalBinary(b []byte) error {
|
||||
if len(b) < len(magic) || string(b[:len(magic)]) != magic {
|
||||
return errors.New("xxhash: invalid hash state identifier")
|
||||
}
|
||||
if len(b) != marshaledSize {
|
||||
return errors.New("xxhash: invalid hash state size")
|
||||
}
|
||||
b = b[len(magic):]
|
||||
b, d.v1 = consumeUint64(b)
|
||||
b, d.v2 = consumeUint64(b)
|
||||
b, d.v3 = consumeUint64(b)
|
||||
b, d.v4 = consumeUint64(b)
|
||||
b, d.total = consumeUint64(b)
|
||||
copy(d.mem[:], b)
|
||||
d.n = int(d.total % uint64(len(d.mem)))
|
||||
return nil
|
||||
}
|
||||
|
||||
func appendUint64(b []byte, x uint64) []byte {
|
||||
var a [8]byte
|
||||
binary.LittleEndian.PutUint64(a[:], x)
|
||||
return append(b, a[:]...)
|
||||
}
|
||||
|
||||
func consumeUint64(b []byte) ([]byte, uint64) {
|
||||
x := u64(b)
|
||||
return b[8:], x
|
||||
}
|
||||
|
||||
func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) }
|
||||
func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) }
|
||||
|
||||
func round(acc, input uint64) uint64 {
|
||||
acc += input * prime2
|
||||
acc = rol31(acc)
|
||||
acc *= prime1
|
||||
return acc
|
||||
}
|
||||
|
||||
func mergeRound(acc, val uint64) uint64 {
|
||||
val = round(0, val)
|
||||
acc ^= val
|
||||
acc = acc*prime1 + prime4
|
||||
return acc
|
||||
}
|
||||
|
||||
func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) }
|
||||
func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) }
|
||||
func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) }
|
||||
func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) }
|
||||
func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) }
|
||||
func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) }
|
||||
func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) }
|
||||
func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) }
|
||||
209
vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
generated
vendored
Normal file
209
vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
//go:build !appengine && gc && !purego
|
||||
// +build !appengine
|
||||
// +build gc
|
||||
// +build !purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// Registers:
|
||||
#define h AX
|
||||
#define d AX
|
||||
#define p SI // pointer to advance through b
|
||||
#define n DX
|
||||
#define end BX // loop end
|
||||
#define v1 R8
|
||||
#define v2 R9
|
||||
#define v3 R10
|
||||
#define v4 R11
|
||||
#define x R12
|
||||
#define prime1 R13
|
||||
#define prime2 R14
|
||||
#define prime4 DI
|
||||
|
||||
#define round(acc, x) \
|
||||
IMULQ prime2, x \
|
||||
ADDQ x, acc \
|
||||
ROLQ $31, acc \
|
||||
IMULQ prime1, acc
|
||||
|
||||
// round0 performs the operation x = round(0, x).
|
||||
#define round0(x) \
|
||||
IMULQ prime2, x \
|
||||
ROLQ $31, x \
|
||||
IMULQ prime1, x
|
||||
|
||||
// mergeRound applies a merge round on the two registers acc and x.
|
||||
// It assumes that prime1, prime2, and prime4 have been loaded.
|
||||
#define mergeRound(acc, x) \
|
||||
round0(x) \
|
||||
XORQ x, acc \
|
||||
IMULQ prime1, acc \
|
||||
ADDQ prime4, acc
|
||||
|
||||
// blockLoop processes as many 32-byte blocks as possible,
|
||||
// updating v1, v2, v3, and v4. It assumes that there is at least one block
|
||||
// to process.
|
||||
#define blockLoop() \
|
||||
loop: \
|
||||
MOVQ +0(p), x \
|
||||
round(v1, x) \
|
||||
MOVQ +8(p), x \
|
||||
round(v2, x) \
|
||||
MOVQ +16(p), x \
|
||||
round(v3, x) \
|
||||
MOVQ +24(p), x \
|
||||
round(v4, x) \
|
||||
ADDQ $32, p \
|
||||
CMPQ p, end \
|
||||
JLE loop
|
||||
|
||||
// func Sum64(b []byte) uint64
|
||||
TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32
|
||||
// Load fixed primes.
|
||||
MOVQ ·primes+0(SB), prime1
|
||||
MOVQ ·primes+8(SB), prime2
|
||||
MOVQ ·primes+24(SB), prime4
|
||||
|
||||
// Load slice.
|
||||
MOVQ b_base+0(FP), p
|
||||
MOVQ b_len+8(FP), n
|
||||
LEAQ (p)(n*1), end
|
||||
|
||||
// The first loop limit will be len(b)-32.
|
||||
SUBQ $32, end
|
||||
|
||||
// Check whether we have at least one block.
|
||||
CMPQ n, $32
|
||||
JLT noBlocks
|
||||
|
||||
// Set up initial state (v1, v2, v3, v4).
|
||||
MOVQ prime1, v1
|
||||
ADDQ prime2, v1
|
||||
MOVQ prime2, v2
|
||||
XORQ v3, v3
|
||||
XORQ v4, v4
|
||||
SUBQ prime1, v4
|
||||
|
||||
blockLoop()
|
||||
|
||||
MOVQ v1, h
|
||||
ROLQ $1, h
|
||||
MOVQ v2, x
|
||||
ROLQ $7, x
|
||||
ADDQ x, h
|
||||
MOVQ v3, x
|
||||
ROLQ $12, x
|
||||
ADDQ x, h
|
||||
MOVQ v4, x
|
||||
ROLQ $18, x
|
||||
ADDQ x, h
|
||||
|
||||
mergeRound(h, v1)
|
||||
mergeRound(h, v2)
|
||||
mergeRound(h, v3)
|
||||
mergeRound(h, v4)
|
||||
|
||||
JMP afterBlocks
|
||||
|
||||
noBlocks:
|
||||
MOVQ ·primes+32(SB), h
|
||||
|
||||
afterBlocks:
|
||||
ADDQ n, h
|
||||
|
||||
ADDQ $24, end
|
||||
CMPQ p, end
|
||||
JG try4
|
||||
|
||||
loop8:
|
||||
MOVQ (p), x
|
||||
ADDQ $8, p
|
||||
round0(x)
|
||||
XORQ x, h
|
||||
ROLQ $27, h
|
||||
IMULQ prime1, h
|
||||
ADDQ prime4, h
|
||||
|
||||
CMPQ p, end
|
||||
JLE loop8
|
||||
|
||||
try4:
|
||||
ADDQ $4, end
|
||||
CMPQ p, end
|
||||
JG try1
|
||||
|
||||
MOVL (p), x
|
||||
ADDQ $4, p
|
||||
IMULQ prime1, x
|
||||
XORQ x, h
|
||||
|
||||
ROLQ $23, h
|
||||
IMULQ prime2, h
|
||||
ADDQ ·primes+16(SB), h
|
||||
|
||||
try1:
|
||||
ADDQ $4, end
|
||||
CMPQ p, end
|
||||
JGE finalize
|
||||
|
||||
loop1:
|
||||
MOVBQZX (p), x
|
||||
ADDQ $1, p
|
||||
IMULQ ·primes+32(SB), x
|
||||
XORQ x, h
|
||||
ROLQ $11, h
|
||||
IMULQ prime1, h
|
||||
|
||||
CMPQ p, end
|
||||
JL loop1
|
||||
|
||||
finalize:
|
||||
MOVQ h, x
|
||||
SHRQ $33, x
|
||||
XORQ x, h
|
||||
IMULQ prime2, h
|
||||
MOVQ h, x
|
||||
SHRQ $29, x
|
||||
XORQ x, h
|
||||
IMULQ ·primes+16(SB), h
|
||||
MOVQ h, x
|
||||
SHRQ $32, x
|
||||
XORQ x, h
|
||||
|
||||
MOVQ h, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func writeBlocks(d *Digest, b []byte) int
|
||||
TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40
|
||||
// Load fixed primes needed for round.
|
||||
MOVQ ·primes+0(SB), prime1
|
||||
MOVQ ·primes+8(SB), prime2
|
||||
|
||||
// Load slice.
|
||||
MOVQ b_base+8(FP), p
|
||||
MOVQ b_len+16(FP), n
|
||||
LEAQ (p)(n*1), end
|
||||
SUBQ $32, end
|
||||
|
||||
// Load vN from d.
|
||||
MOVQ s+0(FP), d
|
||||
MOVQ 0(d), v1
|
||||
MOVQ 8(d), v2
|
||||
MOVQ 16(d), v3
|
||||
MOVQ 24(d), v4
|
||||
|
||||
// We don't need to check the loop condition here; this function is
|
||||
// always called with at least one block of data to process.
|
||||
blockLoop()
|
||||
|
||||
// Copy vN back to d.
|
||||
MOVQ v1, 0(d)
|
||||
MOVQ v2, 8(d)
|
||||
MOVQ v3, 16(d)
|
||||
MOVQ v4, 24(d)
|
||||
|
||||
// The number of bytes written is p minus the old base pointer.
|
||||
SUBQ b_base+8(FP), p
|
||||
MOVQ p, ret+32(FP)
|
||||
|
||||
RET
|
||||
183
vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
generated
vendored
Normal file
183
vendor/github.com/cespare/xxhash/v2/xxhash_arm64.s
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
//go:build !appengine && gc && !purego
|
||||
// +build !appengine
|
||||
// +build gc
|
||||
// +build !purego
|
||||
|
||||
#include "textflag.h"
|
||||
|
||||
// Registers:
|
||||
#define digest R1
|
||||
#define h R2 // return value
|
||||
#define p R3 // input pointer
|
||||
#define n R4 // input length
|
||||
#define nblocks R5 // n / 32
|
||||
#define prime1 R7
|
||||
#define prime2 R8
|
||||
#define prime3 R9
|
||||
#define prime4 R10
|
||||
#define prime5 R11
|
||||
#define v1 R12
|
||||
#define v2 R13
|
||||
#define v3 R14
|
||||
#define v4 R15
|
||||
#define x1 R20
|
||||
#define x2 R21
|
||||
#define x3 R22
|
||||
#define x4 R23
|
||||
|
||||
#define round(acc, x) \
|
||||
MADD prime2, acc, x, acc \
|
||||
ROR $64-31, acc \
|
||||
MUL prime1, acc
|
||||
|
||||
// round0 performs the operation x = round(0, x).
|
||||
#define round0(x) \
|
||||
MUL prime2, x \
|
||||
ROR $64-31, x \
|
||||
MUL prime1, x
|
||||
|
||||
#define mergeRound(acc, x) \
|
||||
round0(x) \
|
||||
EOR x, acc \
|
||||
MADD acc, prime4, prime1, acc
|
||||
|
||||
// blockLoop processes as many 32-byte blocks as possible,
|
||||
// updating v1, v2, v3, and v4. It assumes that n >= 32.
|
||||
#define blockLoop() \
|
||||
LSR $5, n, nblocks \
|
||||
PCALIGN $16 \
|
||||
loop: \
|
||||
LDP.P 16(p), (x1, x2) \
|
||||
LDP.P 16(p), (x3, x4) \
|
||||
round(v1, x1) \
|
||||
round(v2, x2) \
|
||||
round(v3, x3) \
|
||||
round(v4, x4) \
|
||||
SUB $1, nblocks \
|
||||
CBNZ nblocks, loop
|
||||
|
||||
// func Sum64(b []byte) uint64
|
||||
TEXT ·Sum64(SB), NOSPLIT|NOFRAME, $0-32
|
||||
LDP b_base+0(FP), (p, n)
|
||||
|
||||
LDP ·primes+0(SB), (prime1, prime2)
|
||||
LDP ·primes+16(SB), (prime3, prime4)
|
||||
MOVD ·primes+32(SB), prime5
|
||||
|
||||
CMP $32, n
|
||||
CSEL LT, prime5, ZR, h // if n < 32 { h = prime5 } else { h = 0 }
|
||||
BLT afterLoop
|
||||
|
||||
ADD prime1, prime2, v1
|
||||
MOVD prime2, v2
|
||||
MOVD $0, v3
|
||||
NEG prime1, v4
|
||||
|
||||
blockLoop()
|
||||
|
||||
ROR $64-1, v1, x1
|
||||
ROR $64-7, v2, x2
|
||||
ADD x1, x2
|
||||
ROR $64-12, v3, x3
|
||||
ROR $64-18, v4, x4
|
||||
ADD x3, x4
|
||||
ADD x2, x4, h
|
||||
|
||||
mergeRound(h, v1)
|
||||
mergeRound(h, v2)
|
||||
mergeRound(h, v3)
|
||||
mergeRound(h, v4)
|
||||
|
||||
afterLoop:
|
||||
ADD n, h
|
||||
|
||||
TBZ $4, n, try8
|
||||
LDP.P 16(p), (x1, x2)
|
||||
|
||||
round0(x1)
|
||||
|
||||
// NOTE: here and below, sequencing the EOR after the ROR (using a
|
||||
// rotated register) is worth a small but measurable speedup for small
|
||||
// inputs.
|
||||
ROR $64-27, h
|
||||
EOR x1 @> 64-27, h, h
|
||||
MADD h, prime4, prime1, h
|
||||
|
||||
round0(x2)
|
||||
ROR $64-27, h
|
||||
EOR x2 @> 64-27, h, h
|
||||
MADD h, prime4, prime1, h
|
||||
|
||||
try8:
|
||||
TBZ $3, n, try4
|
||||
MOVD.P 8(p), x1
|
||||
|
||||
round0(x1)
|
||||
ROR $64-27, h
|
||||
EOR x1 @> 64-27, h, h
|
||||
MADD h, prime4, prime1, h
|
||||
|
||||
try4:
|
||||
TBZ $2, n, try2
|
||||
MOVWU.P 4(p), x2
|
||||
|
||||
MUL prime1, x2
|
||||
ROR $64-23, h
|
||||
EOR x2 @> 64-23, h, h
|
||||
MADD h, prime3, prime2, h
|
||||
|
||||
try2:
|
||||
TBZ $1, n, try1
|
||||
MOVHU.P 2(p), x3
|
||||
AND $255, x3, x1
|
||||
LSR $8, x3, x2
|
||||
|
||||
MUL prime5, x1
|
||||
ROR $64-11, h
|
||||
EOR x1 @> 64-11, h, h
|
||||
MUL prime1, h
|
||||
|
||||
MUL prime5, x2
|
||||
ROR $64-11, h
|
||||
EOR x2 @> 64-11, h, h
|
||||
MUL prime1, h
|
||||
|
||||
try1:
|
||||
TBZ $0, n, finalize
|
||||
MOVBU (p), x4
|
||||
|
||||
MUL prime5, x4
|
||||
ROR $64-11, h
|
||||
EOR x4 @> 64-11, h, h
|
||||
MUL prime1, h
|
||||
|
||||
finalize:
|
||||
EOR h >> 33, h
|
||||
MUL prime2, h
|
||||
EOR h >> 29, h
|
||||
MUL prime3, h
|
||||
EOR h >> 32, h
|
||||
|
||||
MOVD h, ret+24(FP)
|
||||
RET
|
||||
|
||||
// func writeBlocks(d *Digest, b []byte) int
|
||||
TEXT ·writeBlocks(SB), NOSPLIT|NOFRAME, $0-40
|
||||
LDP ·primes+0(SB), (prime1, prime2)
|
||||
|
||||
// Load state. Assume v[1-4] are stored contiguously.
|
||||
MOVD d+0(FP), digest
|
||||
LDP 0(digest), (v1, v2)
|
||||
LDP 16(digest), (v3, v4)
|
||||
|
||||
LDP b_base+8(FP), (p, n)
|
||||
|
||||
blockLoop()
|
||||
|
||||
// Store updated state.
|
||||
STP (v1, v2), 0(digest)
|
||||
STP (v3, v4), 16(digest)
|
||||
|
||||
BIC $31, n
|
||||
MOVD n, ret+32(FP)
|
||||
RET
|
||||
15
vendor/github.com/cespare/xxhash/v2/xxhash_asm.go
generated
vendored
Normal file
15
vendor/github.com/cespare/xxhash/v2/xxhash_asm.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
//go:build (amd64 || arm64) && !appengine && gc && !purego
|
||||
// +build amd64 arm64
|
||||
// +build !appengine
|
||||
// +build gc
|
||||
// +build !purego
|
||||
|
||||
package xxhash
|
||||
|
||||
// Sum64 computes the 64-bit xxHash digest of b with a zero seed.
|
||||
//
|
||||
//go:noescape
|
||||
func Sum64(b []byte) uint64
|
||||
|
||||
//go:noescape
|
||||
func writeBlocks(d *Digest, b []byte) int
|
||||
76
vendor/github.com/cespare/xxhash/v2/xxhash_other.go
generated
vendored
Normal file
76
vendor/github.com/cespare/xxhash/v2/xxhash_other.go
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
//go:build (!amd64 && !arm64) || appengine || !gc || purego
|
||||
// +build !amd64,!arm64 appengine !gc purego
|
||||
|
||||
package xxhash
|
||||
|
||||
// Sum64 computes the 64-bit xxHash digest of b with a zero seed.
|
||||
func Sum64(b []byte) uint64 {
|
||||
// A simpler version would be
|
||||
// d := New()
|
||||
// d.Write(b)
|
||||
// return d.Sum64()
|
||||
// but this is faster, particularly for small inputs.
|
||||
|
||||
n := len(b)
|
||||
var h uint64
|
||||
|
||||
if n >= 32 {
|
||||
v1 := primes[0] + prime2
|
||||
v2 := prime2
|
||||
v3 := uint64(0)
|
||||
v4 := -primes[0]
|
||||
for len(b) >= 32 {
|
||||
v1 = round(v1, u64(b[0:8:len(b)]))
|
||||
v2 = round(v2, u64(b[8:16:len(b)]))
|
||||
v3 = round(v3, u64(b[16:24:len(b)]))
|
||||
v4 = round(v4, u64(b[24:32:len(b)]))
|
||||
b = b[32:len(b):len(b)]
|
||||
}
|
||||
h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4)
|
||||
h = mergeRound(h, v1)
|
||||
h = mergeRound(h, v2)
|
||||
h = mergeRound(h, v3)
|
||||
h = mergeRound(h, v4)
|
||||
} else {
|
||||
h = prime5
|
||||
}
|
||||
|
||||
h += uint64(n)
|
||||
|
||||
for ; len(b) >= 8; b = b[8:] {
|
||||
k1 := round(0, u64(b[:8]))
|
||||
h ^= k1
|
||||
h = rol27(h)*prime1 + prime4
|
||||
}
|
||||
if len(b) >= 4 {
|
||||
h ^= uint64(u32(b[:4])) * prime1
|
||||
h = rol23(h)*prime2 + prime3
|
||||
b = b[4:]
|
||||
}
|
||||
for ; len(b) > 0; b = b[1:] {
|
||||
h ^= uint64(b[0]) * prime5
|
||||
h = rol11(h) * prime1
|
||||
}
|
||||
|
||||
h ^= h >> 33
|
||||
h *= prime2
|
||||
h ^= h >> 29
|
||||
h *= prime3
|
||||
h ^= h >> 32
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
func writeBlocks(d *Digest, b []byte) int {
|
||||
v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4
|
||||
n := len(b)
|
||||
for len(b) >= 32 {
|
||||
v1 = round(v1, u64(b[0:8:len(b)]))
|
||||
v2 = round(v2, u64(b[8:16:len(b)]))
|
||||
v3 = round(v3, u64(b[16:24:len(b)]))
|
||||
v4 = round(v4, u64(b[24:32:len(b)]))
|
||||
b = b[32:len(b):len(b)]
|
||||
}
|
||||
d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4
|
||||
return n - len(b)
|
||||
}
|
||||
16
vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
generated
vendored
Normal file
16
vendor/github.com/cespare/xxhash/v2/xxhash_safe.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
//go:build appengine
|
||||
// +build appengine
|
||||
|
||||
// This file contains the safe implementations of otherwise unsafe-using code.
|
||||
|
||||
package xxhash
|
||||
|
||||
// Sum64String computes the 64-bit xxHash digest of s with a zero seed.
|
||||
func Sum64String(s string) uint64 {
|
||||
return Sum64([]byte(s))
|
||||
}
|
||||
|
||||
// WriteString adds more data to d. It always returns len(s), nil.
|
||||
func (d *Digest) WriteString(s string) (n int, err error) {
|
||||
return d.Write([]byte(s))
|
||||
}
|
||||
58
vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
generated
vendored
Normal file
58
vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
//go:build !appengine
|
||||
// +build !appengine
|
||||
|
||||
// This file encapsulates usage of unsafe.
|
||||
// xxhash_safe.go contains the safe implementations.
|
||||
|
||||
package xxhash
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// In the future it's possible that compiler optimizations will make these
|
||||
// XxxString functions unnecessary by realizing that calls such as
|
||||
// Sum64([]byte(s)) don't need to copy s. See https://go.dev/issue/2205.
|
||||
// If that happens, even if we keep these functions they can be replaced with
|
||||
// the trivial safe code.
|
||||
|
||||
// NOTE: The usual way of doing an unsafe string-to-[]byte conversion is:
|
||||
//
|
||||
// var b []byte
|
||||
// bh := (*reflect.SliceHeader)(unsafe.Pointer(&b))
|
||||
// bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data
|
||||
// bh.Len = len(s)
|
||||
// bh.Cap = len(s)
|
||||
//
|
||||
// Unfortunately, as of Go 1.15.3 the inliner's cost model assigns a high enough
|
||||
// weight to this sequence of expressions that any function that uses it will
|
||||
// not be inlined. Instead, the functions below use a different unsafe
|
||||
// conversion designed to minimize the inliner weight and allow both to be
|
||||
// inlined. There is also a test (TestInlining) which verifies that these are
|
||||
// inlined.
|
||||
//
|
||||
// See https://github.com/golang/go/issues/42739 for discussion.
|
||||
|
||||
// Sum64String computes the 64-bit xxHash digest of s with a zero seed.
|
||||
// It may be faster than Sum64([]byte(s)) by avoiding a copy.
|
||||
func Sum64String(s string) uint64 {
|
||||
b := *(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)}))
|
||||
return Sum64(b)
|
||||
}
|
||||
|
||||
// WriteString adds more data to d. It always returns len(s), nil.
|
||||
// It may be faster than Write([]byte(s)) by avoiding a copy.
|
||||
func (d *Digest) WriteString(s string) (n int, err error) {
|
||||
d.Write(*(*[]byte)(unsafe.Pointer(&sliceHeader{s, len(s)})))
|
||||
// d.Write always returns len(s), nil.
|
||||
// Ignoring the return output and returning these fixed values buys a
|
||||
// savings of 6 in the inliner's cost model.
|
||||
return len(s), nil
|
||||
}
|
||||
|
||||
// sliceHeader is similar to reflect.SliceHeader, but it assumes that the layout
|
||||
// of the first two words is the same as the layout of a string.
|
||||
type sliceHeader struct {
|
||||
s string
|
||||
cap int
|
||||
}
|
||||
1
vendor/go.opentelemetry.io/otel/.codespellignore
generated
vendored
1
vendor/go.opentelemetry.io/otel/.codespellignore
generated
vendored
@@ -8,3 +8,4 @@ nam
|
||||
valu
|
||||
thirdparty
|
||||
addOpt
|
||||
observ
|
||||
|
||||
3
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
3
vendor/go.opentelemetry.io/otel/.golangci.yml
generated
vendored
@@ -197,6 +197,9 @@ linters:
|
||||
- float-compare
|
||||
- go-require
|
||||
- require-error
|
||||
usetesting:
|
||||
context-background: true
|
||||
context-todo: true
|
||||
exclusions:
|
||||
generated: lax
|
||||
presets:
|
||||
|
||||
6
vendor/go.opentelemetry.io/otel/.lycheeignore
generated
vendored
6
vendor/go.opentelemetry.io/otel/.lycheeignore
generated
vendored
@@ -1,4 +1,5 @@
|
||||
http://localhost
|
||||
https://localhost
|
||||
http://jaeger-collector
|
||||
https://github.com/open-telemetry/opentelemetry-go/milestone/
|
||||
https://github.com/open-telemetry/opentelemetry-go/projects
|
||||
@@ -6,4 +7,7 @@ https://github.com/open-telemetry/opentelemetry-go/projects
|
||||
https?:\/\/github\.com\/open-telemetry\/semantic-conventions\/archive\/refs\/tags\/[^.]+\.zip\[[^]]+]
|
||||
file:///home/runner/work/opentelemetry-go/opentelemetry-go/libraries
|
||||
file:///home/runner/work/opentelemetry-go/opentelemetry-go/manual
|
||||
http://4.3.2.1:78/user/123
|
||||
http://4.3.2.1:78/user/123
|
||||
file:///home/runner/work/opentelemetry-go/opentelemetry-go/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/dns:/:4317
|
||||
# URL works, but it has blocked link checkers.
|
||||
https://dl.acm.org/doi/10.1145/198429.198435
|
||||
|
||||
72
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
72
vendor/go.opentelemetry.io/otel/CHANGELOG.md
generated
vendored
@@ -11,6 +11,74 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||
<!-- Released section -->
|
||||
<!-- Don't change this section unless doing release -->
|
||||
|
||||
## [1.39.0/0.61.0/0.15.0/0.0.14] 2025-12-05
|
||||
|
||||
### Added
|
||||
|
||||
- Greatly reduce the cost of recording metrics in `go.opentelemetry.io/otel/sdk/metric` using hashing for map keys. (#7175)
|
||||
- Add `WithInstrumentationAttributeSet` option to `go.opentelemetry.io/otel/log`, `go.opentelemetry.io/otel/metric`, and `go.opentelemetry.io/otel/trace` packages.
|
||||
This provides a concurrent-safe and performant alternative to `WithInstrumentationAttributes` by accepting a pre-constructed `attribute.Set`. (#7287)
|
||||
- Add experimental observability for the Prometheus exporter in `go.opentelemetry.io/otel/exporters/prometheus`.
|
||||
Check the `go.opentelemetry.io/otel/exporters/prometheus/internal/x` package documentation for more information. (#7345)
|
||||
- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#7353)
|
||||
- Add temporality selector functions `DeltaTemporalitySelector`, `CumulativeTemporalitySelector`, `LowMemoryTemporalitySelector` to `go.opentelemetry.io/otel/sdk/metric`. (#7434)
|
||||
- Add experimental observability metrics for simple log processor in `go.opentelemetry.io/otel/sdk/log`. (#7548)
|
||||
- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#7459)
|
||||
- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7486)
|
||||
- Add experimental observability metrics for simple span processor in `go.opentelemetry.io/otel/sdk/trace`. (#7374)
|
||||
- Add experimental observability metrics in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7512)
|
||||
- Add experimental observability metrics for manual reader in `go.opentelemetry.io/otel/sdk/metric`. (#7524)
|
||||
- Add experimental observability metrics for periodic reader in `go.opentelemetry.io/otel/sdk/metric`. (#7571)
|
||||
- Support `OTEL_EXPORTER_OTLP_LOGS_INSECURE` and `OTEL_EXPORTER_OTLP_INSECURE` environmental variables in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7608)
|
||||
- Add `Enabled` method to the `Processor` interface in `go.opentelemetry.io/otel/sdk/log`.
|
||||
All `Processor` implementations now include an `Enabled` method. (#7639)
|
||||
- The `go.opentelemetry.io/otel/semconv/v1.38.0` package.
|
||||
The package contains semantic conventions from the `v1.38.0` version of the OpenTelemetry Semantic Conventions.
|
||||
See the [migration documentation](./semconv/v1.38.0/MIGRATION.md) for information on how to upgrade from `go.opentelemetry.io/otel/semconv/v1.37.0.`(#7648)
|
||||
|
||||
### Changed
|
||||
|
||||
- `Distinct` in `go.opentelemetry.io/otel/attribute` is no longer guaranteed to uniquely identify an attribute set.
|
||||
Collisions between `Distinct` values for different Sets are possible with extremely high cardinality (billions of series per instrument), but are highly unlikely. (#7175)
|
||||
- `WithInstrumentationAttributes` in `go.opentelemetry.io/otel/trace` synchronously de-duplicates the passed attributes instead of delegating it to the returned `TracerOption`. (#7266)
|
||||
- `WithInstrumentationAttributes` in `go.opentelemetry.io/otel/meter` synchronously de-duplicates the passed attributes instead of delegating it to the returned `MeterOption`. (#7266)
|
||||
- `WithInstrumentationAttributes` in `go.opentelemetry.io/otel/log` synchronously de-duplicates the passed attributes instead of delegating it to the returned `LoggerOption`. (#7266)
|
||||
- Rename the `OTEL_GO_X_SELF_OBSERVABILITY` environment variable to `OTEL_GO_X_OBSERVABILITY` in `go.opentelemetry.io/otel/sdk/trace`, `go.opentelemetry.io/otel/sdk/log`, and `go.opentelemetry.io/otel/exporters/stdout/stdouttrace`. (#7302)
|
||||
- Improve performance of histogram `Record` in `go.opentelemetry.io/otel/sdk/metric` when min and max are disabled using `NoMinMax`. (#7306)
|
||||
- Improve error handling for dropped data during translation by using `prometheus.NewInvalidMetric` in `go.opentelemetry.io/otel/exporters/prometheus`.
|
||||
⚠️ **Breaking Change:** Previously, these cases were only logged and scrapes succeeded.
|
||||
Now, when translation would drop data (e.g., invalid label/value), the exporter emits a `NewInvalidMetric`, and Prometheus scrapes **fail with HTTP 500** by default.
|
||||
To preserve the prior behavior (scrapes succeed while errors are logged), configure your Prometheus HTTP handler with: `promhttp.HandlerOpts{ ErrorHandling: promhttp.ContinueOnError }`. (#7363)
|
||||
- Replace fnv hash with xxhash in `go.opentelemetry.io/otel/attribute` for better performance. (#7371)
|
||||
- The default `TranslationStrategy` in `go.opentelemetry.io/exporters/prometheus` is changed from `otlptranslator.NoUTF8EscapingWithSuffixes` to `otlptranslator.UnderscoreEscapingWithSuffixes`. (#7421)
|
||||
- Improve performance of concurrent measurements in `go.opentelemetry.io/otel/sdk/metric`. (#7427)
|
||||
- Include W3C TraceFlags (bits 0–7) in the OTLP `Span.Flags` field in `go.opentelemetry.io/exporters/otlp/otlptrace/otlptracehttp` and `go.opentelemetry.io/exporters/otlp/otlptrace/otlptracegrpc`. (#7438)
|
||||
- The `ErrorType` function in `go.opentelemetry.io/otel/semconv/v1.37.0` now handles custom error types.
|
||||
If an error implements an `ErrorType() string` method, the return value of that method will be used as the error type. (#7442)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix `WithInstrumentationAttributes` options in `go.opentelemetry.io/otel/trace`, `go.opentelemetry.io/otel/metric`, and `go.opentelemetry.io/otel/log` to properly merge attributes when passed multiple times instead of replacing them.
|
||||
Attributes with duplicate keys will use the last value passed. (#7300)
|
||||
- The equality of `attribute.Set` when using the `Equal` method is not affected by the user overriding the empty set pointed to by `attribute.EmptySet` in `go.opentelemetry.io/otel/attribute`. (#7357)
|
||||
- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc`. (#7372)
|
||||
- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp`. (#7372)
|
||||
- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc`. (#7372)
|
||||
- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp`. (#7372)
|
||||
- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc`. (#7372)
|
||||
- Return partial OTLP export errors to the caller in `go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp`. (#7372)
|
||||
- Fix `AddAttributes`, `SetAttributes`, `SetBody` on `Record` in `go.opentelemetry.io/otel/sdk/log` to not mutate input. (#7403)
|
||||
- Do not double record measurements of `RecordSet` methods in `go.opentelemetry.io/otel/semconv/v1.37.0`. (#7655)
|
||||
- Do not double record measurements of `RecordSet` methods in `go.opentelemetry.io/otel/semconv/v1.36.0`. (#7656)
|
||||
|
||||
### Removed
|
||||
|
||||
- Drop support for [Go 1.23]. (#7274)
|
||||
- Remove the `FilterProcessor` interface in `go.opentelemetry.io/otel/sdk/log`.
|
||||
The `Enabled` method has been added to the `Processor` interface instead.
|
||||
All `Processor` implementations must now implement the `Enabled` method.
|
||||
Custom processors that do not filter records can implement `Enabled` to return `true`. (#7639)
|
||||
|
||||
## [1.38.0/0.60.0/0.14.0/0.0.13] 2025-08-29
|
||||
|
||||
This release is the last to support [Go 1.23].
|
||||
@@ -3430,8 +3498,10 @@ 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.38.0...HEAD
|
||||
[Unreleased]: https://github.com/open-telemetry/opentelemetry-go/compare/v1.39.0...HEAD
|
||||
[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
|
||||
[1.37.0/0.59.0/0.13.0]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/v1.37.0
|
||||
[0.12.2]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/log/v0.12.2
|
||||
[0.12.1]: https://github.com/open-telemetry/opentelemetry-go/releases/tag/log/v0.12.1
|
||||
|
||||
458
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
458
vendor/go.opentelemetry.io/otel/CONTRIBUTING.md
generated
vendored
@@ -54,8 +54,8 @@ go get -d go.opentelemetry.io/otel
|
||||
(This may print some warning about "build constraints exclude all Go
|
||||
files", just ignore it.)
|
||||
|
||||
This will put the project in `${GOPATH}/src/go.opentelemetry.io/otel`. You
|
||||
can alternatively use `git` directly with:
|
||||
This will put the project in `${GOPATH}/src/go.opentelemetry.io/otel`.
|
||||
Alternatively, you can use `git` directly with:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/open-telemetry/opentelemetry-go
|
||||
@@ -65,8 +65,7 @@ git clone https://github.com/open-telemetry/opentelemetry-go
|
||||
that name is a kind of a redirector to GitHub that `go get` can
|
||||
understand, but `git` does not.)
|
||||
|
||||
This would put the project in the `opentelemetry-go` directory in
|
||||
current working directory.
|
||||
This will add the project as `opentelemetry-go` within the current directory.
|
||||
|
||||
Enter the newly created directory and add your fork as a new remote:
|
||||
|
||||
@@ -109,7 +108,7 @@ A PR is considered **ready to merge** when:
|
||||
|
||||
This is not enforced through automation, but needs to be validated by the
|
||||
maintainer merging.
|
||||
* At least one of the qualified approvals need to be from an
|
||||
* At least one of the qualified approvals needs to be from an
|
||||
[Approver]/[Maintainer] affiliated with a different company than the author
|
||||
of the PR.
|
||||
* PRs introducing changes that have already been discussed and consensus
|
||||
@@ -166,11 +165,11 @@ guidelines](https://opentelemetry.io/docs/specs/otel/library-guidelines).
|
||||
### Focus on Capabilities, Not Structure Compliance
|
||||
|
||||
OpenTelemetry is an evolving specification, one where the desires and
|
||||
use cases are clear, but the method to satisfy those uses cases are
|
||||
use cases are clear, but the methods to satisfy those use cases are
|
||||
not.
|
||||
|
||||
As such, Contributions should provide functionality and behavior that
|
||||
conforms to the specification, but the interface and structure is
|
||||
conforms to the specification, but the interface and structure are
|
||||
flexible.
|
||||
|
||||
It is preferable to have contributions follow the idioms of the
|
||||
@@ -217,7 +216,7 @@ about dependency compatibility.
|
||||
This project does not partition dependencies based on the environment (i.e.
|
||||
`development`, `staging`, `production`).
|
||||
|
||||
Only the dependencies explicitly included in the released modules have be
|
||||
Only the dependencies explicitly included in the released modules have been
|
||||
tested and verified to work with the released code. No other guarantee is made
|
||||
about the compatibility of other dependencies.
|
||||
|
||||
@@ -635,8 +634,8 @@ is not in their root name.
|
||||
|
||||
The use of internal packages should be scoped to a single module. A sub-module
|
||||
should never import from a parent internal package. This creates a coupling
|
||||
between the two modules where a user can upgrade the parent without the child
|
||||
and if the internal package API has changed it will fail to upgrade[^3].
|
||||
between the two modules where a user can upgrade the parent without the child,
|
||||
and if the internal package API has changed, it will fail to upgrade[^3].
|
||||
|
||||
There are two known exceptions to this rule:
|
||||
|
||||
@@ -657,7 +656,7 @@ this.
|
||||
|
||||
### Ignoring context cancellation
|
||||
|
||||
OpenTelemetry API implementations need to ignore the cancellation of the context that are
|
||||
OpenTelemetry API implementations need to ignore the cancellation of the context that is
|
||||
passed when recording a value (e.g. starting a span, recording a measurement, emitting a log).
|
||||
Recording methods should not return an error describing the cancellation state of the context
|
||||
when they complete, nor should they abort any work.
|
||||
@@ -675,6 +674,441 @@ force flushing telemetry, shutting down a signal provider) the context cancellat
|
||||
should be honored. This means all work done on behalf of the user provided context
|
||||
should be canceled.
|
||||
|
||||
### Observability
|
||||
|
||||
OpenTelemetry Go SDK components should be instrumented to enable users observability for the health and performance of the telemetry pipeline itself.
|
||||
This allows operators to understand how well their observability infrastructure is functioning and to identify potential issues before they impact their applications.
|
||||
|
||||
This section outlines the best practices for building instrumentation in OpenTelemetry Go SDK components.
|
||||
|
||||
#### Environment Variable Activation
|
||||
|
||||
Observability features are currently experimental.
|
||||
They should be disabled by default and activated through the `OTEL_GO_X_OBSERVABILITY` environment variable.
|
||||
This follows the established experimental feature pattern used throughout the SDK.
|
||||
|
||||
Components should check for this environment variable using a consistent pattern:
|
||||
|
||||
```go
|
||||
import "go.opentelemetry.io/otel/*/internal/x"
|
||||
|
||||
if x.Observability.Enabled() {
|
||||
// Initialize observability metrics
|
||||
}
|
||||
```
|
||||
|
||||
**References**:
|
||||
|
||||
- [stdouttrace exporter](./exporters/stdout/stdouttrace/internal/x/x.go)
|
||||
- [sdk](./sdk/internal/x/x.go)
|
||||
|
||||
#### Encapsulation
|
||||
|
||||
Instrumentation should be encapsulated within a dedicated `struct` (e.g. `instrumentation`).
|
||||
It should not be mixed into the instrumented component.
|
||||
|
||||
Prefer this:
|
||||
|
||||
```go
|
||||
type SDKComponent struct {
|
||||
inst *instrumentation
|
||||
}
|
||||
|
||||
type instrumentation struct {
|
||||
inflight otelconv.SDKComponentInflight
|
||||
exported otelconv.SDKComponentExported
|
||||
}
|
||||
```
|
||||
|
||||
To this:
|
||||
|
||||
```go
|
||||
// ❌ Avoid this pattern.
|
||||
type SDKComponent struct {
|
||||
/* other SDKComponent fields... */
|
||||
|
||||
inflight otelconv.SDKComponentInflight
|
||||
exported otelconv.SDKComponentExported
|
||||
}
|
||||
```
|
||||
|
||||
The instrumentation code should not bloat the code being instrumented.
|
||||
Likely, this means its own file, or its own package if it is complex or reused.
|
||||
|
||||
#### Initialization
|
||||
|
||||
Instrumentation setup should be explicit, side-effect free, and local to the relevant component.
|
||||
Avoid relying on global or implicit [side effects][side-effect] for initialization.
|
||||
|
||||
Encapsulate setup in constructor functions, ensuring clear ownership and scope:
|
||||
|
||||
```go
|
||||
import (
|
||||
"errors"
|
||||
|
||||
semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
|
||||
"go.opentelemetry.io/otel/semconv/v1.37.0/otelconv"
|
||||
)
|
||||
|
||||
type SDKComponent struct {
|
||||
inst *instrumentation
|
||||
}
|
||||
|
||||
func NewSDKComponent(config Config) (*SDKComponent, error) {
|
||||
inst, err := newInstrumentation()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &SDKComponent{inst: inst}, nil
|
||||
}
|
||||
|
||||
type instrumentation struct {
|
||||
inflight otelconv.SDKComponentInflight
|
||||
exported otelconv.SDKComponentExported
|
||||
}
|
||||
|
||||
func newInstrumentation() (*instrumentation, error) {
|
||||
if !x.Observability.Enabled() {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
meter := otel.GetMeterProvider().Meter(
|
||||
"<component-package-name>",
|
||||
metric.WithInstrumentationVersion(sdk.Version()),
|
||||
metric.WithSchemaURL(semconv.SchemaURL),
|
||||
)
|
||||
|
||||
inst := &instrumentation{}
|
||||
|
||||
var err, e error
|
||||
inst.inflight, e = otelconv.NewSDKComponentInflight(meter)
|
||||
err = errors.Join(err, e)
|
||||
|
||||
inst.exported, e = otelconv.NewSDKComponentExported(meter)
|
||||
err = errors.Join(err, e)
|
||||
|
||||
return inst, err
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
// ❌ Avoid this pattern.
|
||||
func (c *Component) initObservability() {
|
||||
// Initialize observability metrics
|
||||
if !x.Observability.Enabled() {
|
||||
return
|
||||
}
|
||||
|
||||
// Initialize observability metrics
|
||||
c.inst = &instrumentation{/* ... */}
|
||||
}
|
||||
```
|
||||
|
||||
[side-effect]: https://en.wikipedia.org/wiki/Side_effect_(computer_science)
|
||||
|
||||
#### Performance
|
||||
|
||||
When observability is disabled there should be little to no overhead.
|
||||
|
||||
```go
|
||||
func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error {
|
||||
if e.inst != nil {
|
||||
attrs := expensiveOperation()
|
||||
e.inst.recordSpanInflight(ctx, int64(len(spans)), attrs...)
|
||||
}
|
||||
// Export spans...
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
// ❌ Avoid this pattern.
|
||||
func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error {
|
||||
attrs := expensiveOperation()
|
||||
e.inst.recordSpanInflight(ctx, int64(len(spans)), attrs...)
|
||||
// Export spans...
|
||||
}
|
||||
|
||||
func (i *instrumentation) recordSpanInflight(ctx context.Context, count int64, attrs ...attribute.KeyValue) {
|
||||
if i == nil || i.inflight == nil {
|
||||
return
|
||||
}
|
||||
i.inflight.Add(ctx, count, metric.WithAttributes(attrs...))
|
||||
}
|
||||
```
|
||||
|
||||
When observability is enabled, the instrumentation code paths should be optimized to reduce allocation and computation overhead.
|
||||
|
||||
##### Attribute and Option Allocation Management
|
||||
|
||||
Pool attribute slices and options with [`sync.Pool`] to minimize allocations in measurement calls with dynamic attributes.
|
||||
|
||||
```go
|
||||
var (
|
||||
attrPool = sync.Pool{
|
||||
New: func() any {
|
||||
// Pre-allocate common capacity
|
||||
knownCap := 8 // Adjust based on expected usage
|
||||
s := make([]attribute.KeyValue, 0, knownCap)
|
||||
// Return a pointer to avoid extra allocation on Put().
|
||||
return &s
|
||||
},
|
||||
}
|
||||
|
||||
addOptPool = &sync.Pool{
|
||||
New: func() any {
|
||||
const n = 1 // WithAttributeSet
|
||||
o := make([]metric.AddOption, 0, n)
|
||||
// Return a pointer to avoid extra allocation on Put().
|
||||
return &o
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func (i *instrumentation) record(ctx context.Context, value int64, baseAttrs ...attribute.KeyValue) {
|
||||
attrs := attrPool.Get().(*[]attribute.KeyValue)
|
||||
defer func() {
|
||||
*attrs = (*attrs)[:0] // Reset.
|
||||
attrPool.Put(attrs)
|
||||
}()
|
||||
|
||||
*attrs = append(*attrs, baseAttrs...)
|
||||
// Add any dynamic attributes.
|
||||
*attrs = append(*attrs, semconv.OTelComponentName("exporter-1"))
|
||||
|
||||
addOpt := addOptPool.Get().(*[]metric.AddOption)
|
||||
defer func() {
|
||||
*addOpt = (*addOpt)[:0]
|
||||
addOptPool.Put(addOpt)
|
||||
}()
|
||||
|
||||
set := attribute.NewSet(*attrs...)
|
||||
*addOpt = append(*addOpt, metric.WithAttributeSet(set))
|
||||
|
||||
i.counter.Add(ctx, value, *addOpt...)
|
||||
}
|
||||
```
|
||||
|
||||
Pools are most effective when there are many pooled objects of the same sufficiently large size, and the objects are repeatedly used.
|
||||
This amortizes the cost of allocation and synchronization.
|
||||
Ideally, the pools should be scoped to be used as widely as possible within the component to maximize this efficiency while still ensuring correctness.
|
||||
|
||||
[`sync.Pool`]: https://pkg.go.dev/sync#Pool
|
||||
|
||||
##### Cache common attribute sets for repeated measurements
|
||||
|
||||
If a static set of attributes are used for measurements and they are known at compile time, pre-compute and cache these attributes.
|
||||
|
||||
```go
|
||||
type spanLiveSetKey struct {
|
||||
sampled bool
|
||||
}
|
||||
|
||||
var spanLiveSetCache = map[spanLiveSetKey]attribute.Set{
|
||||
{true}: attribute.NewSet(
|
||||
otelconv.SDKSpanLive{}.AttrSpanSamplingResult(
|
||||
otelconv.SpanSamplingResultRecordAndSample,
|
||||
),
|
||||
),
|
||||
{false}: attribute.NewSet(
|
||||
otelconv.SDKSpanLive{}.AttrSpanSamplingResult(
|
||||
otelconv.SpanSamplingResultRecordOnly,
|
||||
),
|
||||
),
|
||||
}
|
||||
|
||||
func spanLiveSet(sampled bool) attribute.Set {
|
||||
key := spanLiveSetKey{sampled: sampled}
|
||||
return spanLiveSetCache[key]
|
||||
}
|
||||
```
|
||||
|
||||
##### Benchmarking
|
||||
|
||||
Always provide benchmarks when introducing or refactoring instrumentation.
|
||||
Demonstrate the impact (allocs/op, B/op, ns/op) in enabled/disabled scenarios:
|
||||
|
||||
```go
|
||||
func BenchmarkExportSpans(b *testing.B) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
obsEnabled bool
|
||||
}{
|
||||
{"ObsDisabled", false},
|
||||
{"ObsEnabled", true},
|
||||
}
|
||||
|
||||
for _, scenario := range scenarios {
|
||||
b.Run(scenario.name, func(b *testing.B) {
|
||||
b.Setenv(
|
||||
"OTEL_GO_X_OBSERVABILITY",
|
||||
strconv.FormatBool(scenario.obsEnabled),
|
||||
)
|
||||
|
||||
exporter := NewExporter()
|
||||
spans := generateTestSpans(100)
|
||||
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = exporter.ExportSpans(context.Background(), spans)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Error Handling and Robustness
|
||||
|
||||
Errors should be reported back to the caller if possible, and partial failures should be handled as gracefully as possible.
|
||||
|
||||
```go
|
||||
func newInstrumentation() (*instrumentation, error) {
|
||||
if !x.Observability.Enabled() {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
m := otel.GetMeterProvider().Meter(/* initialize meter */)
|
||||
counter, err := otelconv.NewSDKComponentCounter(m)
|
||||
// Use the partially initialized counter if available.
|
||||
i := &instrumentation{counter: counter}
|
||||
// Return any error to the caller.
|
||||
return i, err
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
// ❌ Avoid this pattern.
|
||||
func newInstrumentation() *instrumentation {
|
||||
if !x.Observability.Enabled() {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
m := otel.GetMeterProvider().Meter(/* initialize meter */)
|
||||
counter, err := otelconv.NewSDKComponentCounter(m)
|
||||
if err != nil {
|
||||
// ❌ Do not dump the error to the OTel Handler. Return it to the
|
||||
// caller.
|
||||
otel.Handle(err)
|
||||
// ❌ Do not return nil if we can still use the partially initialized
|
||||
// counter.
|
||||
return nil
|
||||
}
|
||||
return &instrumentation{counter: counter}
|
||||
}
|
||||
```
|
||||
|
||||
If the instrumented component cannot report the error to the user, let it report the error to `otel.Handle`.
|
||||
|
||||
#### Context Propagation
|
||||
|
||||
Ensure observability measurements receive the correct context, especially for trace exemplars and distributed context:
|
||||
|
||||
```go
|
||||
func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error {
|
||||
// Use the provided context for observability measurements
|
||||
e.inst.recordSpanExportStarted(ctx, len(spans))
|
||||
|
||||
err := e.doExport(ctx, spans)
|
||||
|
||||
if err != nil {
|
||||
e.inst.recordSpanExportFailed(ctx, len(spans), err)
|
||||
} else {
|
||||
e.inst.recordSpanExportSucceeded(ctx, len(spans))
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
```go
|
||||
// ❌ Avoid this pattern.
|
||||
func (e *Exporter) ExportSpans(ctx context.Context, spans []trace.ReadOnlySpan) error {
|
||||
// ❌ Do not break the context propagation.
|
||||
e.inst.recordSpanExportStarted(context.Background(), len(spans))
|
||||
|
||||
err := e.doExport(ctx, spans)
|
||||
|
||||
/* ... */
|
||||
|
||||
return err
|
||||
}
|
||||
```
|
||||
|
||||
#### Semantic Conventions Compliance
|
||||
|
||||
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).
|
||||
|
||||
##### Component Identification
|
||||
|
||||
Component names and types should follow [semantic convention](https://github.com/open-telemetry/semantic-conventions/blob/1cf2476ae5e518225a766990a28a6d5602bd5a30/docs/registry/attributes/otel.md#otel-component-attributes).
|
||||
|
||||
If a component is not a well-known type specified in the semantic conventions, use the package path scope type as a stable identifier.
|
||||
|
||||
```go
|
||||
componentType := "go.opentelemetry.io/otel/sdk/trace.Span"
|
||||
```
|
||||
|
||||
```go
|
||||
// ❌ Do not do this.
|
||||
componentType := "trace-span"
|
||||
```
|
||||
|
||||
The component name should be a stable unique identifier for the specific instance of the component.
|
||||
|
||||
Use a global counter to ensure uniqueness if necessary.
|
||||
|
||||
```go
|
||||
// Unique 0-based ID counter for component instances.
|
||||
var componentIDCounter atomic.Int64
|
||||
|
||||
// nextID returns the next unique ID for a component.
|
||||
func nextID() int64 {
|
||||
return componentIDCounter.Add(1) - 1
|
||||
}
|
||||
|
||||
// componentName returns a unique name for the component instance.
|
||||
func componentName() attribute.KeyValue {
|
||||
id := nextID()
|
||||
name := fmt.Sprintf("%s/%d", componentType, id)
|
||||
return semconv.OTelComponentName(name)
|
||||
}
|
||||
```
|
||||
|
||||
The component ID will need to be resettable for deterministic testing.
|
||||
If tests are in a different package than the component being tested (i.e. a `<component package>_test` package name), use a generated `counter` internal package to manage the counter.
|
||||
See [stdouttrace exporter example](./exporters/stdout/stdouttrace/internal/gen.go) for reference.
|
||||
|
||||
#### Testing
|
||||
|
||||
Use deterministic testing with isolated state:
|
||||
|
||||
```go
|
||||
func TestObservability(t *testing.T) {
|
||||
// Restore state after test to ensure this does not affect other tests.
|
||||
prev := otel.GetMeterProvider()
|
||||
t.Cleanup(func() { otel.SetMeterProvider(prev) })
|
||||
|
||||
// Isolate the meter provider for deterministic testing
|
||||
reader := metric.NewManualReader()
|
||||
meterProvider := metric.NewMeterProvider(metric.WithReader(reader))
|
||||
otel.SetMeterProvider(meterProvider)
|
||||
|
||||
// Use t.Setenv to ensure environment variable is restored after test.
|
||||
t.Setenv("OTEL_GO_X_OBSERVABILITY", "true")
|
||||
|
||||
// Reset component ID counter to ensure deterministic component names.
|
||||
componentIDCounter.Store(0)
|
||||
|
||||
/* ... test code ... */
|
||||
}
|
||||
```
|
||||
|
||||
Test order should not affect results.
|
||||
Ensure that any global state (e.g. component ID counters) is reset between tests.
|
||||
|
||||
## Approvers and Maintainers
|
||||
|
||||
### Maintainers
|
||||
@@ -696,7 +1130,6 @@ For more information about the approver role, see the [community repository](htt
|
||||
### Triagers
|
||||
|
||||
- [Alex Kats](https://github.com/akats7), Capital One
|
||||
- [Cheng-Zhen Yang](https://github.com/scorpionknifes), Independent
|
||||
|
||||
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||
|
||||
@@ -704,6 +1137,7 @@ For more information about the triager role, see the [community repository](http
|
||||
|
||||
- [Aaron Clawson](https://github.com/MadVikingGod)
|
||||
- [Anthony Mirabella](https://github.com/Aneurysm9)
|
||||
- [Cheng-Zhen Yang](https://github.com/scorpionknifes)
|
||||
- [Chester Cheung](https://github.com/hanyuancheung)
|
||||
- [Evan Torrie](https://github.com/evantorrie)
|
||||
- [Gustavo Silva Paiva](https://github.com/paivagustavo)
|
||||
|
||||
3
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
3
vendor/go.opentelemetry.io/otel/Makefile
generated
vendored
@@ -146,11 +146,12 @@ build-tests/%:
|
||||
|
||||
# Tests
|
||||
|
||||
TEST_TARGETS := test-default test-bench test-short test-verbose test-race test-concurrent-safe
|
||||
TEST_TARGETS := test-default test-bench test-short test-verbose test-race test-concurrent-safe test-fuzz
|
||||
.PHONY: $(TEST_TARGETS) test
|
||||
test-default test-race: ARGS=-race
|
||||
test-bench: ARGS=-run=xxxxxMatchNothingxxxxx -test.benchtime=1ms -bench=.
|
||||
test-short: ARGS=-short
|
||||
test-fuzz: ARGS=-fuzztime=10s -fuzz
|
||||
test-verbose: ARGS=-v -race
|
||||
test-concurrent-safe: ARGS=-run=ConcurrentSafe -count=100 -race
|
||||
test-concurrent-safe: TIMEOUT=120
|
||||
|
||||
11
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
11
vendor/go.opentelemetry.io/otel/README.md
generated
vendored
@@ -55,25 +55,18 @@ Currently, this project supports the following environments.
|
||||
|----------|------------|--------------|
|
||||
| Ubuntu | 1.25 | amd64 |
|
||||
| Ubuntu | 1.24 | amd64 |
|
||||
| Ubuntu | 1.23 | amd64 |
|
||||
| Ubuntu | 1.25 | 386 |
|
||||
| Ubuntu | 1.24 | 386 |
|
||||
| Ubuntu | 1.23 | 386 |
|
||||
| Ubuntu | 1.25 | arm64 |
|
||||
| Ubuntu | 1.24 | arm64 |
|
||||
| Ubuntu | 1.23 | arm64 |
|
||||
| macOS 13 | 1.25 | amd64 |
|
||||
| macOS 13 | 1.24 | amd64 |
|
||||
| macOS 13 | 1.23 | amd64 |
|
||||
| macOS | 1.25 | amd64 |
|
||||
| macOS | 1.24 | amd64 |
|
||||
| macOS | 1.25 | arm64 |
|
||||
| macOS | 1.24 | arm64 |
|
||||
| macOS | 1.23 | arm64 |
|
||||
| Windows | 1.25 | amd64 |
|
||||
| Windows | 1.24 | amd64 |
|
||||
| Windows | 1.23 | amd64 |
|
||||
| Windows | 1.25 | 386 |
|
||||
| Windows | 1.24 | 386 |
|
||||
| Windows | 1.23 | 386 |
|
||||
|
||||
While this project should work for other systems, no compatibility guarantees
|
||||
are made for those systems currently.
|
||||
|
||||
72
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
72
vendor/go.opentelemetry.io/otel/RELEASING.md
generated
vendored
@@ -24,7 +24,7 @@ Ensure things look correct before submitting a pull request to include the addit
|
||||
|
||||
## Breaking changes validation
|
||||
|
||||
You can run `make gorelease` that runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes done in the public API.
|
||||
You can run `make gorelease` which runs [gorelease](https://pkg.go.dev/golang.org/x/exp/cmd/gorelease) to ensure that there are no unwanted changes made in the public API.
|
||||
|
||||
You can check/report problems with `gorelease` [here](https://golang.org/issues/26420).
|
||||
|
||||
@@ -62,7 +62,7 @@ Update go.mod for submodules to depend on the new release which will happen in t
|
||||
```
|
||||
|
||||
3. Update the [Changelog](./CHANGELOG.md).
|
||||
- Make sure all relevant changes for this release are included and are in language that non-contributors to the project can understand.
|
||||
- Make sure all relevant changes for this release are included and are written in language that non-contributors to the project can understand.
|
||||
To verify this, you can look directly at the commits since the `<last tag>`.
|
||||
|
||||
```
|
||||
@@ -107,33 +107,49 @@ It is critical you make sure the version you push upstream is correct.
|
||||
...
|
||||
```
|
||||
|
||||
## Sign artifacts
|
||||
|
||||
To ensure we comply with CNCF best practices, we need to sign the release artifacts.
|
||||
|
||||
Download the `.tar.gz` and `.zip` archives from the [tags page](https://github.com/open-telemetry/opentelemetry-go/tags) for the new release tag.
|
||||
Both archives need to be signed with your GPG key.
|
||||
|
||||
You can use [this script] to verify the contents of the archives before signing them.
|
||||
|
||||
To find your GPG key ID, run:
|
||||
|
||||
```terminal
|
||||
gpg --list-secret-keys --keyid-format=long
|
||||
```
|
||||
|
||||
The key ID is the 16-character string after `sec rsa4096/` (or similar).
|
||||
|
||||
Set environment variables and sign both artifacts:
|
||||
|
||||
```terminal
|
||||
export VERSION="<version>" # e.g., v1.32.0
|
||||
export KEY_ID="<your-gpg-key-id>"
|
||||
|
||||
gpg --local-user $KEY_ID --armor --detach-sign opentelemetry-go-$VERSION.tar.gz
|
||||
gpg --local-user $KEY_ID --armor --detach-sign opentelemetry-go-$VERSION.zip
|
||||
```
|
||||
|
||||
You can verify the signatures with:
|
||||
|
||||
```terminal
|
||||
gpg --verify opentelemetry-go-$VERSION.tar.gz.asc opentelemetry-go-$VERSION.tar.gz
|
||||
gpg --verify opentelemetry-go-$VERSION.zip.asc opentelemetry-go-$VERSION.zip
|
||||
```
|
||||
|
||||
[this script]: https://github.com/MrAlias/attest-sh
|
||||
|
||||
## Release
|
||||
|
||||
Finally create a Release for the new `<new tag>` on GitHub.
|
||||
The release body should include all the release notes from the Changelog for this release.
|
||||
|
||||
### Sign the Release Artifact
|
||||
|
||||
To ensure we comply with CNCF best practices, we need to sign the release artifact.
|
||||
The tarball attached to the GitHub release needs to be signed with your GPG key.
|
||||
|
||||
Follow [these steps] to sign the release artifact and upload it to GitHub.
|
||||
You can use [this script] to verify the contents of the tarball before signing it.
|
||||
|
||||
Be sure to use the correct GPG key when signing the release artifact.
|
||||
|
||||
```terminal
|
||||
gpg --local-user <key-id> --armor --detach-sign opentelemetry-go-<version>.tar.gz
|
||||
```
|
||||
|
||||
You can verify the signature with:
|
||||
|
||||
```terminal
|
||||
gpg --verify opentelemetry-go-<version>.tar.gz.asc opentelemetry-go-<version>.tar.gz
|
||||
```
|
||||
|
||||
[these steps]: https://wiki.debian.org/Creating%20signed%20GitHub%20releases
|
||||
[this script]: https://github.com/MrAlias/attest-sh
|
||||
***IMPORTANT***: GitHub Releases are immutable once created.
|
||||
You must upload the signed artifacts (`.tar.gz`, `.tar.gz.asc`, `.zip`, and `.zip.asc`) when creating the release, as they cannot be added or modified later.
|
||||
|
||||
## Post-Release
|
||||
|
||||
@@ -160,14 +176,6 @@ This helps track what changes were included in each release.
|
||||
|
||||
Once all related issues and PRs have been added to the milestone, close the milestone.
|
||||
|
||||
### Demo Repository
|
||||
|
||||
Bump the dependencies in the following Go services:
|
||||
|
||||
- [`accounting`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/accounting)
|
||||
- [`checkoutservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/checkout)
|
||||
- [`productcatalogservice`](https://github.com/open-telemetry/opentelemetry-demo/tree/main/src/product-catalog)
|
||||
|
||||
### Close the `Version Release` issue
|
||||
|
||||
Once the todo list in the `Version Release` issue is complete, close the issue.
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/VERSIONING.md
generated
vendored
2
vendor/go.opentelemetry.io/otel/VERSIONING.md
generated
vendored
@@ -83,7 +83,7 @@ is designed so the following goals can be achieved.
|
||||
in either the module path or the import path.
|
||||
* In addition to public APIs, telemetry produced by stable instrumentation
|
||||
will remain stable and backwards compatible. This is to avoid breaking
|
||||
alerts and dashboard.
|
||||
alerts and dashboards.
|
||||
* Modules will be used to encapsulate instrumentation, detectors, exporters,
|
||||
propagators, and any other independent sets of related components.
|
||||
* Experimental modules still under active development will be versioned at
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/attribute/encoder.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/attribute/encoder.go
generated
vendored
@@ -16,7 +16,7 @@ type (
|
||||
// set into a wire representation.
|
||||
Encoder interface {
|
||||
// Encode returns the serialized encoding of the attribute set using
|
||||
// its Iterator. This result may be cached by a attribute.Set.
|
||||
// its Iterator. This result may be cached by an attribute.Set.
|
||||
Encode(iterator Iterator) string
|
||||
|
||||
// ID returns a value that is unique for each class of attribute
|
||||
|
||||
92
vendor/go.opentelemetry.io/otel/attribute/hash.go
generated
vendored
Normal file
92
vendor/go.opentelemetry.io/otel/attribute/hash.go
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package attribute // import "go.opentelemetry.io/otel/attribute"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute/internal/xxhash"
|
||||
)
|
||||
|
||||
// Type identifiers. These identifiers are hashed before the value of the
|
||||
// corresponding type. This is done to distinguish values that are hashed with
|
||||
// the same value representation (e.g. `int64(1)` and `true`, []int64{0} and
|
||||
// int64(0)).
|
||||
//
|
||||
// These are all 8 byte length strings converted to a uint64 representation. A
|
||||
// uint64 is used instead of the string directly as an optimization, it avoids
|
||||
// the for loop in [xxhash] which adds minor overhead.
|
||||
const (
|
||||
boolID uint64 = 7953749933313450591 // "_boolean" (little endian)
|
||||
int64ID uint64 = 7592915492740740150 // "64_bit_i" (little endian)
|
||||
float64ID uint64 = 7376742710626956342 // "64_bit_f" (little endian)
|
||||
stringID uint64 = 6874584755375207263 // "_string_" (little endian)
|
||||
boolSliceID uint64 = 6875993255270243167 // "_[]bool_" (little endian)
|
||||
int64SliceID uint64 = 3762322556277578591 // "_[]int64" (little endian)
|
||||
float64SliceID uint64 = 7308324551835016539 // "[]double" (little endian)
|
||||
stringSliceID uint64 = 7453010373645655387 // "[]string" (little endian)
|
||||
)
|
||||
|
||||
// hashKVs returns a new xxHash64 hash of kvs.
|
||||
func hashKVs(kvs []KeyValue) uint64 {
|
||||
h := xxhash.New()
|
||||
for _, kv := range kvs {
|
||||
h = hashKV(h, kv)
|
||||
}
|
||||
return h.Sum64()
|
||||
}
|
||||
|
||||
// hashKV returns the xxHash64 hash of kv with h as the base.
|
||||
func hashKV(h xxhash.Hash, kv KeyValue) xxhash.Hash {
|
||||
h = h.String(string(kv.Key))
|
||||
|
||||
switch kv.Value.Type() {
|
||||
case BOOL:
|
||||
h = h.Uint64(boolID)
|
||||
h = h.Uint64(kv.Value.numeric)
|
||||
case INT64:
|
||||
h = h.Uint64(int64ID)
|
||||
h = h.Uint64(kv.Value.numeric)
|
||||
case FLOAT64:
|
||||
h = h.Uint64(float64ID)
|
||||
// Assumes numeric stored with math.Float64bits.
|
||||
h = h.Uint64(kv.Value.numeric)
|
||||
case STRING:
|
||||
h = h.Uint64(stringID)
|
||||
h = h.String(kv.Value.stringly)
|
||||
case BOOLSLICE:
|
||||
h = h.Uint64(boolSliceID)
|
||||
rv := reflect.ValueOf(kv.Value.slice)
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
h = h.Bool(rv.Index(i).Bool())
|
||||
}
|
||||
case INT64SLICE:
|
||||
h = h.Uint64(int64SliceID)
|
||||
rv := reflect.ValueOf(kv.Value.slice)
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
h = h.Int64(rv.Index(i).Int())
|
||||
}
|
||||
case FLOAT64SLICE:
|
||||
h = h.Uint64(float64SliceID)
|
||||
rv := reflect.ValueOf(kv.Value.slice)
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
h = h.Float64(rv.Index(i).Float())
|
||||
}
|
||||
case STRINGSLICE:
|
||||
h = h.Uint64(stringSliceID)
|
||||
rv := reflect.ValueOf(kv.Value.slice)
|
||||
for i := 0; i < rv.Len(); i++ {
|
||||
h = h.String(rv.Index(i).String())
|
||||
}
|
||||
case INVALID:
|
||||
default:
|
||||
// Logging is an alternative, but using the internal logger here
|
||||
// causes an import cycle so it is not done.
|
||||
v := kv.Value.AsInterface()
|
||||
msg := fmt.Sprintf("unknown value type: %[1]v (%[1]T)", v)
|
||||
panic(msg)
|
||||
}
|
||||
return h
|
||||
}
|
||||
64
vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go
generated
vendored
Normal file
64
vendor/go.opentelemetry.io/otel/attribute/internal/xxhash/xxhash.go
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package xxhash provides a wrapper around the xxhash library for attribute hashing.
|
||||
package xxhash // import "go.opentelemetry.io/otel/attribute/internal/xxhash"
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math"
|
||||
|
||||
"github.com/cespare/xxhash/v2"
|
||||
)
|
||||
|
||||
// Hash wraps xxhash.Digest to provide an API friendly for hashing attribute values.
|
||||
type Hash struct {
|
||||
d *xxhash.Digest
|
||||
}
|
||||
|
||||
// New returns a new initialized xxHash64 hasher.
|
||||
func New() Hash {
|
||||
return Hash{d: xxhash.New()}
|
||||
}
|
||||
|
||||
func (h Hash) Uint64(val uint64) Hash {
|
||||
var buf [8]byte
|
||||
binary.LittleEndian.PutUint64(buf[:], val)
|
||||
// errors from Write are always nil for xxhash
|
||||
// if it returns an err then panic
|
||||
_, err := h.d.Write(buf[:])
|
||||
if err != nil {
|
||||
panic("xxhash write of uint64 failed: " + err.Error())
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
func (h Hash) Bool(val bool) Hash { // nolint:revive // This is a hashing function.
|
||||
if val {
|
||||
return h.Uint64(1)
|
||||
}
|
||||
return h.Uint64(0)
|
||||
}
|
||||
|
||||
func (h Hash) Float64(val float64) Hash {
|
||||
return h.Uint64(math.Float64bits(val))
|
||||
}
|
||||
|
||||
func (h Hash) Int64(val int64) Hash {
|
||||
return h.Uint64(uint64(val)) // nolint:gosec // Overflow doesn't matter since we are hashing.
|
||||
}
|
||||
|
||||
func (h Hash) String(val string) Hash {
|
||||
// errors from WriteString are always nil for xxhash
|
||||
// if it returns an err then panic
|
||||
_, err := h.d.WriteString(val)
|
||||
if err != nil {
|
||||
panic("xxhash write of string failed: " + err.Error())
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
// Sum64 returns the current hash value.
|
||||
func (h Hash) Sum64() uint64 {
|
||||
return h.d.Sum64()
|
||||
}
|
||||
145
vendor/go.opentelemetry.io/otel/attribute/set.go
generated
vendored
145
vendor/go.opentelemetry.io/otel/attribute/set.go
generated
vendored
@@ -9,6 +9,8 @@ import (
|
||||
"reflect"
|
||||
"slices"
|
||||
"sort"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute/internal/xxhash"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -23,19 +25,19 @@ type (
|
||||
// the Equals method to ensure stable equivalence checking.
|
||||
//
|
||||
// Users should also use the Distinct returned from Equivalent as a map key
|
||||
// instead of a Set directly. In addition to that type providing guarantees
|
||||
// on stable equivalence, it may also provide performance improvements.
|
||||
// instead of a Set directly. Set has relatively poor performance when used
|
||||
// as a map key compared to Distinct.
|
||||
Set struct {
|
||||
equivalent Distinct
|
||||
hash uint64
|
||||
data any
|
||||
}
|
||||
|
||||
// Distinct is a unique identifier of a Set.
|
||||
// Distinct is an identifier of a Set which is very likely to be unique.
|
||||
//
|
||||
// Distinct is designed to ensure equivalence stability: comparisons will
|
||||
// return the same value across versions. For this reason, Distinct should
|
||||
// always be used as a map key instead of a Set.
|
||||
// Distinct should be used as a map key instead of a Set for to provide better
|
||||
// performance for map operations.
|
||||
Distinct struct {
|
||||
iface any
|
||||
hash uint64
|
||||
}
|
||||
|
||||
// Sortable implements sort.Interface, used for sorting KeyValue.
|
||||
@@ -46,15 +48,34 @@ type (
|
||||
Sortable []KeyValue
|
||||
)
|
||||
|
||||
// Compile time check these types remain comparable.
|
||||
var (
|
||||
_ = isComparable(Set{})
|
||||
_ = isComparable(Distinct{})
|
||||
)
|
||||
|
||||
func isComparable[T comparable](t T) T { return t }
|
||||
|
||||
var (
|
||||
// keyValueType is used in computeDistinctReflect.
|
||||
keyValueType = reflect.TypeOf(KeyValue{})
|
||||
|
||||
// emptySet is returned for empty attribute sets.
|
||||
emptySet = &Set{
|
||||
equivalent: Distinct{
|
||||
iface: [0]KeyValue{},
|
||||
},
|
||||
// emptyHash is the hash of an empty set.
|
||||
emptyHash = xxhash.New().Sum64()
|
||||
|
||||
// userDefinedEmptySet is an empty set. It was mistakenly exposed to users
|
||||
// as something they can assign to, so it must remain addressable and
|
||||
// mutable.
|
||||
//
|
||||
// This is kept for backwards compatibility, but should not be used in new code.
|
||||
userDefinedEmptySet = &Set{
|
||||
hash: emptyHash,
|
||||
data: [0]KeyValue{},
|
||||
}
|
||||
|
||||
emptySet = Set{
|
||||
hash: emptyHash,
|
||||
data: [0]KeyValue{},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -62,33 +83,35 @@ var (
|
||||
//
|
||||
// This is a convenience provided for optimized calling utility.
|
||||
func EmptySet() *Set {
|
||||
return emptySet
|
||||
}
|
||||
|
||||
// reflectValue abbreviates reflect.ValueOf(d).
|
||||
func (d Distinct) reflectValue() reflect.Value {
|
||||
return reflect.ValueOf(d.iface)
|
||||
// Continue to return the pointer to the user-defined empty set for
|
||||
// backwards-compatibility.
|
||||
//
|
||||
// New code should not use this, instead use emptySet.
|
||||
return userDefinedEmptySet
|
||||
}
|
||||
|
||||
// Valid reports whether this value refers to a valid Set.
|
||||
func (d Distinct) Valid() bool {
|
||||
return d.iface != nil
|
||||
func (d Distinct) Valid() bool { return d.hash != 0 }
|
||||
|
||||
// reflectValue abbreviates reflect.ValueOf(d).
|
||||
func (l Set) reflectValue() reflect.Value {
|
||||
return reflect.ValueOf(l.data)
|
||||
}
|
||||
|
||||
// Len returns the number of attributes in this set.
|
||||
func (l *Set) Len() int {
|
||||
if l == nil || !l.equivalent.Valid() {
|
||||
if l == nil || l.hash == 0 {
|
||||
return 0
|
||||
}
|
||||
return l.equivalent.reflectValue().Len()
|
||||
return l.reflectValue().Len()
|
||||
}
|
||||
|
||||
// Get returns the KeyValue at ordered position idx in this set.
|
||||
func (l *Set) Get(idx int) (KeyValue, bool) {
|
||||
if l == nil || !l.equivalent.Valid() {
|
||||
if l == nil || l.hash == 0 {
|
||||
return KeyValue{}, false
|
||||
}
|
||||
value := l.equivalent.reflectValue()
|
||||
value := l.reflectValue()
|
||||
|
||||
if idx >= 0 && idx < value.Len() {
|
||||
// Note: The Go compiler successfully avoids an allocation for
|
||||
@@ -101,10 +124,10 @@ 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 || !l.equivalent.Valid() {
|
||||
if l == nil || l.hash == 0 {
|
||||
return Value{}, false
|
||||
}
|
||||
rValue := l.equivalent.reflectValue()
|
||||
rValue := l.reflectValue()
|
||||
vlen := rValue.Len()
|
||||
|
||||
idx := sort.Search(vlen, func(idx int) bool {
|
||||
@@ -144,20 +167,29 @@ func (l *Set) ToSlice() []KeyValue {
|
||||
return iter.ToSlice()
|
||||
}
|
||||
|
||||
// Equivalent returns a value that may be used as a map key. The Distinct type
|
||||
// guarantees that the result will equal the equivalent. Distinct value of any
|
||||
// Equivalent returns a value that may be used as a map key. Equal Distinct
|
||||
// values are very likely to be equivalent attribute Sets. Distinct value of any
|
||||
// attribute set with the same elements as this, where sets are made unique by
|
||||
// choosing the last value in the input for any given key.
|
||||
func (l *Set) Equivalent() Distinct {
|
||||
if l == nil || !l.equivalent.Valid() {
|
||||
return emptySet.equivalent
|
||||
if l == nil || l.hash == 0 {
|
||||
return Distinct{hash: emptySet.hash}
|
||||
}
|
||||
return l.equivalent
|
||||
return Distinct{hash: l.hash}
|
||||
}
|
||||
|
||||
// Equals reports whether the argument set is equivalent to this set.
|
||||
func (l *Set) Equals(o *Set) bool {
|
||||
return l.Equivalent() == o.Equivalent()
|
||||
if l.Equivalent() != o.Equivalent() {
|
||||
return false
|
||||
}
|
||||
if l == nil || l.hash == 0 {
|
||||
l = &emptySet
|
||||
}
|
||||
if o == nil || o.hash == 0 {
|
||||
o = &emptySet
|
||||
}
|
||||
return l.data == o.data
|
||||
}
|
||||
|
||||
// Encoded returns the encoded form of this set, according to encoder.
|
||||
@@ -169,12 +201,6 @@ func (l *Set) Encoded(encoder Encoder) string {
|
||||
return encoder.Encode(l.Iter())
|
||||
}
|
||||
|
||||
func empty() Set {
|
||||
return Set{
|
||||
equivalent: emptySet.equivalent,
|
||||
}
|
||||
}
|
||||
|
||||
// NewSet returns a new Set. See the documentation for
|
||||
// NewSetWithSortableFiltered for more details.
|
||||
//
|
||||
@@ -204,7 +230,7 @@ func NewSetWithSortable(kvs []KeyValue, _ *Sortable) Set {
|
||||
func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
||||
// Check for empty set.
|
||||
if len(kvs) == 0 {
|
||||
return empty(), nil
|
||||
return emptySet, nil
|
||||
}
|
||||
|
||||
// Stable sort so the following de-duplication can implement
|
||||
@@ -233,10 +259,10 @@ func NewSetWithFiltered(kvs []KeyValue, filter Filter) (Set, []KeyValue) {
|
||||
|
||||
if filter != nil {
|
||||
if div := filteredToFront(kvs, filter); div != 0 {
|
||||
return Set{equivalent: computeDistinct(kvs[div:])}, kvs[:div]
|
||||
return newSet(kvs[div:]), kvs[:div]
|
||||
}
|
||||
}
|
||||
return Set{equivalent: computeDistinct(kvs)}, nil
|
||||
return newSet(kvs), nil
|
||||
}
|
||||
|
||||
// NewSetWithSortableFiltered returns a new Set.
|
||||
@@ -316,7 +342,7 @@ func (l *Set) Filter(re Filter) (Set, []KeyValue) {
|
||||
if first == 0 {
|
||||
// It is safe to assume len(slice) >= 1 given we found at least one
|
||||
// attribute above that needs to be filtered out.
|
||||
return Set{equivalent: computeDistinct(slice[1:])}, slice[:1]
|
||||
return newSet(slice[1:]), slice[:1]
|
||||
}
|
||||
|
||||
// Move the filtered slice[first] to the front (preserving order).
|
||||
@@ -326,25 +352,24 @@ func (l *Set) Filter(re Filter) (Set, []KeyValue) {
|
||||
|
||||
// Do not re-evaluate re(slice[first+1:]).
|
||||
div := filteredToFront(slice[1:first+1], re) + 1
|
||||
return Set{equivalent: computeDistinct(slice[div:])}, slice[:div]
|
||||
return newSet(slice[div:]), slice[:div]
|
||||
}
|
||||
|
||||
// computeDistinct returns a Distinct using either the fixed- or
|
||||
// reflect-oriented code path, depending on the size of the input. The input
|
||||
// slice is assumed to already be sorted and de-duplicated.
|
||||
func computeDistinct(kvs []KeyValue) Distinct {
|
||||
iface := computeDistinctFixed(kvs)
|
||||
if iface == nil {
|
||||
iface = computeDistinctReflect(kvs)
|
||||
// newSet returns a new set based on the sorted and uniqued kvs.
|
||||
func newSet(kvs []KeyValue) Set {
|
||||
s := Set{
|
||||
hash: hashKVs(kvs),
|
||||
data: computeDataFixed(kvs),
|
||||
}
|
||||
return Distinct{
|
||||
iface: iface,
|
||||
if s.data == nil {
|
||||
s.data = computeDataReflect(kvs)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// computeDistinctFixed computes a Distinct for small slices. It returns nil
|
||||
// if the input is too large for this code path.
|
||||
func computeDistinctFixed(kvs []KeyValue) any {
|
||||
// computeDataFixed computes a Set data for small slices. It returns nil if the
|
||||
// input is too large for this code path.
|
||||
func computeDataFixed(kvs []KeyValue) any {
|
||||
switch len(kvs) {
|
||||
case 1:
|
||||
return [1]KeyValue(kvs)
|
||||
@@ -371,9 +396,9 @@ func computeDistinctFixed(kvs []KeyValue) any {
|
||||
}
|
||||
}
|
||||
|
||||
// computeDistinctReflect computes a Distinct using reflection, works for any
|
||||
// size input.
|
||||
func computeDistinctReflect(kvs []KeyValue) any {
|
||||
// computeDataReflect computes a Set data using reflection, works for any size
|
||||
// input.
|
||||
func computeDataReflect(kvs []KeyValue) any {
|
||||
at := reflect.New(reflect.ArrayOf(len(kvs), keyValueType)).Elem()
|
||||
for i, keyValue := range kvs {
|
||||
*(at.Index(i).Addr().Interface().(*KeyValue)) = keyValue
|
||||
@@ -383,7 +408,7 @@ func computeDistinctReflect(kvs []KeyValue) any {
|
||||
|
||||
// MarshalJSON returns the JSON encoding of the Set.
|
||||
func (l *Set) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(l.equivalent.iface)
|
||||
return json.Marshal(l.data)
|
||||
}
|
||||
|
||||
// MarshalLog is the marshaling function used by the logging system to represent this Set.
|
||||
|
||||
5
vendor/go.opentelemetry.io/otel/attribute/type_string.go
generated
vendored
5
vendor/go.opentelemetry.io/otel/attribute/type_string.go
generated
vendored
@@ -24,8 +24,9 @@ const _Type_name = "INVALIDBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICE
|
||||
var _Type_index = [...]uint8{0, 7, 11, 16, 23, 29, 38, 48, 60, 71}
|
||||
|
||||
func (i Type) String() string {
|
||||
if i < 0 || i >= Type(len(_Type_index)-1) {
|
||||
idx := int(i) - 0
|
||||
if i < 0 || idx >= len(_Type_index)-1 {
|
||||
return "Type(" + strconv.FormatInt(int64(i), 10) + ")"
|
||||
}
|
||||
return _Type_name[_Type_index[i]:_Type_index[i+1]]
|
||||
return _Type_name[_Type_index[idx]:_Type_index[idx+1]]
|
||||
}
|
||||
|
||||
12
vendor/go.opentelemetry.io/otel/baggage/baggage.go
generated
vendored
12
vendor/go.opentelemetry.io/otel/baggage/baggage.go
generated
vendored
@@ -648,7 +648,7 @@ func parsePropertyInternal(s string) (p Property, ok bool) {
|
||||
// If we couldn't find any valid key character,
|
||||
// it means the key is either empty or invalid.
|
||||
if keyStart == keyEnd {
|
||||
return
|
||||
return p, ok
|
||||
}
|
||||
|
||||
// Skip spaces after the key: " key< >= value ".
|
||||
@@ -658,13 +658,13 @@ func parsePropertyInternal(s string) (p Property, ok bool) {
|
||||
// A key can have no value, like: " key ".
|
||||
ok = true
|
||||
p.key = s[keyStart:keyEnd]
|
||||
return
|
||||
return p, ok
|
||||
}
|
||||
|
||||
// If we have not reached the end and we can't find the '=' delimiter,
|
||||
// it means the property is invalid.
|
||||
if s[index] != keyValueDelimiter[0] {
|
||||
return
|
||||
return p, ok
|
||||
}
|
||||
|
||||
// Attempting to parse the value.
|
||||
@@ -690,14 +690,14 @@ func parsePropertyInternal(s string) (p Property, ok bool) {
|
||||
// we have not reached the end, it means the property is
|
||||
// invalid, something like: " key = value value1".
|
||||
if index != len(s) {
|
||||
return
|
||||
return p, ok
|
||||
}
|
||||
|
||||
// Decode a percent-encoded value.
|
||||
rawVal := s[valueStart:valueEnd]
|
||||
unescapeVal, err := url.PathUnescape(rawVal)
|
||||
if err != nil {
|
||||
return
|
||||
return p, ok
|
||||
}
|
||||
value := replaceInvalidUTF8Sequences(len(rawVal), unescapeVal)
|
||||
|
||||
@@ -706,7 +706,7 @@ func parsePropertyInternal(s string) (p Property, ok bool) {
|
||||
p.hasValue = true
|
||||
|
||||
p.value = value
|
||||
return
|
||||
return p, ok
|
||||
}
|
||||
|
||||
func skipSpace(s string, offset int) int {
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/dependencies.Dockerfile
generated
vendored
2
vendor/go.opentelemetry.io/otel/dependencies.Dockerfile
generated
vendored
@@ -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.17.1@sha256:32523b5e44fb44418786347e9f7dde187d8797adb6d57a2ee99c245346c3cdfe AS weaver
|
||||
FROM otel/weaver:v0.19.0@sha256:3d20814cef548f1d31f27f054fb4cd6a05125641a9f7cc29fc7eb234e8052cd9 AS weaver
|
||||
FROM avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee AS markdown
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/internal/global/meter.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/internal/global/meter.go
generated
vendored
@@ -105,7 +105,7 @@ type delegatedInstrument interface {
|
||||
setDelegate(metric.Meter)
|
||||
}
|
||||
|
||||
// instID are the identifying properties of a instrument.
|
||||
// instID are the identifying properties of an instrument.
|
||||
type instID struct {
|
||||
// name is the name of the stream.
|
||||
name string
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/metric.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/metric.go
generated
vendored
@@ -11,7 +11,7 @@ import (
|
||||
// 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
|
||||
// If the name is empty, then an implementation defined default name will be
|
||||
// used instead.
|
||||
//
|
||||
// If this is called before a global MeterProvider is registered the returned
|
||||
|
||||
38
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
38
vendor/go.opentelemetry.io/otel/metric/config.go
generated
vendored
@@ -3,7 +3,11 @@
|
||||
|
||||
package metric // import "go.opentelemetry.io/otel/metric"
|
||||
|
||||
import "go.opentelemetry.io/otel/attribute"
|
||||
import (
|
||||
"slices"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
)
|
||||
|
||||
// MeterConfig contains options for Meters.
|
||||
type MeterConfig struct {
|
||||
@@ -62,12 +66,38 @@ func WithInstrumentationVersion(version string) MeterOption {
|
||||
})
|
||||
}
|
||||
|
||||
// WithInstrumentationAttributes sets the instrumentation attributes.
|
||||
// WithInstrumentationAttributes adds the instrumentation attributes.
|
||||
//
|
||||
// The passed attributes will be de-duplicated.
|
||||
// This is equivalent to calling [WithInstrumentationAttributeSet] with an
|
||||
// [attribute.Set] created from a clone of the passed attributes.
|
||||
// [WithInstrumentationAttributeSet] is recommended for more control.
|
||||
//
|
||||
// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet]
|
||||
// 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 WithInstrumentationAttributes(attr ...attribute.KeyValue) MeterOption {
|
||||
set := attribute.NewSet(slices.Clone(attr)...)
|
||||
return WithInstrumentationAttributeSet(set)
|
||||
}
|
||||
|
||||
// WithInstrumentationAttributeSet adds the instrumentation attributes.
|
||||
//
|
||||
// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet]
|
||||
// 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 WithInstrumentationAttributeSet(set attribute.Set) MeterOption {
|
||||
if set.Len() == 0 {
|
||||
return meterOptionFunc(func(config MeterConfig) MeterConfig {
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
return meterOptionFunc(func(config MeterConfig) MeterConfig {
|
||||
config.attrs = attribute.NewSet(attr...)
|
||||
if config.attrs.Len() == 0 {
|
||||
config.attrs = set
|
||||
} else {
|
||||
config.attrs = mergeSets(config.attrs, set)
|
||||
}
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/propagation/trace_context.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/propagation/trace_context.go
generated
vendored
@@ -111,7 +111,7 @@ func (TraceContext) extract(carrier TextMapCarrier) trace.SpanContext {
|
||||
}
|
||||
|
||||
// Clear all flags other than the trace-context supported sampling bit.
|
||||
scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled
|
||||
scc.TraceFlags = trace.TraceFlags(opts[0]) & trace.FlagsSampled // nolint:gosec // slice size already checked.
|
||||
|
||||
// Ignore the error returned here. Failure to parse tracestate MUST NOT
|
||||
// affect the parsing of traceparent according to the W3C tracecontext
|
||||
|
||||
51
vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go
generated
vendored
51
vendor/go.opentelemetry.io/otel/semconv/v1.37.0/error_type.go
generated
vendored
@@ -4,28 +4,53 @@
|
||||
package semconv // import "go.opentelemetry.io/otel/semconv/v1.37.0"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"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
|
||||
}
|
||||
t := reflect.TypeOf(err)
|
||||
var value string
|
||||
if t.PkgPath() == "" && t.Name() == "" {
|
||||
// Likely a builtin type.
|
||||
value = t.String()
|
||||
} else {
|
||||
value = fmt.Sprintf("%s.%s", t.PkgPath(), t.Name())
|
||||
}
|
||||
|
||||
if value == "" {
|
||||
return ErrorTypeOther
|
||||
}
|
||||
return ErrorTypeKey.String(value)
|
||||
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
|
||||
}
|
||||
|
||||
45
vendor/go.opentelemetry.io/otel/trace/config.go
generated
vendored
45
vendor/go.opentelemetry.io/otel/trace/config.go
generated
vendored
@@ -4,6 +4,7 @@
|
||||
package trace // import "go.opentelemetry.io/otel/trace"
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
@@ -304,12 +305,50 @@ func WithInstrumentationVersion(version string) TracerOption {
|
||||
})
|
||||
}
|
||||
|
||||
// WithInstrumentationAttributes sets the instrumentation attributes.
|
||||
// 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...)
|
||||
}
|
||||
|
||||
// WithInstrumentationAttributes adds the instrumentation attributes.
|
||||
//
|
||||
// The passed attributes will be de-duplicated.
|
||||
// This is equivalent to calling [WithInstrumentationAttributeSet] with an
|
||||
// [attribute.Set] created from a clone of the passed attributes.
|
||||
// [WithInstrumentationAttributeSet] is recommended for more control.
|
||||
//
|
||||
// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet]
|
||||
// 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 WithInstrumentationAttributes(attr ...attribute.KeyValue) TracerOption {
|
||||
set := attribute.NewSet(slices.Clone(attr)...)
|
||||
return WithInstrumentationAttributeSet(set)
|
||||
}
|
||||
|
||||
// WithInstrumentationAttributeSet adds the instrumentation attributes.
|
||||
//
|
||||
// If multiple [WithInstrumentationAttributes] or [WithInstrumentationAttributeSet]
|
||||
// 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 WithInstrumentationAttributeSet(set attribute.Set) TracerOption {
|
||||
if set.Len() == 0 {
|
||||
return tracerOptionFunc(func(config TracerConfig) TracerConfig {
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
return tracerOptionFunc(func(config TracerConfig) TracerConfig {
|
||||
config.attrs = attribute.NewSet(attr...)
|
||||
if config.attrs.Len() == 0 {
|
||||
config.attrs = set
|
||||
} else {
|
||||
config.attrs = mergeSets(config.attrs, set)
|
||||
}
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
||||
4
vendor/go.opentelemetry.io/otel/trace/span.go
generated
vendored
4
vendor/go.opentelemetry.io/otel/trace/span.go
generated
vendored
@@ -66,6 +66,10 @@ type Span interface {
|
||||
// SetAttributes sets kv as attributes of the Span. If a key from kv
|
||||
// already exists for an attribute of the Span it will be overwritten with
|
||||
// the value contained in kv.
|
||||
//
|
||||
// Note that adding attributes at span creation using [WithAttributes] is preferred
|
||||
// to calling SetAttribute later, as samplers can only consider information
|
||||
// already present during span creation.
|
||||
SetAttributes(kv ...attribute.KeyValue)
|
||||
|
||||
// TracerProvider returns a TracerProvider that can be used to generate
|
||||
|
||||
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
2
vendor/go.opentelemetry.io/otel/version.go
generated
vendored
@@ -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.38.0"
|
||||
return "1.39.0"
|
||||
}
|
||||
|
||||
27
vendor/go.opentelemetry.io/otel/versions.yaml
generated
vendored
27
vendor/go.opentelemetry.io/otel/versions.yaml
generated
vendored
@@ -3,7 +3,7 @@
|
||||
|
||||
module-sets:
|
||||
stable-v1:
|
||||
version: v1.38.0
|
||||
version: v1.39.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.60.0
|
||||
version: v0.61.0
|
||||
modules:
|
||||
- go.opentelemetry.io/otel/exporters/prometheus
|
||||
experimental-logs:
|
||||
version: v0.14.0
|
||||
version: v0.15.0
|
||||
modules:
|
||||
- go.opentelemetry.io/otel/log
|
||||
- go.opentelemetry.io/otel/log/logtest
|
||||
@@ -36,9 +36,28 @@ module-sets:
|
||||
- go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp
|
||||
- go.opentelemetry.io/otel/exporters/stdout/stdoutlog
|
||||
experimental-schema:
|
||||
version: v0.0.13
|
||||
version: v0.0.14
|
||||
modules:
|
||||
- go.opentelemetry.io/otel/schema
|
||||
excluded-modules:
|
||||
- go.opentelemetry.io/otel/internal/tools
|
||||
- go.opentelemetry.io/otel/trace/internal/telemetry/test
|
||||
modules:
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/prometheus:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp:
|
||||
version-refs:
|
||||
- ./internal/version.go
|
||||
|
||||
16
vendor/modules.txt
vendored
16
vendor/modules.txt
vendored
@@ -45,6 +45,9 @@ github.com/Microsoft/hcsshim/internal/vmcompute
|
||||
github.com/Microsoft/hcsshim/internal/wclayer
|
||||
github.com/Microsoft/hcsshim/internal/winapi
|
||||
github.com/Microsoft/hcsshim/osversion
|
||||
# github.com/cespare/xxhash/v2 v2.3.0
|
||||
## explicit; go 1.11
|
||||
github.com/cespare/xxhash/v2
|
||||
# github.com/containerd/cgroups/v3 v3.1.2
|
||||
## explicit; go 1.22.0
|
||||
github.com/containerd/cgroups/v3/cgroup1/stats
|
||||
@@ -390,11 +393,12 @@ 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.38.0
|
||||
## explicit; go 1.23.0
|
||||
# go.opentelemetry.io/otel v1.39.0
|
||||
## explicit; go 1.24.0
|
||||
go.opentelemetry.io/otel
|
||||
go.opentelemetry.io/otel/attribute
|
||||
go.opentelemetry.io/otel/attribute/internal
|
||||
go.opentelemetry.io/otel/attribute/internal/xxhash
|
||||
go.opentelemetry.io/otel/baggage
|
||||
go.opentelemetry.io/otel/codes
|
||||
go.opentelemetry.io/otel/internal/baggage
|
||||
@@ -403,13 +407,13 @@ 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.37.0
|
||||
# go.opentelemetry.io/otel/metric v1.38.0
|
||||
## explicit; go 1.23.0
|
||||
# go.opentelemetry.io/otel/metric v1.39.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.38.0
|
||||
## explicit; go 1.23.0
|
||||
# go.opentelemetry.io/otel/trace v1.39.0
|
||||
## explicit; go 1.24.0
|
||||
go.opentelemetry.io/otel/trace
|
||||
go.opentelemetry.io/otel/trace/embedded
|
||||
go.opentelemetry.io/otel/trace/internal/telemetry
|
||||
|
||||
Reference in New Issue
Block a user