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

Key Transactions - Serverless Stack (API Gateway + Lambda)

restapi
nodejs
apdex
keytransaction
aws-lambda
serverless

#1

Hi. I have a rest service using AWS API Gateway + Lambda (NodeJS) with the NR agent configured and working fine in serverless mode.

I would like to know if it is possible to monitor that serverless application similar to a regular microservice in ECS/EKS/EC2, creating a key transaction, which would display the Apdex and SLA reports!? I haven’t found any documentation about this matter.

Thanks in advance.


#2

Hi @cangiolucci - You may find the posts below useful


#3

Thank you @stefan_garnham for providing the links to these post. @cangiolucci were these helpful in answering your question?


#4

They were helpful indeed, but from what I could understand I would need to use the APM Node Agent which is not tested/designed to run in the AWS lambda environment to see any data in APM. The Lambda monitoring is already working fine for me, but I miss the transaction information from the APM.

Are there any guides/studies on how to use it in lambdas or any other way to instrument data from then to NR APM (i really need some features, like APDEX and SLA reports).

My current stack is NodeJS 12 + Express, serving a rest api as mentioned before.

Thanks.


#5

Thanks for that update and context @cangiolucci

As noted in the first of the posts linked to by Stefan:

the Lambda ingest pipeline does ignore certain kinds of data (transactions) that would be standard for APM contexts.

This will make calculating Apdex and populating an SLA report more manual. If you can define some metrics that you require in an SLA Report, you may be able to get those via a NRQL query in Insights.

Similarly, there is the apdex() function in NRQL as well to calculate those important metrics for you.


#6

Here is a post which you can use as a basis for your NRQL SLA report.


#7

Thanks for the link Stefan :smiley:


#8

Thank you @RyanVeitch and @stefan_garnham!
I came up with this NRQL, does this make sense?

SELECT (sum(provider.count.SampleCount)) AS 'Requests (thousands)',
(average(provider.latency.Average)) AS 'Average Response Time(ms)',
((filter(sum(provider.count.SampleCount), WHERE provider.latency.Average <= 600) + (filter(sum(provider.count.SampleCount), WHERE provider.latency.Average > 600 AND provider.latency.Average <= (600 * 4)) / 2)) / sum(provider.count.SampleCount)) AS Apdex,
percentage(sum(provider.count.SampleCount), WHERE provider.latency.Average <= 600) AS '% Satisfied',
percentage(sum(provider.count.SampleCount), WHERE provider.latency.Average > 600 AND provider.latency.Average <= (600 * 4)) AS '% Tolerating',
percentage(sum(provider.count.SampleCount), WHERE provider.latency.Average > (600 * 4)) AS '% Frustrated',
FROM ApiGatewaySample WHERE provider = 'ApiGatewayApi' AND providerAccountId = 'MY-ACCOUNT-ID' AND `provider.apiName` = 'MY-API'
FACET dateOf(timestamp) since 14 days ago limit 20

I have used these formulas:

T : Request duration treshold, 600ms in this example
Requests : Sum of all APIGW requests
Satisfied : Requests <= T
Tolerating : Requests > T AND <= (T * 4)
Frustrated : Requests > (T * 4)
APDEX : (Satisfied + (Tolerating / 2)) / Requests

Source: https://docs.newrelic.com/docs/apm/new-relic-apm/apdex/apdex-measure-user-satisfaction


#9

Nice :smiley:

That query looks good to me! Is it working for you? Do you have all the data you need?


#10

Yes, it does work and have all the data i need for now.


#11

Fantastic! Thanks for confirming that :smiley: