semconv: convert process metrics to Observable instrument types#8235
Open
abhay1999 wants to merge 1 commit into
Open
semconv: convert process metrics to Observable instrument types#8235abhay1999 wants to merge 1 commit into
abhay1999 wants to merge 1 commit into
Conversation
Collaborator
|
Semconv is a stable artifact. We can't regenerate existing versions that have already been released. You can make the change to the template, and paste what it would do to the latest version in the description (so we know it works), but we can't update older semconv directories. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8235 +/- ##
=====================================
Coverage 82.6% 82.6%
=====================================
Files 310 310
Lines 24647 24647
=====================================
+ Hits 20370 20375 +5
+ Misses 3897 3893 -4
+ Partials 380 379 -1 🚀 New features to boost your workflow:
|
Process-level metrics like memory usage, thread count, CPU utilization, and disk I/O are naturally collected via OS callbacks rather than inline Add/Record calls. Using Observable instrument types (Int64ObservableCounter, Int64ObservableGauge, Int64ObservableUpDownCounter, Float64ObservableGauge) aligns the generated wrappers with this access pattern and matches how process.cpu.time was already defined. Updated semconv/v1.37.0 through semconv/v1.40.0 and the Weaver template (weaver.yaml) so future semconv generations inherit the same mapping. Older versions (v1.32.0–v1.36.0) use a different generator pattern and will need regeneration via `make semconv-generate TAG=<version>`. Fixes open-telemetry#7342
4b0f509 to
21546d6
Compare
Author
|
Thanks for the clarification! Makes sense — I've updated the PR to only touch the template (weaver.yaml) and the latest unreleased v1.40.0 output. Dropped all the changes to the released versions. |
Member
|
1.40.0 has already been released. https://pkg.go.dev/go.opentelemetry.io/otel@v1.43.0/semconv/v1.40.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7342
Background
Process-level metrics (memory usage, thread count, disk I/O, etc.) are
naturally read from the OS via callbacks rather than incremented inline
at a call site. Using synchronous instrument types (
Int64Counter,Int64UpDownCounter,Int64Gauge) for these makes it awkward for userswho want to register them with
meter.RegisterCallback.process.cpu.timewas already usingFloat64ObservableCounteras themodel — this change brings the rest of the process metrics in line.
Changes
Template (
semconv/templates/registry/go/weaver.yaml):Added instrument overrides for all process metrics so future
semconv-generateruns automatically produce Observable variants.Latest generated output (
semconv/v1.40.0/processconv/metric.go):Converted the following instruments to their Observable counterparts:
process.context_switchesInt64CounterInt64ObservableCounterprocess.cpu.utilizationInt64GaugeInt64ObservableGaugeprocess.disk.ioInt64CounterInt64ObservableCounterprocess.memory.usageInt64UpDownCounterInt64ObservableUpDownCounterprocess.memory.virtualInt64UpDownCounterInt64ObservableUpDownCounterprocess.network.ioInt64CounterInt64ObservableCounterprocess.paging.faultsInt64CounterInt64ObservableCounterprocess.thread.countInt64UpDownCounterInt64ObservableUpDownCounterprocess.unix.file_descriptor.countInt64UpDownCounterInt64ObservableUpDownCounterprocess.uptimeFloat64GaugeFloat64ObservableGaugeprocess.windows.handle.countInt64UpDownCounterInt64ObservableUpDownCounterThe
Add/AddSet/Record/RecordSetconvenience methods are removedfrom these types since Observable instruments use registered callbacks
instead of synchronous recording. The
"context"and"sync"importsand the
addOptPool/recOptPoolvariables are also removed as they areno longer needed.
Testing
Updated package compiles cleanly: