Create helpers to initialize and export gRPC metrics
Starting with gRPC-v1.62.x there are cool metrics published via OTel:
https://github.com/grpc/grpc/blob/6d7a55890e076a3a8abc8185b6bf0153fcf9d179/include/grpcpp/ext/otel_plugin.h#L45-L58
We would like a simple function to initialize a metrics provider such that metrics related to the Storage library get exported to Cloud Monitoring. Presumably other libraries can use something similar.
Though we would probably need >= v1.63.0 to provide good filtering:
https://github.com/grpc/grpc/blob/bc470e47ad64ae94ba8baff01e75a7606ed1cd00/include/grpcpp/ext/otel_plugin.h#L125-L127
One issue is to figure out the right filtering function that works for universe domains, VPC-SC, and PSC.
- [x] #14112
- [x] Initialize the endpoint for the exporter
- [x] Initialize gRPC exporter only once per "endpoint"
- [x] Update monitored resource type to
storage.googleapis.com/Client - [x] Change metric names to use
/as a separator instead of the.separators produced by gRPC - [ ] Use resource detector to initialize the resource attributes in the exporter
- [ ] Configure the exporter to use
CreateServiceTimeSeries() - [ ] Configure the exporter to use the right prefix for the metric name
We need a function that will accept:
| Target | Authority |
|---|---|
storage.${universe_domain} |
storage.${universe_domain} |
private.googleapis.com |
storage.googleapis.com |
restricted.googleapis.com |
storage.googleapis.com |
storage-${foo}.p.googleapis.com |
storage.googleapis.com |
It should reject everything else.