Apm.service.external.host.duration issue with third party API timeout

Hello Sir,

SELECT average(`apm.service.external.host.duration`) FROM Metric FACET `external.host` WHERE appName LIKE '%' and external.host like 'third-party-url' TIMESERIES 1 hour since 1 day ago

This is the Metric i have been selected apm.service.external.host.duration issue with this, third party api timeout is not get registered where i get a count and average from above metric but how do i find the api timeout count in new relic
is it possible??

Hi, @gopal.khandare: If an API call times out, it will not have a duration; New Relic does not know how long it took to complete (duration) unless it completes. :slight_smile:

A timeout may be recorded as an error: https://docs.newrelic.com/docs/apm/apm-ui-pages/error-analytics/errors-page-find-fix-verify-problems.

1 Like

Practically u say that its not possible to setup alert on third party api but can we set how long it took??

I don’t know, it really depends on your application and how you record the data. Here is an example of a timeout exception in a sample application:

can you let me know the steps of java application that how to find timeout exception so i can get the end point where you show in the screenshot.

As I said, your data may look different from the sample application. I got there by:

  1. Selecting the desired application from Services - APM
  2. Selecting the Distributed tracing page
  3. Searching the list of Errors on the left side for “timeout”
  4. Selecting a trace containing a timeout error
  5. Finding a span containing an error and clicking the red error indicator to view error details

Timeouts are generally captured in Errors.
But We need to ask
How to count transactions where Apm.service.external.host.duration from Metric is greater than 10 sec.
We can only see Average / Sum / Max / Min / Count

just need to know

Metrics do not contain information about individual transactions; the data is aggregated, typically once per minute. That is why you may only query the average/sum/min/max/count: Do you want to know the number of minutes in which the average duration was greater than 10 seconds, or the number of minutes in which the maximum duration was greater than 10 seconds?

If you want to know the number of individual transactions whose duration was greater than 10 seconds, you must query events, not metrics:

SELECT count(*) FROM Transaction WHERE duration > 10 SINCE 1 day ago

For more information, please see https://docs.newrelic.com/docs/data-apis/understand-data/new-relic-data-types/.

This will give us all external Transaction Data, But we need data for specific external host.

Try something like this:

SELECT count(*)
FROM Span 
WHERE appName   = 'Your Application' 
  AND span.kind = 'client'
  AND http.url  = 'https://example.com/endpoint/'
  AND duration  > 10
SINCE 1 day ago 

it does not show anything like span when i do NRQL where other entities i have

Spans require distributed tracing. If you do not have distributed tracing enabled, New Relic does not capture the response times of individual external service calls. If you wish, you may add code to your application to capture them as custom events.

Does Distributed Tracing have costing included just let me know the pricing if possible.

If you are on the current usage-based pricing plan, there is no charge for individual product features, such as distributed tracing. You are charged only for the amount of data you send to New Relic, and the number of users in your account.

Enabling distributed tracing will increase the amount of data you send to New Relic; it is impossible to predict how much data your application will send.

Hello Phil Still not able to find using Distributed Tracing Enabled still unable to find the exact timeout happened i share you the query please let me know what should i modify from here of how to take Third Party API Timeouts.
SELECT * FROM Span WHERE appName = ‘prod_disbursement’ AND http.url LIKE ‘%https://ybl-imps.transxt.in%’ AND duration > 15 SINCE 1 week ago

Sorry, I have told you everything I know. Perhaps someone else will have a suggestion.

is there any way to reach out to new relic support.
we have a paid Account but we cant speak to anyone.

Hi, @gopal.khandare: Support plans are documented here: https://docs.newrelic.com/docs/licenses/license-information/general-usage-licenses/global-technical-support-offerings/#nr1plan . Support cases are available to Pro and Enterprise subscribers, otherwise support is provided via this forum.

However, New Relic tech support does not help with writing queries. You will have to rely on other members of the community to help you with this question.