feat(bigtable): add Cloud Bigtable client uptime gauge metric#14653
feat(bigtable): add Cloud Bigtable client uptime gauge metric#14653mgarolera wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new client uptime metric (uptime) as an Int64ObservableGauge and adds support for exporting Gauge[int64] and Gauge[float64] metrics to Cloud Monitoring. Feedback suggests ensuring that the StartTime of the TimeInterval is set equal to the EndTime for gauge metrics to comply with Cloud Monitoring API requirements. Additionally, a defensive check should be added to ensure tf.startTime is initialized before observing the uptime metric.
4501d5c to
69ed0cd
Compare
69ed0cd to
86bc9bc
Compare
| ) | ||
|
|
||
| const ( | ||
| bigtableResourceType = "bigtable_client_raw" |
There was a problem hiding this comment.
I think this needs a bit more work. All the metrics exported from this exporter goes to bigtable_client_raw which maps to BigtableTable target instead of BigtableClient target, which is different from the internal metric definition.
There was a problem hiding this comment.
This metric should be exported similar to client startup time.
this will use the cloud.BigtableClient schema.
There was a problem hiding this comment.
Ah yes. I think we should move the definition of this metric to otel_metrics, something like:
otelMeterProvider := metric.NewMeterProvider(meterOpts...) // existing code
startTime := time.Now()
_, err := meter.Int64ObservableGauge(
"uptime",
metric.WithDescription("Time since the Bigtable client was created."),
metric.WithUnit("s"),
metric.WithInt64Callback(func(_ context.Context, o metric.Int64Observer) error {
o.Observe(int64(time.Since(startTime).Seconds()))
return nil
}),
)
Add reporting for CBT client uptime to help with observability and troubleshooting