• /
  • EnglishEspañolFrançais日本語한국어Português
  • EntrarComeçar agora

Troubleshoot missing data for AWS Lambda with OpenTelemetry

Problem: CloudWatch metrics or invocations not appearing

After instrumenting your AWS Lambda function with OpenTelemetry and invoking it, the CloudWatch metrics section or Invocations tab doesn't appear in the New Relic UI.

Solution

New Relic requires the following OpenTelemetry resource attributes to correctly identify and display your Lambda function in the UI:

AttributeDescriptionExample value
faas.nameThe name of the Lambda functionmy-lambda-function
faas.idThe full ARN of the Lambda functionarn:aws:lambda:us-east-1:123456789012:function:my-lambda-function

If these attributes are missing, set them using the OTEL_RESOURCE_ATTRIBUTES environment variable.

SAM template:

yourFunctionHere:
Type: AWS::Serverless::Function
Properties:
# ...
Environment:
Variables:
OTEL_RESOURCE_ATTRIBUTES: "faas.name=my-lambda-function,faas.id=arn:aws:lambda:us-east-1:123456789012:function:my-lambda-function"

Importante

Replace my-lambda-function and the ARN with your actual function name and ARN. The ARN must match the value shown in the AWS Lambda console exactly.

AWS Console:

  1. Open your function in the Lambda Console.
  2. Choose Configuration, then Environment variables.
  3. Choose Edit, then Add environment variable.
  4. Set Key to OTEL_RESOURCE_ATTRIBUTES and Value to faas.name=my-lambda-function,faas.id=arn:aws:lambda:us-east-1:123456789012:function:my-lambda-function.
  5. Choose Save.

If you already have other resource attributes set, append the new values as comma-separated key-value pairs:

OTEL_RESOURCE_ATTRIBUTES=service.name=my-service,faas.name=my-lambda-function,faas.id=arn:aws:lambda:us-east-1:123456789012:function:my-lambda-function

Problem: Request ID missing on traces

Your Lambda function traces appear in New Relic, but the AWS request ID isn't visible on the root span, making it difficult to correlate traces with CloudWatch Logs entries.

Solution

Set the faas.execution attribute on the root span inside your handler. The OpenTelemetry semantic conventions define this attribute as the cloud provider's request or invocation ID.

Python:

from opentelemetry import trace
def handler(event, context):
span = trace.get_current_span()
span.set_attribute("faas.execution", context.aws_request_id)
# Your handler logic here
return {"statusCode": 200, "body": "OK"}

Node.js:

const { trace } = require('@opentelemetry/api');
exports.handler = async (event, context) => {
const span = trace.getActiveSpan();
if (span) {
span.setAttribute('faas.execution', context.awsRequestId);
}
// Your handler logic here
return { statusCode: 200, body: 'OK' };
};

Java:

import io.opentelemetry.api.trace.Span;
public class Handler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent event, Context context) {
Span span = Span.current();
span.setAttribute("faas.execution", context.getAwsRequestId());
// Your handler logic here
return new APIGatewayProxyResponseEvent().withStatusCode(200);
}
}

Dica

New Relic surfaces faas.execution as Request ID in the trace details panel, making it easy to find the corresponding CloudWatch Logs entry for any invocation.

More information

For more information, see the following:

Copyright © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.