Instrumenting .NET Serverless Applications Using the Datadog Forwarder
Overview
Prerequisites
The Datadog Forwarder Lambda function is required to ingest AWS Lambda enhanced metrics, custom metrics, and logs.
Enable X-Ray tracing
- Enable AWS X-Ray active tracing for your Lambda function.
- Install the AWS X-Ray SDK for .NET.
Subscribe the Datadog Forwarder to log groups
Subscribe the Datadog Forwarder Lambda function to each of your function’s log groups to send metrics, traces, and logs to Datadog.
What’s next?
Monitor custom business logic
If you would like to submit a custom metric using the Datadog Forwarder, see the sample code below:
var myMetric = new Dictionary<string, object>();
myMetric.Add("m", "coffee_house.order_value");
myMetric.Add("v", 12.45);
myMetric.Add("e", (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds);
myMetric.Add("t", new string[] {"product:latte", "order:online"});
LambdaLogger.Log(JsonConvert.SerializeObject(myMetric));