Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

How to add labels on NRQL based alerts?


I’m trying to figure out how to associate labels with an NRQL based alert. I’d expect to use this feature like I do with APM based alerts. I can see a blank label object in the alert payload.


Hi, there, @doug17!

I’m happy to discuss associating labels with a NRQL-based alert condition. As I understand your inquiry, you are looking to create NRQL-based alert conditions that target labeled entities.
First I’d like to clarify a few things to make sure we’re on the same page:

  1. Are you creating alert conditions in the UI or via REST API?

  2. Regarding your statement:

I can see a blank label object in the alert payload.

Could you provide a screenshot or description of where you are seeing this? More context here specifically will be helpful, thanks!

I also would like to point you to an article that outlines a workaround for targeting labeled entities via NRQL here.

Just in case you are utilizing the REST API for Alerts, conditions targeting labels are not available from the API endpoint.

I hope this information helps guide you in the right direction! If you have any other questions or I missed the mark with your inquiry, please reach out!

Best regards,


Hi, @cjanowitz: I don’t think labels are available to NRQL queries. I have labeled some of my applications with Environment:Production , but the following query returns no results:

SELECT appName FROM Transaction WHERE Environment = 'Production'


Thanks for the clarification, @philweber! The workaround I linked to above outlines something like:

SELECT count(*) from Transaction WHERE ExampleLabelCategory= 'True' and transactionType ='Other' and duration > 300

where the app has a label: ExampleLabelCategory:True. Is this not viable?


I cannot make it work. Try it! :slight_smile:


My experience matches yours, @philweber, it’s no good!

@doug17, I apologize for the wayward guidance with the not-really-a-workaround. Knowing that labels aren’t currently available for NRQL-based alert conditions, I’m happy to file a feature request on your behalf. Do let me know if there’s anything additional you’d like me to add to this feature request and I’ll include it.

That said, I’m still curious about the label availability within an alert payload and I’ll refer back to my original question in my first reply.