3

It's quite simple: I have

  • a datadog-dashbaord
  • a template-variable named env, which can have following values ['prod', 'test']

enter image description here

And I want to display metrics based on the env:

  • from-resource for test is unified-importer-test-sqsimportdlq11419573-xl6dn7o5wqtj
  • from-resource for prod is unified-importer-prod-sqsimportdlq11419573-prmohksrvxxg

So naturally I'd use following syntax: unified-importer-$env.value-sqsimportdlq*

But this does not display anything, nor shows it any error.

This, however, works as expected: unified-importer-test-sqsimportdlq* (or unified-importer-prod-sqsimportdlq* respectively).

It looks like asterisk in combination with wildcards is not working.

Additionally, DD seems to dislike using two asterisks (as prefix and suffix): enter image description here

How can I leverage the template-var env easily in this situation?

Christopher Will
  • 2,991
  • 3
  • 29
  • 46

2 Answers2

1

Well, it turned out that following solution works:

sum:aws.sqs.approximate_number_of_messages_visible{service:unified-importer AND env:$env.value AND queuename IN (unified-importer-test-sqsimportdlq86419573-al6dn7o5wqtj,unified-importer-prod-sqsimportdlq86419573-prmohksrvmxg)}
Christopher Will
  • 2,991
  • 3
  • 29
  • 46
  • Have the same issue regarding SQS messages and Datadog variable template. I am not sure why but this solution does not work for me. – Eduardo Apr 18 '23 at 18:22
1

There's no way to use the template variable in the middle of a string, it can only go at the end. That would be a feature request to the Datadog team

draav
  • 1,454
  • 8
  • 8