You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-17 01:12:45 +02:00
Restructure RegisterCallback method (#3587)
* Restructure RegisterCallback method Instead of accepting instruments to register the callback with as a slice, accept them as variadic arguments. * Add changes to changelog * Add PR number to changes
This commit is contained in:
@ -68,11 +68,11 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
_, err = meter.RegisterCallback([]instrument.Asynchronous{gauge}, func(ctx context.Context) error {
|
||||
_, err = meter.RegisterCallback(func(ctx context.Context) error {
|
||||
n := -10. + rand.Float64()*(90.) // [-10, 100)
|
||||
gauge.Observe(ctx, n, attrs...)
|
||||
return nil
|
||||
})
|
||||
}, gauge)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user