Key Transactions - Serverless Stack (API Gateway + Lambda)

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.

Hi @cangiolucci - You may find the posts below useful


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

1 Like

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.


1 Like

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.


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


Thanks for the link Stefan :smiley:

1 Like

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


1 Like

Nice :smiley:

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

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

1 Like

Fantastic! Thanks for confirming that :smiley: