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

Count calls for an external service in a time frame


#1

We have an app that calls multiple external services (we are marketplace platform that gathers products from multiple external sources).

One of the providers want us to tell him how many calls we have been doing to his API, he points out an specific timeframe he wants to know, but we don’t know how to NRQL that.

example external API
https://myprovider.com/endpoint1
https://myprovider.com/endpoint2

SELECT COUNT() FROM ExternalTransactions WHERE url LIKE “%https://myprovider.com/%
SELECT COUNT(
) FROM ExternalTransactions WHERE url = “https://myprovider.com/endpoint2

Can this be done?


#2

Hi, @silva96: ExternalTransactions is not a standard event type; are you capturing it as a custom event? If so, then yes, your query examples should work, but we cannot help you with them, because we don’t know what attributes you are passing with each event.

If you are using distributed tracing, you may be able to get the desired data by querying Span events:

SELECT count(*) 
FROM Span 
WHERE `http.url` LIKE 'http://myprovider.com/%'
SINCE starttime UNTIL endtime
EXTRAPOLATE

#3

EcternalTransaction doesn’t exist… Was an example for you to tell me the real way of doing it. I don’t know if I have distributed tracing, I’ll check


#4

OK. If you are not using distributed tracing, New Relic APM does not record individual external service calls, so you would have to add code to create a custom event for each call.