This PR contains the following updates:
| Package | Change | Age | Confidence |
|---|---|---|---|
| [mvdan.cc/gofumpt](https://redirect.github.com/mvdan/gofumpt) |
`v0.8.0` -> `v0.9.0` |
[](https://docs.renovatebot.com/merge-confidence/)
|
[](https://docs.renovatebot.com/merge-confidence/)
|
---
> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.
---
### Release Notes
<details>
<summary>mvdan/gofumpt (mvdan.cc/gofumpt)</summary>
###
[`v0.9.0`](https://redirect.github.com/mvdan/gofumpt/blob/HEAD/CHANGELOG.md#v090---2025-09-02)
[Compare
Source](https://redirect.github.com/mvdan/gofumpt/compare/v0.8.0...v0.9.0)
This release is based on Go 1.25's gofmt, and requires Go 1.24 or later.
A new rule is introduced to "clothe" naked returns for the sake of
clarity.
While there is nothing wrong with naming results in function signatures,
using lone `return` statements can be confusing to the reader.
Go 1.25's `ignore` directives in `go.mod` files are now obeyed;
any directories within the module matching any of the patterns
are now omitted when walking directories, such as with `gofumpt -w .`.
Module information is now loaded via Go's [`x/mod/modfile`
package](https://pkg.go.dev/golang.org/x/mod/modfile)
rather than executing `go mod edit -json`, which is way faster.
This should result in moderate speed-ups when formatting many
directories.
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/open-telemetry/opentelemetry-go).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45MS4xIiwidXBkYXRlZEluVmVyIjoiNDEuOTEuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiU2tpcCBDaGFuZ2Vsb2ciLCJkZXBlbmRlbmNpZXMiXX0=-->
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: dmathieu <damien.mathieu@elastic.co>
I am looking into I am looking into
https://promlabs.com/blog/2025/07/17/why-i-recommend-native-prometheus-instrumentation-over-opentelemetry/#comparing-counter-increment-performance,
and was trying to figure out why incrementing a counter with 10
attributes was so much slower than incrementing a counter with no
attributes, or 1 attribute:
```
$ go test -run=xxxxxMatchNothingxxxxx -cpu=1 -test.benchtime=1s -bench=BenchmarkSyncMeasure/NoView/Int64Counter/Attributes
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/sdk/metric
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
BenchmarkSyncMeasure/NoView/Int64Counter/Attributes/0 9905773 121.3 ns/op
BenchmarkSyncMeasure/NoView/Int64Counter/Attributes/1 4079145 296.5 ns/op
BenchmarkSyncMeasure/NoView/Int64Counter/Attributes/10 781627 1531 ns/op
```
Looking at the profile, most of the time is spent in
"runtime.mapKeyError2" within "runtime.mapaccess2". My best guess is
that whatever we are using for Equivalent() is not very performant when
used as a map key. This seems like a good opportunity to greatly improve
the performance of our metrics (and probably other signals) API + SDK.
To start, i'm adding a simple benchmark within the attribute package to
isolate the issue. Results:
```
$ go test -run '^$' -bench '^BenchmarkEquivalentMapAccess' -benchtime .1s -cpu 1 -benchmem
goos: linux
goarch: amd64
pkg: go.opentelemetry.io/otel/attribute
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
BenchmarkEquivalentMapAccess/Empty 2220508 53.58 ns/op 0 B/op 0 allocs/op
BenchmarkEquivalentMapAccess/1_string_attribute 622770 196.7 ns/op 0 B/op 0 allocs/op
BenchmarkEquivalentMapAccess/10_string_attributes 77462 1558 ns/op 0 B/op 0 allocs/op
BenchmarkEquivalentMapAccess/1_int_attribute 602163 197.7 ns/op 0 B/op 0 allocs/op
BenchmarkEquivalentMapAccess/10_int_attributes 76603 1569 ns/op 0 B/op 0 allocs/op
```
This shows that it is the map lookup and storage itself that is making
the metrics API+SDK perform much worse with more attributes.
Some optimization ideas include:
* Most attribute sets are likely to be just numbers and strings. Can we
make a fast path for sets that don't include complex attributes?
* We encourage improving performance of the metrics API by re-using
attribute sets where possible. If we can lazily compute+cache a "faster"
map key, that will have a big performance improvement when attribute
sets are re-used.
* compute a uint64 hash using something like
https://github.com/gohugoio/hashstructure, or something similar to what
prometheus/client_golang does:
c79a891c6c/model/signature.go (L31)
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Flc゛ <four_leaf_clover@foxmail.com>
Resolve#6525
## Description
This pull request addresses the issue of moving internal functionality
from the `internal/attribute` package to the `attribute `package within
the open-telemetry/opentelemetry-go repository. The goal is to ensure
that none of this functionality is added to the public API of the
attribute or any other public package while improving the naming,
layout, and following Go idioms.
## Changes made
1. Moved Functions to `attribute/internal`
- Created a new internal package within the `attribute` package:
`attribute/internal`.
- Moved `attribute.go` and `attribute_test.go` into the
`attribute/internal`
- Moved the following functions from `internal/attribute` to
`attribute/internal`
2 . Changes in .golangci.yml
- Removed line 67 and 68 from .golangci.yml
---------
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* 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>
* Optimize Set.Filter for no filtered case
When all elements of the Set are kept during a call to Filter, do not
allocate a new Set and the dropped attributes slice. Instead, return the
immutable Set and nil.
To achieve this the functionality of filterSet is broken down into a
more generic filteredToFront function.
* Apply suggestions from code review
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Rename run to benchFn based on review feedback
---------
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* 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>
* Add allow/deny attr filters
* Revert "Replace `Stream.AttributeFilter` with `AllowAttributeKeys` (#4288)"
This reverts commit 1633c74aea.
* Rename new attr filter funcs
Do not include the term "Attribute" in a creation function of the
"attribute" pkg.
* Update the AttributeFilter field documentation
* Add tests for filter creation funcs
* Add change to changelog
* Apply feedback
* Use NewDenyKeysFilter for allow-all and deny-list filters
* Remove links from field docs
These links do not render.
---------
Co-authored-by: Chester Cheung <cheung.zhy.csu@gmail.com>
* Pool sortables used to create attribute sets
* Move sync pool to attribute pkg
* Add change to changelog
* Fix comment
* Apply suggestions from code review
Co-authored-by: Peter Liu <lpfvip2008@gmail.com>
* Update sdk/metric/instrument.go
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Update comment based on feedback
* Apply feedback
---------
Co-authored-by: Peter Liu <lpfvip2008@gmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Replace use of old term label with attribute
The specification has unified on the term attribute to describe
key-value pairs. There exist still many hold-overs of the use of the
term label. This updates those uses or deprecates exported types and
functions in favor of renamed forms.
* fix infinite recursion
* Remove backticks from attribute set docs
* Remove LabelFilterSelector entirely
* Remove Metadata.Labels instead of deprecate
* Update changelog with public changes
* Revert OC err msg
* Update versions file for 1.0.0 release
* Prepare stable-v1 for version v1.0.0
* Update trace signal status in documentation
* Update changelog
* Update CHANGELOG.md
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
* Fix slice-valued attributes when used as map keys
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* store pointers to slice values to make them usable as map keys
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
* Emit slice-typed attribute values as slices, not pointers to slices
Signed-off-by: Anthony J Mirabella <a9@aneurysm9.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
* Deprecate Array attribute in favor of *Slice types
* Use new attr types in Jaeger exporter
* Use slice attr types in otlpmetric
* Use slice attr types in otlptrace
* Use slice attr types in zipkin exporter
* Remove array attr test from deprectated oteltest func
* Use StringSlice for cmd arg resource attr
* Add changes to the changelog
* Remove use of deprecated Array func
Group benchmarks by type for easier understanding and filtering.
Save output of function calls in benchmarks to file level vars to ensure
the compiler does not optimize away the test.
Unify testing functionality for common benchmark tasks.