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
Robert Pająk
866dd2504c
attribute: deprecate Value.Emit ( #8176 )
...
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/8145
2026-04-13 08:24:39 +02:00
Nesterov Yehor
5e9a80b3ce
attribute: add BYTESLICE type support ( #7948 )
...
Fixes #7933
Add BYTES type to https://pkg.go.dev/go.opentelemetry.io/otel/attribute
- Introduces BYTES type and byte
- Adds Bytes / BytesValue constructors
- Implements hashing support
- Adds base64 representation in Emit()
- Adds test coverage for constructors, hashing, and set equality
```
$ go test -run=^$ -bench=BenchmarkByteSlice
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: 13th Gen Intel(R) Core(TM) i7-13800H
BenchmarkByteSlice/Value-20 149529567 7.993 ns/op 0 B/op 0 allocs/op
BenchmarkByteSlice/KeyValue-20 136973736 8.768 ns/op 0 B/op 0 allocs/op
BenchmarkByteSlice/AsByteSlice-20 562915658 2.120 ns/op 0 B/op 0 allocs/op
BenchmarkByteSlice/Emit-20 29149410 40.26 ns/op 16 B/op 1 allocs/op
PASS
```
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
Co-authored-by: Robert Pająk <pellared@hotmail.com >
2026-04-07 09:39:32 +02:00
Robert Pająk
f4da59e651
attribute: change INVALID Type to EMPTY and mark INVALID as deprecated ( #8038 )
...
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/7932
Noticeable comment from previous PR:
https://github.com/open-telemetry/opentelemetry-go/pull/7942#discussion_r2913179215
Print the empty value as empty string per
https://opentelemetry.io/docs/specs/otel/common/#empty-values
2026-03-12 09:43:04 +01:00
Saharsh Tibrewala
3dc4cccef7
Add test cases to TestEmit in attribute ( #7751 )
...
Add test cases for `Key.Emit()` values:
- `BoolSliceValue`
- `IntValue`
- `IntSliceValue`
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2026-01-05 08:32:29 -08:00
Mikhail Mazurskiy
5e1c62a2d5
Modernize ( #7089 )
...
Use
https://pkg.go.dev/golang.org/x/tools/gopls/internal/analysis/modernize
to update code to new style.
---------
Co-authored-by: Flc゛ <four_leaf_clover@foxmail.com >
Co-authored-by: Damien Mathieu <42@dmathieu.com >
2025-07-29 10:19:11 +02:00
Damien Mathieu
2c15a77942
Fix lint issues for golangci-lint 1.62.0 ( #5967 )
...
This fixes the new lint issues brough by the golangci-lint upgrade in
https://github.com/open-telemetry/opentelemetry-go/pull/5966
2024-11-13 08:58:59 +01:00
Damien Mathieu
f8b9fe3dbe
Emit attributes slices as their json representation ( #5159 )
...
* emit slices as their json representation
* add changelog
* fix resource tests
* indicate invalid slice if we couldn't turn them into json
* move changelog entry to the unreleased section
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
2024-05-07 07:42:07 -07:00
Robert Pająk
7dea232a46
[chore] Simplify the license header ( #4987 )
2024-02-29 07:05:28 +01:00
Tyler Yahn
5dff273a1e
Use gofumpt instead of gofmt ( #4623 )
...
* Use gofumpt instead of gofmt in golangci-lint conf
* Run gofumpt fixes
* Format generated templates
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com >
2023-10-16 10:02:21 -07:00
Punya Biswal
ecf65d7968
Rename otel/label -> otel/attribute ( #1541 )
...
* Rename otel/label -> otel/attr
Leave the imported name alone, to avoid a large diff and conflicts
* Better import comment
* Update CHANGELOG.md
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
* otel/attr -> otel/attribute
* Missed the changelog entry
* Get rid of import renaming
* Merge remaining conflicts
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com >
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com >
2021-02-18 12:59:37 -05:00