Skip to content

Commit

Permalink
metric: Recommend defining units in UCUM (open-telemetry#4418)
Browse files Browse the repository at this point in the history
* metric: Recommend defining units in UCUM

* Update metric/instrument.go

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>

---------

Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
pellared and MrAlias authored Aug 8, 2023
1 parent 10099bb commit b8e8e5e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions metric/instrument.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ func (o unitOpt) applyInt64ObservableGauge(c Int64ObservableGaugeConfig) Int64Ob
}

// WithUnit sets the instrument unit.
//
// The unit u should be defined using the appropriate [UCUM](https://ucum.org) case-sensitive code.
func WithUnit(u string) InstrumentOption { return unitOpt(u) }

// AddOption applies options to an addition measurement. See
Expand Down

0 comments on commit b8e8e5e

Please sign in to comment.