How to pass array of counter values into RegisterCallback() #4157
karthi8185
started this conversation in
General
Replies: 1 comment 5 replies
-
No. But you can create a helper function yourself. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am using opentelemetry to export some customize data to otelcollector. Here my question is any possibility to pass the array arguments into RegisterCallback()
In the below code, instead of passing name1[0], name1[1], name1[2]... any possibility of send name1. Also, is there any api/method to resolve the type converstion. Since name1 data type is metric.Int64ObservableCounter but register to call back argument is metric.Observable.
var name1 []metric.Int64ObservableCounter
......
_, err = meter.RegisterCallback(
func(ctx context.Context, o metric.Observer) error {
o.ObserveInt64(name1[0], int64(getMetricValue(fullName1)))
o.ObserveInt64(name1[1], int64(getMetricValue(fullName2)))
o.ObserveInt64(name1[2], int64(getMetricValue(fullName3)))
o.ObserveInt64(name1[3], int64(getMetricValue(fullName4)))
return nil
},
name1[0],
name1[1],
name1[2],
name1[3],
)
kindly guide me.
Beta Was this translation helpful? Give feedback.
All reactions