feat: Allow filtering metric attributes and creating custom monitored resource #850
+38
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: https://github.com/googleapis/google-cloud-go/pull/10046/files#diff-a1b4b02d8e5fa0e59a2122e76a7bcda69fdd818d66ee4498db5b8d8100ec9cabR45-R61
I'm working on exporting Bigtable client metrics to Google Cloud Monitoring.
The metrics need to be written with monitored resource type 'bigtable_client_raw'
The monitored resource needs to have below labels:
The values for the last 3 of the above labels need to be obtained from response metadata i.e. they are not available at the time of otel resource creation i.e. unavailable at this point in code:
How to include these in monitored resource labels?
WithMonitoredResourceCreator
to extract the resource labels from the metric labels and create monitored resource. Example usage:https://github.com/googleapis/google-cloud-go/pull/10046/files#diff-a1b4b02d8e5fa0e59a2122e76a7bcda69fdd818d66ee4498db5b8d8100ec9cabR58-R59
https://github.com/googleapis/google-cloud-go/pull/10046/files#diff-a1b4b02d8e5fa0e59a2122e76a7bcda69fdd818d66ee4498db5b8d8100ec9cabR71-R112
Also, the resource labels should be removed from the metric labels before exporting them to Google Cloud Monitoring. This will be done using the
WithFilteredMetricAttributes
option. Example usage:https://github.com/googleapis/google-cloud-go/pull/10046/files#diff-a1b4b02d8e5fa0e59a2122e76a7bcda69fdd818d66ee4498db5b8d8100ec9cabR61