Skip to content

Instantly share code, notes, and snippets.

@tanelmae
Last active March 26, 2019 09:13
Show Gist options
  • Save tanelmae/1bef78c1443f95c01212669e02d2b4bf to your computer and use it in GitHub Desktop.
Save tanelmae/1bef78c1443f95c01212669e02d2b4bf to your computer and use it in GitHub Desktop.
# Use gcloud access token to fetch Stackdriver custom metrics descriptions
curl --silent --header "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
https://monitoring.googleapis.com/v3/projects/$(gcloud config get-value core/project)/metricDescriptors?filter=metric.type%3Dstarts_with%28%22custom.googleapis.com%2F%22%29
# Get all the custom metrics names with jq
curl --silent --header "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
https://monitoring.googleapis.com/v3/projects/$(gcloud config get-value core/project)/metricDescriptors?filter=metric.type%3Dstarts_with%28%22custom.googleapis.com%2F%22%29 | jq '.metricDescriptors[] | .name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment