1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00
Files
opentelemetry-go/attribute/type_string.go
T
Robert Pająk d13f8ecb2d attribute: add SLICE type support (#8166)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/7934

```
$ go test -run=^$ -bench=BenchmarkSlice
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkSlice/Len3/Value-20                    25297926                52.56 ns/op          144 B/op          1 allocs/op
BenchmarkSlice/Len3/KeyValue-20                 21315132                55.97 ns/op          144 B/op          1 allocs/op
BenchmarkSlice/Len3/AsSlice-20                  24214248                50.03 ns/op          144 B/op          1 allocs/op
BenchmarkSlice/Len3/String-20                   14148270                86.48 ns/op           48 B/op          1 allocs/op
BenchmarkSlice/Len3/Emit-20                     13605388                85.18 ns/op           48 B/op          1 allocs/op
BenchmarkSlice/Len5Nested/Value-20              16086171                71.30 ns/op          240 B/op          1 allocs/op
BenchmarkSlice/Len5Nested/KeyValue-20           15547844                75.81 ns/op          240 B/op          1 allocs/op
BenchmarkSlice/Len5Nested/AsSlice-20            17806996                66.16 ns/op          240 B/op          1 allocs/op
BenchmarkSlice/Len5Nested/String-20              7409064               165.2 ns/op            64 B/op          1 allocs/op
BenchmarkSlice/Len5Nested/Emit-20                7666302               161.0 ns/op            64 B/op          1 allocs/op
PASS
ok      go.opentelemetry.io/otel/attribute      12.980s
```

```
$ go test -run=^$ -bench=BenchmarkHashKVs
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkHashKVs-20      1268742               940.5 ns/op             0 B/op          0 allocs/op
PASS
ok      go.opentelemetry.io/otel/attribute      1.198s
```
2026-04-16 12:38:32 +02:00

35 lines
873 B
Go

// Code generated by "stringer -type=Type"; DO NOT EDIT.
package attribute
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[EMPTY-0]
_ = x[BOOL-1]
_ = x[INT64-2]
_ = x[FLOAT64-3]
_ = x[STRING-4]
_ = x[BOOLSLICE-5]
_ = x[INT64SLICE-6]
_ = x[FLOAT64SLICE-7]
_ = x[STRINGSLICE-8]
_ = x[BYTESLICE-9]
_ = x[SLICE-10]
}
const _Type_name = "EMPTYBOOLINT64FLOAT64STRINGBOOLSLICEINT64SLICEFLOAT64SLICESTRINGSLICEBYTESLICESLICE"
var _Type_index = [...]uint8{0, 5, 9, 14, 21, 27, 36, 46, 58, 69, 78, 83}
func (i Type) String() string {
idx := int(i) - 0
if i < 0 || idx >= len(_Type_index)-1 {
return "Type(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _Type_name[_Type_index[idx]:_Type_index[idx+1]]
}