Annotations and Labels are not populating

I have an issue where if I have custom labels:

But they don’t show up under the labels section when I preview the alert:

But they do show up on the alerting overview page:

I believe this is affecting my ability to pull the labels to successfully use templates. Any help?

Hi! I think the Preview button just previews labels from the datasource. However, I can see the custom labels in the second screenshot so it looks like these are working as expected.\ :slight_smile:

Awesome! That sounds great. I do have an issue though where when I’m using templates the labels don’t show up. I’m trying to get lables I put in and not of the datasource.

I’m not sure how to get labels to show up.



slack

Do you have any solutions?

Hi! There is a mistake in the first screenshot, it should be:

text body: {{ template "slackmessage" . }}

Thanks! I changed it and ran the test custom notification with a environment label of testenviro and it is now coming up blank.

newslack

Your second screenshot attempts to print the environment label, but for which alert?

You need to tell it to either to print the environment labels of all alerts in the notification, or something else like just the first alert in the notification. Using Go's templating language | Grafana documentation