Metrics not written to Stackdriver when using resource type other than global
See original GitHub issuePlease read Tom’s post on down to my post in the previous reported bug which was support more resource types and while we can set another one, all writing of metrics then fails to GCP.
According to the current docs for Stackdriver Monitoring only these resource types support custom metrics:
- aws_ec2_instance
- dataflow_job
- gce_instance
- gke_container
- generic_node
- generic_task
- global
- k8s_cluster
- k8s_container
- k8s_node
- k8s_pod
Each of these resource types has different requirements for the labels provided. Currently only the projectId is added as a label which is only valid for the global
resource type. The documentation even recommends not to use global
Use this resource when no other resource type is suitable. For most use cases, generic_node or generic_task are better choices than global.
Configuring the registry for any other resource type results in errors buried in Stackdriver logs that look like:
i.g.StatusRuntimeException: INVALID_ARGUMENT: One or more TimeSeries could not be written: The set of resource labels is incomplete. Missing labels: (location namespace node_id).: timeSeries[0]
This could also be contributing a contributing factor for #1001 as the MetricServiceClient
fails silently and just writes a log to Stackdriver.
Updating the StackdriverMeterRegistry
where it creates the MonitoredResource
to include the required labels for each resource type will allow for metrics to be associated with these other resource types.
@jkschneider - if you’re able to provide some guidance about pulling metadata from the Google Cloud compute metadata client I’d be happy to attempt a PR
_Originally posted by @tomwscott in https://github.com/micrometer-metrics/micrometer/issues/1003#issuecomment-556118415_
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (2 by maintainers)
Top GitHub Comments
For completeness, in cloud run, this is what we do now
and that map is passed back in our config object like so…
Glad you both got this working. @deanorderly could you open a separate issue (or pull request) about making what you need more configurable? Thanks.