DEV Community

AWS Lambda console : exploring single pane view of metrics, logs, and traces

Introduction

Recently AWS announced that AWS Lambda console now features a single pane view of metrics, logs, and traces. Lambda console now features a new simplified design with a single pane view of metrics, logs, and traces, along with universal filters for time range, time zone, and refresh options. Let's explore this new functionallity.

Exploring single pane view of metrics, logs, and traces in AWS Lambda

For the demonstration purposes we'll use the sample application with enabled X-Ray tracing on API Gateway and Lambda in template.yaml. For API Gateway the relevant configuration is:

  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      StageName: !Ref Stage
      TracingEnabled: true
      ...
Enter fullscreen mode Exit fullscreen mode

and for Lambda it is:

  Function:
    CodeUri: target/aws-pure-lambda-snap-start-21-1.0.0-SNAPSHOT.jar
    Runtime: java21
    Timeout: 30 
    MemorySize: 1024
    Tracing: Active
    ....
Enter fullscreen mode Exit fullscreen mode

We also need the tracing to the DynamoDB call through adding execution tracing interceptor in DynamoProductDao.

 private static final DynamoDbClient dynamoDbClient = DynamoDbClient.builder()
    .credentialsProvider(DefaultCredentialsProvider.create())
    .region(Region.EU_CENTRAL_1)
    .overrideConfiguration(ClientOverrideConfiguration.builder()
       .addExecutionInterceptor(new TracingInterceptor())
      .build())
    .build();

Enter fullscreen mode Exit fullscreen mode

Don't forget to add multiple aws-xray-* dependencies to the
pom.xml

Let's produce some invocations of the "GetProductByIdWithPureJava21LambdaBig" Lambda function and then navigate into the "Monitor" tab.

Image description.

We'll find the following in this Lambda pane :

CloudWatch metrics like Invocations, Duration, Error Count, Throttles and so on.

Image description

CloudWatch Logs for "Recent invocations" and "Most expensive invocations in GB-seconds" looks like this.

Image description

AWS X-Ray and CloudWatch ServiceLens which contains a "Service Map" with possibility to view and analyze traces and view the dashboard.

Image description

AWS X-Ray and CloudWatch ServiceLens also contains X-Ray traces and the functionality to filter those traces.

Image description

Conclusion

The single pane indeed eliminates the need to navigate between multiple dashboards and apply filters to each of them separately, reducing the number of clicks required to monitor your Lambda functions. The single pane view also makes it easy to correlate metrics, logs, and traces, reducing the mean time to recovery (MTTR) when troubleshooting errors in your Lambda functions. Very handy functionallity!

As an improvement I'd like to see Amazon DevOps Guru integration with Lambda single pane. In case that DevOps Guru recognized the anomaly with Lambda function involved time range of the anomaly should be pre-selected automatically. Currently DevOps Guru only shows corresponding CloudWatch metrics and CloudWatch Logs for the anomaly with Lambda involved and misses AWS X-Ray and CloudWatch ServiceLens information. In case you'd like to know more about DevOps Guru I write the article series about it. Check it out!

Top comments (0)