NRQL with tags as WHERE condition

We have APM and Browser agents enabled across multiple AWS EKS clusters (DEV, PROD) for the same license key. I have tried unsuccessfully building Dashboard queries using “and (tags.deployment = ‘my-app-env-string’)” for Metric, Transaction, BrowserInteraction, and PageViewTiming. What are the tricks to segregating result sets based on a deployment environment (tag or otherwise)?

Are you sure you have those tags on those Metrics and Event types? Does Keyset() etc show them present?

  • confirmed to be present on Metrics but queries still fail in Dashboard.
  • have identified using "and (domain like ‘%my.domain.com’) for Browser metrics instead

Got a sample of what might be “failing”?

FROM Transaction SELECT average(duration) facet request.uri WHERE (entityGuid = ‘blahblahblah’) and (tags.deployment = ‘development’)

  • in a dashboard component, the query above will fail every time
  • in NROne Query Builder, query above fails initially; removing the second WHERE condition renders data; returning WHERE condition to query continues to render data

Far various reason I recommend you use appName instead of entityGUID for the time being.

Start with this to see what you get:

SELECT count(*) FROM Transaction WHERE appName = 'foo' facet tags.deployment since 7 days ago

Do you see your deployments?

that appears to work, thank you!

I stand corrected; I still get the same behavior when constituting the dashboard component:

  • in a dashboard component, the query fails every time
  • in NROne Query Builder, query fails as defined; removing the second WHERE condition renders data; returning WHERE condition to query continues to render data

second query example:
SELECT percentage(count(*), WHERE error is true) AS ‘Error rate’ FROM Transaction WHERE (appName = ‘my-app-name’) and (tags.deployment = ‘development’)

When you say “dashboard component” what specifically do you mean?

Also, when you say fail do you mean empty or error message?

Is there a reason you are using the brackets in the NRQL? They are not needed.

Does this give you rows you might expect in a table?

SELECT count(*) FROM Transaction WHERE appName = 'foo' facet error, tags.deployment since 7 days ago

That query returns rows exactly as expected.
When I said “dashboard component” I mean just that: using said query to define a Dashboard element (manually or via terraform).
When I said “fail” I should have stated “returns no data, regardless of timeframe specified.”
Using parentheses is a long-held habit.

Ok, so which widget are you trying?

with respect to the Error Rate query, I am using the Billboard widget. It currently renders “No value.”

Huh. Maybe check your characters.

SELECT percentage(count(*), where error is true) as 'error rate' from Transaction where appName = 'foo' and tags.account = 'bar'

This displays perfectly for me on a billboard.

Thanks! In NROne QueryBuilder, the adjustments work as expected on the first try for each discrete set.

So what do you think your issue was?

correcting the query, specifically around the values for the tag conditions in the query with respect to what was being reported to New Relic, solved the problem.

1 Like