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.

1 Like

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,
Cat

1 Like

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.

Best,
Cat

1 Like

Hello - Just found this thread, and would like to inquire if the use of “Labels” are now available in creating NRQL alert policies?

Thank you,
-Jason

It’s not yet possible to target APM labels with NRQL and NRQL alert conditions. I’ll get your +1 added :slight_smile:

Hi Ryan,

Would like to have Labels made queryable. Especially for building Dashboards and Alerts based on a certain category.

Regards,
Manju

@MANJUNATH.SUNKAD1 - your +1 for this feature has been added :smiley:

Hi,
I was trying to add a dashboard based out on labels, and I was hoping nr.labels would make it. When I’m building the query, I get auto-completion with my existing tags, but I cannot seem to make it work. Any suggestions?

Adding a screenshot for your reference:

Thanks,
Sebastian

Hi Sebastian!

You can query Synthetics labels without the nr.XXX attributes.

In my synthetics account I have labels on my monitors for Environment:Prod or Staging

I can query these in insights with:

SELECT * FROM SyntheticCheck WHERE Environment = 'Prod'

So, could you try just that, rather than the nr.XXX attributes?

Here at our company we are very interested in making queries based on labels to filter our Transactions and Browser Events. If we could get our +1 in this too :smiley:

1 Like

You got it @amarchina your +1 has been logged :slight_smile:

1 Like