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

Feature Idea: Get prior custom Insights attribute from Synthetics

feature-idea

#1

I have a script where I’m storing a custom attribute using the set function:

$util.insights.set(myAttribute, myValue);

Is there an easier way in the next run I can get the prior value? Or application always increases this value so I am checking to make sure it is larger so we have extra detection of job failures. Using the REST API call to Insights works, but wondering if there is a more straightforward approach.


New Relic Edit

  • I want this too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.


#2

Hey @dmattox , have you tried $util.insights.get(myAttribute);??

See other Insights functions here: https://docs.newrelic.com/docs/synthetics/new-relic-synthetics/scripting-monitors/add-custom-attributes-new-relic-synthetics-data#h2-functions


#3

Hey @dmattox - Apologies, it was just called out to me here that the util.insights.get function will not pull the attribute value from insights.

That function actually just grabs the value previously set using util.insights.set in that run of the script.

You’ll need to request the attribute value via the Insights API, which you can do from a Scripted Browser by using urllib, or request to send an API request within the Scripted Browser environment.


#4

Thanks for the responses Ryan.

Yes, I tried the util.insights.get function, but it worked exactly as you described. It was returning null before calling set and returning the set value after. Not sure why anyone would need this behavior.

I want my monitor scripts as simple as possible, but the API call is working fine. I’ll leave it as-is for now. Thanks again.


#5

@dmattox I’m going to go ahead and add a feature request for a built into script way of querying insights. I’ll also add a poll here for others to have their say here.