Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new metric process.runtime.uptime and deprecate runtime.uptime metric in instrumentation/runtime/runtime.go file #5317

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Added

- Add the new `go.opentelemetry.io/contrib/instrgen` package to provide auto-generated source code instrumentation. (#3068, #3108)
- Add a new metric `process.runtime.uptime` to `go.opentelemetry.io/contrib/runtime` that uses an asynchronous gauge function. (#5317)

### Deprecated

- The `runtime.uptime` metric in `go.opentelemetry.io/contrib/runtime` is deprecated. (#5317)

## [1.26.0/0.51.0/0.20.0/0.6.0/0.1.0] - 2024-04-24

Expand Down
11 changes: 11 additions & 0 deletions instrumentation/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ func (r *runtime) register() error {
uptime, err := r.meter.Int64ObservableCounter(
"runtime.uptime",
metric.WithUnit("ms"),
metric.WithDescription("Milliseconds since application was initialized. Deprecated metric. Use `process.runtime.runtime` instead."),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@open-telemetry/go-approvers what do you all think about this way of deprecating/renaming a metric?
It does mean for one release we emit two metrics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything you would like me to change @dmathieu

)
if err != nil {
return err
}

processUptime, err := r.meter.Int64ObservableGauge(
"process.runtime.uptime",
metric.WithUnit("ms"),
metric.WithDescription("Milliseconds since application was initialized"),
)
if err != nil {
Expand All @@ -136,10 +145,12 @@ func (r *runtime) register() error {
_, err = r.meter.RegisterCallback(
func(ctx context.Context, o metric.Observer) error {
o.ObserveInt64(uptime, time.Since(startTime).Milliseconds())
o.ObserveInt64(processUptime, time.Since(startTime).Milliseconds())
o.ObserveInt64(goroutines, int64(goruntime.NumGoroutine()))
o.ObserveInt64(cgoCalls, goruntime.NumCgoCall())
return nil
},
processUptime,
uptime,
goroutines,
cgoCalls,
Expand Down