1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2026-06-03 18:35:08 +02:00

7 Commits

Author SHA1 Message Date
renovate[bot] cf2a4a180f chore(deps): update module mvdan.cc/gofumpt to v0.10.0 (#8304)
This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [mvdan.cc/gofumpt](https://redirect.github.com/mvdan/gofumpt) |
`v0.9.2` → `v0.10.0` |
![age](https://developer.mend.io/api/mc/badges/age/go/mvdan.cc%2fgofumpt/v0.10.0?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/go/mvdan.cc%2fgofumpt/v0.9.2/v0.10.0?slim=true)
|

---

### Release Notes

<details>
<summary>mvdan/gofumpt (mvdan.cc/gofumpt)</summary>

###
[`v0.10.0`](https://redirect.github.com/mvdan/gofumpt/blob/HEAD/CHANGELOG.md#v0100---2026-05-04)

[Compare
Source](https://redirect.github.com/mvdan/gofumpt/compare/v0.9.2...v0.10.0)

This release is based on Go 1.26's gofmt, and requires Go 1.25 or later.

A new rule is introduced to drop unnecessary parentheses around
expressions
where the inner expression is unambiguous on its own, such as `f((3))`.
Parentheses are kept where they are useful, such as on binary
expressions. See
[#&#8203;44](https://redirect.github.com/mvdan/gofumpt/issues/44).

A new rule is introduced to require multi-line function calls to match
the opening and closing parenthesis in terms of the use of newlines. See
[#&#8203;74](https://redirect.github.com/mvdan/gofumpt/issues/74).

The `-extra` flag now accepts a comma-separated list of rule names to
enable
individual extra rules, rather than enabling all of them at once. See
[#&#8203;339](https://redirect.github.com/mvdan/gofumpt/issues/339).

The following changes are included as well:

- Avoid crashing on `go.mod` files without a `module` directive -
[#&#8203;350](https://redirect.github.com/mvdan/gofumpt/issues/350)
- Avoid failing when an ignored directory cannot be read -
[#&#8203;351](https://redirect.github.com/mvdan/gofumpt/issues/351)
- Avoid prefixing more kinds of commented-out Go code with spaces -
[#&#8203;230](https://redirect.github.com/mvdan/gofumpt/issues/230)
- Avoid prefixing a shebang comment with a space -
[#&#8203;237](https://redirect.github.com/mvdan/gofumpt/issues/237)
- Narrow the newlines on assignments rule to ignore complex cases -
[#&#8203;354](https://redirect.github.com/mvdan/gofumpt/issues/354)
- Fix three bugs which caused a second gofumpt run to make changes -
[#&#8203;132](https://redirect.github.com/mvdan/gofumpt/issues/132),
[#&#8203;345](https://redirect.github.com/mvdan/gofumpt/issues/345)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- 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:eyJjcmVhdGVkSW5WZXIiOiI0My4xNTkuMiIsInVwZGF0ZWRJblZlciI6IjQzLjE1OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJTa2lwIENoYW5nZWxvZyIsImRlcGVuZGVuY2llcyJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tyler Yahn <codingalias@gmail.com>
2026-05-08 12:50:12 -07:00
David Ashpole fe35606998 Update semconv template and 1.40.0 to use Enabled for metrics (#8172)
Part of https://github.com/open-telemetry/opentelemetry-go/issues/7800

This adds Enabled checks to the generated semconv metric instruments. I
also opted to regenerate the 1.40.0 conventions given this is not a
behavioral change.

While implementing it, I did get the sense that this _should_ be
redundant. Callers should be checking Enabled before making these calls
because they should avoid building attribute sets. But it does still
make sense to have this as a fallback for cases where callers haven't
done that.

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2026-04-13 09:31:43 -04:00
Tyler Yahn b2b3250897 Semconv metric helper caller-slice mutation fix (#7993)
This PR addresses issue #7987 (issue (1)): generated semconv metric
helpers should not risk mutating caller-provided `attrs` backing arrays
when required attributes are appended.

Update the generator logic to merge required-attribute using capacity
clamping before append:

```
append(attrs[:len(attrs):len(attrs)], requiredAttrs...)
```

This guarantees append allocates a new backing array for the merged
slice instead of writing into caller memory when there are attributes
appended. It makes not allocations in the case attributes are not
appended.
2026-03-04 15:49:49 +01:00
Victor edba765831 fix: generated semconv helpers skipping attributes (#7964)
This is related to issue #7938.

### The Bug

Semconv code generator Jinja2 template (instrument.j2) had an early
return optimization that skipped required attributes when no extra
optional attributes were passed.

The root cause seemed to be two macros in
semconv/templates/registry/go/instrument.j2:
  - add_method_with_optional (for counters/updowncounters)
  - record_method_with_optional (for histograms/gauges)

Both had `if len(attrs) == 0 { m.Inst.Add(ctx, incr); return }`, which
bypassed required attributes entirely.

### The Fix
I added a conditional check to verify when required attributes exist
`(req_attr | length > 0)`, the early return now passes them via
metric.WithAttributes(...). When there are no required attributes, the
original fast path is preserved.

I also regenerated the semconv `v1.39.0`, but if thats not desired due
to existing clients, let me know. It is my first time contributing here
and any feedback is appreciated!

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2026-03-04 14:20:36 +01:00
Tyler Yahn 5dee2eb2dc Revert "Revert "Generate semconv/v1.40.0"" (#7985)
Reverts open-telemetry/opentelemetry-go#7978
2026-03-03 07:32:17 +01:00
Damien Mathieu 0d50f9008c Revert "Generate semconv/v1.40.0" (#7978)
Reverts open-telemetry/opentelemetry-go#7929
2026-03-02 11:06:31 +01:00
Christos Markou c38a4a57c3 Generate semconv/v1.40.0 (#7929)
Similar to https://github.com/open-telemetry/opentelemetry-go/pull/7783
for semconv/v1.40.0:
https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.40.0

---------

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
2026-03-02 10:54:57 +01:00