5

I'm looking to report custom metrics from Lambda functions to Datadog. I need things like counters, gauges, histograms.

Datadog documentation outlines two options for reporting metrics from AWS Lambda:

  • print a line into the log
  • use the API

The fine print in the document above mentions that the printing method only supports counters and gauges, so that's obviously not enough for my usecase (I also need histograms).

Now, the second method - the API - only supports reporting time series points, which I'm assuming are just gauges (right?), according to the API documentation.

So, is there a way to report metrics to Datadog from my Lambda functions, short of setting up a statsd server in EC2 and calling out to it using dogstatsd? Anyone have any luck getting around this?

Stefan Zobel
  • 3,182
  • 7
  • 28
  • 38
Vladimir Li
  • 141
  • 2
  • 7
  • 1
    Not sure if it changed since you posted, but [Datadog Lambda](https://docs.datadoghq.com/integrations/amazon_lambda/) custom metrics do support histograms. – dmulter Jul 10 '18 at 14:13
  • If you're interested in monitoring Lambda with Datadog, they have a new [Cloud Functions product](https://docs.datadoghq.com/graphing/infrastructure/cloudfunctions/) focused specifically on that. Depending on your use-case, it might save you from reinventing the wheel :shrugs:. If that's overkill, just using their [log management analytics](https://docs.datadoghq.com/integrations/amazon_lambda/#log-collection) may be all you need. – stephenlechner Jan 18 '19 at 15:14

2 Answers2

0

The easier way is using this library: https://github.com/marceloboeira/aws-lambda-datadog

It has runtime no dependencies, doesn't require authentication and reports everything to cloud-watch too. You can read more about it here: https://www.datadoghq.com/blog/how-to-monitor-lambda-functions/

Marcelo Boeira
  • 860
  • 8
  • 22
-1

Yes it is possible to emit metrics to DataDog from a AWS Lambda function.

If you were using node.js you could use https://www.npmjs.com/package/datadog-metrics to emit metrics to the API. It supports counters, gauges and histograms. You just need to pass in your app/api key as environment variables.

Matt

  • 1
    This may require some additional testing as the API endpoint only supports gauges: http://docs.datadoghq.com/metrictypes/ The expected behavior would be that all submissions are converted to gauges on ingestion. – Andrew Vaughan May 26 '17 at 19:21