I am trying to create an uptime check in Google Cloud Platform using the gcloud command line client. This is an example:
gcloud monitoring uptime create 'example uptime check' --resource-labels=host=...,project_id=... --resource-type=uptime-url --protocol=https --port=443 "--path=..." --request-method=get --validate-ssl=true --status-codes=200 --matcher-type=contains-string "--matcher-content=..." --period=5 --timeout=30 --user-labels=instance-group=production,instance-type=authentication,monitoring-type=uptime
This generally works, i.e. the uptime check is created and no errors are reported. However, my user labels are silently ignored.
I believe that I am following the documentation (https://cloud.google.com/sdk/gcloud/reference/monitoring/uptime/create) correctly:
--user-labels=[KEY=VALUE,…] List of label KEY=VALUE pairs to add. Keys must start with a lowercase character and contain only hyphens (-), underscores (_), lowercase characters, and numbers. Values must contain only hyphens (-), underscores (_), lowercase characters, and numbers.
I have successfully added very similar user labels to compute instances, disks etc.
I have also tried to add user labels to existing uptime checks via gcloud monitoring uptime update
, but that also did not work.
Update: I have created a bug report as suggested by Daniel t.: https://issuetracker.google.com/issues/393989630