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

145 Commits

Author SHA1 Message Date
Ayush de8158f87a fix(semconv): share metric option pools (#8371)
Share the AddOption and RecordOption pools used by generated semconv
metric helpers through a small internal package, instead of emitting one
pair of pools in every generated metric package.

Regenerate semconv/v1.41.0 from the updated templates.

Fixes #8356

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2026-05-29 12:17:09 +02:00
David Ashpole 30fbc996a7 Fix semconv generation to include Attr helpers for required attributes on observable instruments (#8361)
The semconv generator only emitted Attr* helpers for not_required
attributes. For synchronous metrics, required attributes become
positional parameters on Record/Add methods. But observable instruments
don't get a generated observe wrapper, so there was no way to easily
pass the required attributes in callbacks.

Fixes #8357
2026-05-22 07:28:13 +02:00
Robert Pająk 4e7ae497e4 fix(semconv): clear pooled slices to enable GC (#8352)
Fixes #8320 

Credits to ash2k
2026-05-21 08:00:44 +02:00
David Ashpole 597532c4d4 Add observable instrument variants to semconv v1.41.0 (#8350)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/7342

Generates both observable and synchronous variants of instruments per
https://github.com/open-telemetry/opentelemetry-go/issues/7342#issuecomment-3292806559
2026-05-21 06:50:33 +02:00
Saharsh Tibrewala f12c29f68a Generating histogram boundaries from weaver.yaml (#8015)
Adding support for histogram boundaries to be generated from weaver 

fixes #8002

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2026-05-20 14:42:55 -04:00
Tyler Yahn 442cdbdd94 Generate and upgrade to semconv/v1.41.0 (#8324)
Fix https://github.com/open-telemetry/opentelemetry-go/issues/8299

Relevant upstream v1.41.0 release notes:

> ### 🛑 Breaking changes 🛑
> 
> - `graphql`: Change `graphql.document` attribute requirement level
from Recommended to Opt-In due to sensitive data, cardinality, and size
concerns
([#2985](https://github.com/open-telemetry/semantic-conventions/issues/2985))
> - `process`: Move process.executable to its own entity.
([#3535](https://github.com/open-telemetry/semantic-conventions/issues/3535))
> - `process`: Update requirement levels for process attributes to
ensure consistent identification and description across platforms.
([#864](https://github.com/open-telemetry/semantic-conventions/issues/864))
> - `rpc`: Remove `client.address` and `client.port` attributes from RPC
server spans.
([#3487](https://github.com/open-telemetry/semantic-conventions/issues/3487),
[#3488](https://github.com/open-telemetry/semantic-conventions/issues/3488))
> 
> ### 💡 Enhancements 💡
> 
> - `Go`: Add opt-in go.memory.gc.pause.duration histogram metric.
([#3353](https://github.com/open-telemetry/semantic-conventions/issues/3353))
> - `deployment`: Stabilize `deployment.environment.name` attribute.
([#3339](https://github.com/open-telemetry/semantic-conventions/issues/3339))
> - `deployment`: Add enum values for `deployment.environment.name`
attribute.
([#2910](https://github.com/open-telemetry/semantic-conventions/issues/2910))
> - `go`: Add the go.cpu.time opt-in metric, and add
go.cpu.detailed_state and go.memory.detailed_type attributes to CPU and
memory metrics respectively with wildcard values.
([#3354](https://github.com/open-telemetry/semantic-conventions/issues/3354))
> - `go`: Add the opt-in go.memory.gc.cycles metric.
([#3353](https://github.com/open-telemetry/semantic-conventions/issues/3353))
> - `telemetry`: Promote `telemetry.distro.name` and
`telemetry.distro.version` attributes to 'stable'.
([#3650](https://github.com/open-telemetry/semantic-conventions/issues/3650))

This PR also:
- fixes semconv migration generation to ignore unexported declarations
when computing renames/removals
- upgrades repo imports, depguard, docs, templates, and schema URL
expectations to `go.opentelemetry.io/otel/semconv/v1.41.0`
- adds missing generated-file headers to semconvkit templates and
regenerates the affected `v1.41.0` files via `TAG="v1.41.0" make
semconv-generate`

---------

Co-authored-by: David Ashpole <dashpole@google.com>
2026-05-14 14:06:05 -04:00
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
Robert Pająk 1519eb8c33 attribute: Set.MarshalLog to use Value.String instead of Value.Emit (#8169)
Towards https://github.com/open-telemetry/opentelemetry-go/issues/8145
2026-04-10 15:11:31 +02:00
Robert Pająk 3b18b21580 unwrap error chains created with fmt.Errorf (#8133)
Fixes https://github.com/open-telemetry/opentelemetry-go/issues/7975

Per
https://github.com/open-telemetry/opentelemetry-go/issues/7975#issuecomment-4183251694

Per https://github.com/open-telemetry/semantic-conventions/issues/3588

Credits:
- Balaji01-4D for
https://github.com/open-telemetry/opentelemetry-go/pull/8018
- seh for providing valuable feedback
2026-04-07 20:03:30 +02:00
Matthieu MOREL e9449e3b34 chore: fix noctx issues (#8008)
***Description***

Fixes
[noctx](https://golangci-lint.run/docs/linters/configuration/#noctx)
issues and enables the linter

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2026-03-23 14:28:38 +01:00
Tyler Yahn a7624f50f7 Fix semconv generated error type to check error chain for custom type declaration (#7994)
Fix `ErrorType` detection to work through wrapped error chains.

`errorType` previously only checked whether the top-level error value
implemented `ErrorType() string`. In common Go usage, errors are often
wrapped, so this could miss `ErrorType` implementations behind wrappers.
2026-03-04 15:57:57 +01: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 e2305d228b Regenerate semconv/v1.40.0/MIGRATION.md (#7992)
It is not clear how the original was generated, but this is generated
with the tooling from `main`.
2026-03-04 13:50:11 +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
Oleksandr Redko 3264bf171b refactor: modernize code (#7850)
Enable the
[`modernize`](https://golangci-lint.run/docs/linters/configuration/#modernize)
linter in the golangci-lint configuration and fix the reported issues by
running `golangci-lint run --enable-only modernize --fix`. The
`modernize` linter is internally the same as [gopls
modernize](https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/modernize).

Similar to #7089.
2026-01-30 18:15:17 +01:00
Christos Markou f809f7d71e Generate semconv/v1.39.0 (#7783)
Towards https://github.com/open-telemetry/opentelemetry-go/issues/7784

Similar to https://github.com/open-telemetry/opentelemetry-go/pull/7648
for semconv/v1.39.0:
https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.39.0

---------

Signed-off-by: ChrsMark <chrismarkou92@gmail.com>
Co-authored-by: Damien Mathieu <42@dmathieu.com>
2026-01-15 14:43:11 +01:00
Tyler Yahn 1bc9713ac6 Regenerate ErrorType documentation in semconv/v1.37.0 (#7667)
The template was updated in #7442 but the code was not regenerated.

Also, fix the comment to not include the unneeded newline that is
failing lint checks.
2025-12-05 09:49:26 -08:00
Tyler Yahn 5a692cf680 Fix whitespace in semconv/v1.33.0 (#7665)
- Replace spaces with tabs
- Include a newline at the end of the file
2025-12-05 09:19:40 -08:00
Tyler Yahn 4eff89b333 Fix whitespace in semconv/v1.32.0 (#7666)
Replace spaces with tabs
Include a newline at the end of the file
2025-12-05 09:12:13 -08:00
Tyler Yahn d1825df1c4 Fix whitespace in semconv/v1.36.0 (#7663)
- Replace spaces with tabs
- Include a newline at the end of the file
2025-12-05 09:01:51 -08:00
Tyler Yahn ddc307d229 Fix package name documentation and missing copyright in semconv/v1.32.0 (#7659)
Identified in the review of #7648
2025-12-05 08:53:05 -08:00
Tyler Yahn 3e85447b6f Fix whitespace in semconv/v1.34.0 (#7664)
- Replace spaces with tabs
- Include a newline at the end of the file
2025-12-05 08:44:58 -08:00
Tyler Yahn a64b9ec518 Fix package documentation name and return error in semconv/v1.36.0 (#7656)
Identified in the review of #7648
2025-12-05 08:18:09 -08:00
Tyler Yahn be85ff8704 Fix whitespace in semconv/v1.37.0 (#7660)
- Replace spaces with tabs
- Include a newline at the end of the file
2025-12-05 08:10:13 -08:00
Tyler Yahn cddeb68814 Fix package name documentation and missing copyright in semconv/v1.34.0 (#7657)
Identified in the review of
https://github.com/open-telemetry/opentelemetry-go/pull/7648
2025-12-05 08:00:46 -08:00
Tyler Yahn 365964822b Fix package name documentation and missing copyright in semconv/v1.33.0 (#7658)
Identified in the review of #7648
2025-12-05 07:53:07 -08:00
Tyler Yahn e69beb88b5 Fix package documentation name and return err in semconv/v1.37.0 (#7655)
Identified in the review of #7648
2025-12-05 07:38:48 -08:00
Tyler Yahn 6af2f2ff67 Generate semconv/v1.38.0 (#7648)
Resolve #7647
2025-12-03 19:55:44 -08:00
Tyler Yahn c4bdd87543 Support custom error type semantics (#7442)
Allow instrumentation to provide domain-specific error type values (i.e.
HTTP or gRPC status codes) for the "error.type" semantic attribute. This
is accomplished by passing an error value that implements the
`interface{ ErrorType string }` interface.

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2025-10-03 15:39:35 -07:00
Tyler Yahn 3baabce4c6 Do not allocate instrument options if possible in generated semconv packages (#7328)
Avoid allocating instrument creation option if possible. If a user does
not provide any options, use a static, read-only, file-level defined
option slice. Otherwise, append to the user allocated slice the
description and unit options.
2025-09-09 12:21:48 -07:00
renovate[bot] 83c041a6cd chore(deps): update module mvdan.cc/gofumpt to v0.9.0 (#7292)
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` |
[![age](https://developer.mend.io/api/mc/badges/age/go/mvdan.cc%2fgofumpt/v0.9.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/mvdan.cc%2fgofumpt/v0.8.0/v0.9.0?slim=true)](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>
2025-09-03 10:18:12 +02:00
Tyler Yahn 3342341f15 Generate the semconv/v1.37.0 packages (#7254)
Resolve #7252
2025-08-27 13:24:07 +02:00
Tyler Yahn 0b47699705 Add AddSet and RecordSet methods to semconv generated packages (#7223)
The current design of the packages is for ergonomics, and it works well
at this. However, it is not the most performant. When a user passes a
slice of attributes it will use
[`metric.WithAttributes`](https://github.com/open-telemetry/opentelemetry-go/blob/cf787f3e3ad0093985b0834eaf63ceb679705545/metric/instrument.go#L372-L376):

```go
func WithAttributes(attributes ...attribute.KeyValue) MeasurementOption {
	cp := make([]attribute.KeyValue, len(attributes))
	copy(cp, attributes)
	return attrOpt{set: attribute.NewSet(cp...)}
}
```

This will copy the passed attributes and then pass that copy to
`attribute.NewSet` which adds its own allocation.

If a user is performance conscious and already have a set, allow them to
pass it directly and reduce the required allocations for the measurement
call.

## Alternatives Considered

### Why not allow users to just use `Inst()` method?

With the current design a user can still just call:

```go
counter.Inst().Add(ctx, val, metric.WithAttributeSet(set))
```

However, the option slice (in this case `[]metric.AddOption`) is
allocated on the call. Meaning a user will also need to recreate the
pooling that our semconv generated packages already handle.

Providing the `*Set` methods is convenient, but it also helps the
application performance as one larger pool will be less strain on the GC
than many smaller ones.

### Why not just call `WithAttributeSet` in the existing methods?

Instead of appending a `WithAttributes` option internal to all the
measurement methods, we could also just create a `Set` and pass that
with `WithAttributeSet`. This will avoid the additional slice copy that
`WithAttributes` does on top of calling `attribute.NewSet`.

However, this copy that `WithAttributes` does is important as calling
`attribute.NewSet` will sort the original slice. Bypassing that will
mean all the passed attribute slices will be modified when used.

This is not great as it is likely going to be unexpected behavior by the
user, and is the reason we copy the slice in `WithAttributes` in the
first place.

### Why not just copy user attributes to an amortized slice pool to
create a new `attribute.Set`?

The additional creation of an `[]attribute.KeyValue` that user
attributes are copied to in order to prevent modification can be
amortized with a pool. For example, #7249. There shouldn't be any
difference than between calling a `*Set` method introduced here vs the
non-`Set` method.

This is true, and motivates this type of change. However, also providing
these additional methods allows the user additional performance gains if
the set is used for more than one measurement. For example:

```go
set := attributes.NewSet(attrs)
counter1.AddSet(ctx, 1, set)
counter2.AddSet(ctx, 2, set)  // No additional set is created here.
```

Without these methods:

```go
counter1.Add(ctx, 1, attrs...) // A set is created for attrs
counter2.Add(ctx, 2, attrs...) // Another set is created for attrs
```

Each `attribute.Set` created will require an allocation (i.e. the
internal `any` field needs to be allocated to the heap). Meaning without
these methods a user will still not be able to write the most performant
code.

The attribute pool approach has merit, and should be pursued. However,
it does not invalidate the value of these changes.
2025-08-26 09:20:45 -07:00
Tyler Yahn 45bb4ba720 Add copyright header to generated semconv packages (#7248) 2025-08-26 08:20:56 +02:00
Tyler Yahn ebd324842f Return early in semconv generated packages if no attributes passed (#7222)
- Reduces unnecessary allocations for empty attribute
- Fixes case where we were double recording for `Record` methods
2025-08-25 16:20:11 +02:00
Tyler Yahn e7fa5ba72f Fix CPUModeSystem variable name (#7233)
Do not trim a package prefix when it is the same as the package name.
Assume the name itself has semantic meaning and will not stutter.

Fix #7232
2025-08-25 16:06:50 +02:00
Tyler Yahn be28c6bc8f Wrap Float64ObservableCounter with system.CPUTime (#7235)
Fix #7234 

Addresses revert of [`cpu` to `system`
namespace](https://github.com/open-telemetry/semantic-conventions/pull/1896)
in semantic conventions.
2025-08-25 15:51:01 +02:00
Tyler Yahn 3cf53ccf5d Upgrade semconv gen to weaver v0.17.0 (#7172)
- Remove temporary fix to filter out deprecated metrics (addressed in
https://github.com/open-telemetry/weaver/pull/870)
- Handle empty briefs gracefully
- Handle empty attributes gracefully
- Regenerate v1.36.0 semconv to fix docs

[Weaver v0.17.0
release](https://github.com/open-telemetry/weaver/releases/tag/v0.17.0)

Follow up to #7163

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2025-08-12 08:59:23 +02:00
Matthieu MOREL 68841fa6db chore: enable unused-receiver rule from revive (#7130)
#### Description

Enable and fixes
[unused-receiver](https://github.com/mgechev/revive/blob/HEAD/RULES_DESCRIPTIONS.md#unused-receiver)
rule from revive

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-08-08 15:38:22 -07:00
Matthieu MOREL 1bae8f7347 chore: enable extra-rules from gofumpt (#7114)
#### Description

Enable extra rules from
[gofumpt](https://golangci-lint.run/usage/formatters/#gofumpt) that also
fixes paramTypeCombine from go-critic

Also defines `go.opentelemetry.io/otel` as in
https://github.com/open-telemetry/opentelemetry-go-contrib/pull/7637

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-08-03 08:24:33 -07:00
Matthieu MOREL 982391315f chore: enable gocritic linter (#7095)
#### Description

Enable and fixes several rules from
[gocritic](https://golangci-lint.run/usage/linters/#gocritic) linter

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-07-29 09:20:32 -07: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
David Ashpole 6d9dfea837 Change generated semconv sdk queue metrics to observable (#7041)
And regenerate v1.36.0 semconv using `TAG=v1.36.0 make semconv-generate`

Fixes https://github.com/open-telemetry/opentelemetry-go/issues/7029
2025-07-17 18:20:51 +02:00
Tyler Yahn 5e212ba8c6 Generate semconv/v1.36.0 (#7032)
Resolve #7030 

This generation fixes the following:

- The `semconv/weaver.yaml` file is moved to the
`semconv/templates/registry/go` to [fix the
generation](https://github.com/open-telemetry/opentelemetry-go/issues/7030#issuecomment-3074916061).
- Deprecated enum `var`s are no longer generate.
- The deprecation of the previous `OSTypeZOS` (`z_os`) conflicts with
the replacement (`zos`).
- This matches all other generations where deprecated types are not
generated and the migration docs identify users need to upgrade when
upgrading packages.
- Fix metric description rendering to handle multi-line metric
descriptions.
- Fix filter of deprecated metrics in weaver configuration (see
https://github.com/open-telemetry/weaver/issues/847).

The release notes for v1.35.0 are included as we do not plan to add a
package for that release and it includes breaking changes being released
here (i.e. `az.namespace` and `az.service_request_id`)

## [`v1.36.0` semantic convention release
notes](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.36.0)

<div data-pjax="true" data-test-selector="body-content"
data-view-component="true" class="markdown-body my-3"><h3>🚩 Deprecations
🚩</h3>
<ul>
<li><code>os</code>: Adds the 'deprecated:' tag/attribute to the
<code>z_os</code> enum value of <code>os.type</code>. This value was
recently deprecated in v1.35.0. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2479"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2479/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2479</a>)</li>
</ul>
<h3>💡 Enhancements 💡</h3>
<ul>
<li><code>otel</code>: Replaces <code>otel.sdk.span.ended</code> with
<code>otel.sdk.span.started</code> and allow differentiation based on
the parent span origin (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2431"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2431/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2431</a>)</li>
<li><code>db</code>: Add database context propagation via <code>SET
CONTEXT_INFO</code> for SQL Server (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2162"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2162/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2162</a>)</li>
<li><code>entities</code>: Adds support for Entity registry and Entity
stabilization policies. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2246"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2246/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2246</a>)</li>
</ul>
<h3>🧰 Bug fixes 🧰</h3>
<ul>
<li><code>cloud</code>: Exclude deprecated Azure members from code
generation on the <code>cloud.platform</code> attribute (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2477"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2477/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2477</a>, <a
href="https://github.com/open-telemetry/semantic-conventions/issues/2455"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2455/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2455</a>)</li>
</ul>

## [`v1.35.0` semantic convention release
notes](https://github.com/open-telemetry/semantic-conventions/releases/tag/v1.35.0)

<div data-pjax="true" data-test-selector="body-content"
data-view-component="true" class="markdown-body my-3"><h3>🛑 Breaking
changes 🛑</h3>
<ul>
<li>
<p><code>azure</code>: Align azure events, attributes, and enum members
with general naming guidelines. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/608"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/608/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#608</a>, <a
href="https://github.com/open-telemetry/semantic-conventions/issues/1708"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/1708/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1708</a>, <a
href="https://github.com/open-telemetry/semantic-conventions/issues/1698"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/1698/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1698</a>)</p>
<ul>
<li>Renamed attributes:
<ul>
<li><code>az.service_request_id</code> to
<code>azure.service.request.id</code></li>
<li><code>az.namespace</code> to
<code>azure.resource_provider.namespace</code></li>
</ul>
</li>
<li>Renamed events:
<ul>
<li><code>az.resource.log</code> to <code>azure.resource.log</code></li>
</ul>
</li>
<li>Renamed enum members:
<ul>
<li><code>az.ai.inference</code> to <code>azure.ai.inference</code> (on
<code>gen_ai.system</code>)</li>
<li><code>az.ai.openai</code> to <code>azure.ai.openai</code> (on
<code>gen_ai.system</code>)</li>
<li><code>azure_aks</code> to <code>azure.aks</code> (on
<code>cloud.platform</code>)</li>
<li><code>azure_app_service</code> to <code>azure.app_service</code> (on
<code>cloud.platform</code>)</li>
<li><code>azure_container_apps</code> to
<code>azure.container_apps</code> (on <code>cloud.platform</code>)</li>
<li><code>azure_container_instances</code> to
<code>azure.container_instances</code> (on
<code>cloud.platform</code>)</li>
<li><code>azure_functions</code> to <code>azure.functions</code> (on
<code>cloud.platform</code>)</li>
<li><code>azure_openshift</code> to <code>azure.open_shift</code> (on
<code>cloud.platform</code>)</li>
<li><code>azure_vm</code> to <code>azure.vm</code> (on
<code>cloud.platform</code>)</li>
</ul>
</li>
</ul>
</li>
<li>
<p><code>system</code>: Revert the change that moved
<code>system.cpu.*</code> to <code>cpu.*</code>. The 3 affected metrics
are back in <code>system.cpu.*</code>. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1873"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1873/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1873</a>)</p>
</li>
<li>
<p><code>system</code>: Changes system.network.connections to
system.network.connection.count (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1800"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1800/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1800</a>)</p>
</li>
<li>
<p><code>k8s</code>: Change instrument type for .limit/.request
container metrics from gauge to updowncounter (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2354"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2354/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2354</a>)</p>
</li>
</ul>
<h3>🚩 Deprecations 🚩</h3>
<ul>
<li><code>os</code>: Deprecate os.type='z_os' and replace with
os.type='zos' (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1687"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1687/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1687</a>)</li>
</ul>
<h3>🚀 New components 🚀</h3>
<ul>
<li><code>mainframe, zos</code>: Add initial semantic conventions for
mainframes (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1687"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1687/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1687</a>)</li>
</ul>
<h3>💡 Enhancements 💡</h3>
<ul>
<li>
<p><code>dotnet</code>: Define .NET-specific network spans for DNS
resolution, TLS handshake, and socket connections, along with HTTP-level
spans to (optionally) record relationships between HTTP requests and
connections.<br>
(<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1192"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/1192/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1192</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add <code>k8s.node.allocatable.cpu</code>,
<code>k8s.node.allocatable.ephemeral_storage</code>,
<code>k8s.node.allocatable.memory</code>,
<code>k8s.node.allocatable.pods</code> metrics (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2243"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2243/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2243</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add k8s.container.restart.count metric (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2191"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2191/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2191</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add K8s container resource related metrics (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2074"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2074/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2074</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add k8s.container.ready metric (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2074"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2074/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2074</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add k8s.node.condition metric (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2077"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2077/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2077</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add k8s resource quota metrics (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2076"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2076/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2076</a>)</p>
</li>
<li>
<p><code>events</code>: Update general event guidance to allow complex
attributes on events and use them instead of the body fields.<br>
(<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1651"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1651/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1651</a>, <a
href="https://github.com/open-telemetry/semantic-conventions/issues/1669"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1669/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1669</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add k8s.container.status.state and
k8s.container.status.reason metrics (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/1672"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/1672/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#1672</a>)</p>
</li>
<li>
<p><code>feature_flags</code>: Mark feature flag semantic convention as
release candidate. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2277"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2277/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2277</a>)</p>
</li>
<li>
<p><code>k8s</code>: Add new resource attributes for
<code>k8s.hpa</code> to capture the <code>scaleTargetRef</code> fields
(<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2008"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2008/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2008</a>)<br>
Adds below attributes to the <code>k8s.hpa</code> resource:</p>
<ul>
<li><code>k8s.hpa.scaletargetref.kind</code></li>
<li><code>k8s.hpa.scaletargetref.name</code></li>
<li><code>k8s.hpa.scaletargetref.api_version</code></li>
</ul>
</li>
<li>
<p><code>k8s</code>: Adds metrics and attributes to track k8s HPA's
metric target values for CPU resources. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2182"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2182/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2182</a>)<br>
Below metrics are introduced to provide insight into HPA scaling
configuration for CPU.</p>
<ul>
<li><code>k8s.hpa.metric.target.cpu.value</code></li>
<li><code>k8s.hpa.metric.target.cpu.average_value</code></li>
<li><code>k8s.hpa.metric.target.cpu.average_utilization</code></li>
</ul>
</li>
<li>
<p><code>k8s</code>: Explains the rationale behind the Kubernetes
resource naming convention. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2245"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2245/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2245</a>)</p>
</li>
<li>
<p><code>all</code>: Adds modelling guide for resource and entity. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2246"
data-hovercard-type="issue"
data-hovercard-url="/open-telemetry/semantic-conventions/issues/2246/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2246</a>)</p>
</li>
<li>
<p><code>service</code>: Adds stability policies for Entity groups. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2378"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2378/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2378</a>)<br>
Entity groups now require <code>role</code> to be filled for
attributes.</p>
</li>
<li>
<p><code>otel</code>: Specifies component.type values for Zipkin and
Prometheus exporters (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2229"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2229/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2229</a>)</p>
</li>
</ul>
<h3>🧰 Bug fixes 🧰</h3>
<ul>
<li><code>otel</code>: Removes <code>otel.scope</code> entity. (<a
href="https://github.com/open-telemetry/semantic-conventions/issues/2310"
data-hovercard-type="pull_request"
data-hovercard-url="/open-telemetry/semantic-conventions/pull/2310/hovercard"
aria-keyshortcuts="Alt+ArrowUp">#2310</a>)</li>
</ul>
2025-07-16 13:33:34 -07:00
Matouš Dzivjak c4b8e9124e chore(semconv): follow weaver folder structure (#6998)
(this PR is a suggestion, feel free to close if it doesn't align with
the vision for this repo)

Moves jinja templates for semantic conventions from the root of
`semconv/` into `semconv/templates/registry/go/`, making them easier to
consume. While this wasn't impeding development in `opentelemetry-go` it
makes it easier to consume the templates from other packages via:

```bash
weaver registry generate --templates https://github.com/open-telemetry/opentelemetry-go.git[semconv/templates] go .
```

which was previously impossible. Specific use-case would be using
[weaver](https://github.com/open-telemetry/weaver) to maintain private
registry of semantic conventions for companies/projects in which case
it's more convenient to be able to rely on the upstream opentelemetry-go
templates as opposed to having to copy them over.

Tested by running:

```bash
TAG='v1.34.0' make semconv-generate
```

which results into empty diff.

## Open questions

Does the changelog deserve an entry for this even without changes to the
API?

Co-authored-by: Robert Pająk <pellared@hotmail.com>
2025-07-14 07:24:33 -07:00
Bəxtiyar 687c3f5fb5 semconv: add ErrorType attribute function (#6962)
Closes #6904 

This PR adds a helper method to semconv package to set ErrorType
attribute easily.

---------

Co-authored-by: Damien Mathieu <42@dmathieu.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
2025-07-10 09:45:44 +02:00