Search code examples
aws-lambdaserverless-frameworkdatadog

How to monitor HTTP status codes with serverless datadog plugin


I am using serverless-plugin-datadog, which uses datadog-lambda-layer under the hood.

The docs state, that by using this plugin it is not necessary to wrap a handler anymore. This is, by the way, the main reason why I decided to go for it.

The lambda itself is a REST API, which responds with dedicated status codes.

My question now is, how can I monitor the number of 4xx and 5xx http status codes? Do I have to define custom metrics in datadog for this to work? I was under the assumption that the plugin comes with those data out-of-the-box, but it looks like I'm missing an important part here.


Solution

  • but it looks like I'm missing an important part here.

    That was the point. The lambda itself has not much todo with particular statusCodes. So I either may log each status code and let datadog parse it accordingly.

    Or, that's the solution I went for, I can leverage API-Gateway for monitoring status codes per lambda.