Reputation: 8075
I've added structured error reporting to my Google Cloud Function like mentioned here: https://cloud.google.com/functions/docs/monitoring/logging#writing_structured_logs. I'm wondering if I can specify fields using this technique that I can then use in the markdown of the Alerting policy:https://cloud.google.com/monitoring/alerts/doc-variables?authuser=6#doc-vars. Based on the documentation at both of these links, I'm not sure if there's any overlap though both mention labels of some sort. Ideally I would just get the message that I specify and that shows up in the logs as that has a good amount of information.
Upvotes: 0
Views: 800
Reputation: 40081
NOTE Error Reporting is a distinct Google service. You can use it too with a Node.JS runtime on Cloud Functions.
Alerting is based upon Monitoring and you can create so-called Log-based Metrics which are Monitoring metrics derived from Logs. Both permit labels. Log-based Metrics aggregate log entries and the labels are used as a dimension for the resulting metric.
So you can:
I was unaware of the Alerting policy documentation facility before your question but I'm confident you can get close to what you're after.
Upvotes: 1