mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2024-11-24 08:22:25 +02:00
handle err in metric example test (#4462)
* fix type in metric example test Signed-off-by: Pulak Kanti Bhowmick <pkbhowmick007@gmail.com> * handle error in metric example test Signed-off-by: Pulak Kanti Bhowmick <pkbhowmick007@gmail.com> * update counter example Signed-off-by: Pulak Kanti Bhowmick <pkbhowmick007@gmail.com> * handle the err only Signed-off-by: Pulak Kanti Bhowmick <pkbhowmick007@gmail.com> --------- Signed-off-by: Pulak Kanti Bhowmick <pkbhowmick007@gmail.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
parent
3c476ce181
commit
f172db89a1
@ -76,10 +76,18 @@ func ExampleMeter_asynchronous_multiple() {
|
||||
meter := otel.Meter("go.opentelemetry.io/otel/metric#MultiAsyncExample")
|
||||
|
||||
// This is just a sample of memory stats to record from the Memstats
|
||||
heapAlloc, _ := meter.Int64ObservableUpDownCounter("heapAllocs")
|
||||
gcCount, _ := meter.Int64ObservableCounter("gcCount")
|
||||
heapAlloc, err := meter.Int64ObservableUpDownCounter("heapAllocs")
|
||||
if err != nil {
|
||||
fmt.Println("failed to register updown counter for heapAllocs")
|
||||
panic(err)
|
||||
}
|
||||
gcCount, err := meter.Int64ObservableCounter("gcCount")
|
||||
if err != nil {
|
||||
fmt.Println("failed to register counter for gcCount")
|
||||
panic(err)
|
||||
}
|
||||
|
||||
_, err := meter.RegisterCallback(
|
||||
_, err = meter.RegisterCallback(
|
||||
func(_ context.Context, o metric.Observer) error {
|
||||
memStats := &runtime.MemStats{}
|
||||
// This call does work
|
||||
|
Loading…
Reference in New Issue
Block a user