Comments (4)
Hi @sugendran! You can submit custom distribution metrics from within your lambda functions. Here's a code sample:
const { sendDistributionMetric } = require('datadog-lambda-js');
async function myHandler(event, context) {
sendDistributionMetric(
'coffee_house.order_value', // Metric name
12.45, // Metric value
'product:latte', // First tag
'order:online' // Second tag
);
return {
statusCode: 200,
body: 'hello, dog!'
};
}
We have some more information here
You can read more about distribution metrics here.
Unfortunately, we can't support Count, Rate, Gauge, or Histogram metrics from a serverless context. When multiple of those metrics are submitted at approximately the same time (e.g. from concurrent lambda executions), our metrics intake treats them as duplicates and discards all but the last metric received. Distribution metrics are aggregated on the back end instead, and you can treat them the same as rates, gauges, etc., from within Datadog.
Let me know if you have any further questions!
from datadog-lambda-js.
I get the issue with real time collection, but what about for cases where we set a specific timestamp? Even if the lambda were to run as a second instance it would overwrite the prior entry, right?
from datadog-lambda-js.
If you are using distribution metrics like in the example above, you would not overwrite a metric even if you were sending the exact same timestamp.
from datadog-lambda-js.
This is now better explained in https://docs.datadoghq.com/serverless/custom_metrics#understanding-distribution-metrics. Closing.
from datadog-lambda-js.
Related Issues (20)
- Full aws-sdk v3 support for nodejs18.x - remove v2 leftovers HOT 7
- [Feature request] Support Vault for Datadog API Key fetching HOT 3
- We are experiencing a weird issue where datadog's lambda layer is loading a module which is an optional dependency of its parent package HOT 6
- Access to trace id? HOT 2
- Path is removed by SAM CLI v1.89. HOT 4
- TypeError: Cannot read properties of undefined (reading 'then') HOT 8
- Missing KMS client dependency HOT 4
- Merge with standard W3C trace context HOT 2
- Receiving datadog: handler not initialized error HOT 1
- datadog + serverless + async_hooks not working as expected
- TypeError: handler is not a function HOT 17
- "datadog:handler not initialized" if metrics is sent after Lambda response with callbackWaitsForEmptyEventLoop = false HOT 1
- lambda layer 99 introduces intermittent postgres prepared statement error HOT 3
- Feature request: Enhanced metric for batch item failures HOT 1
- Feature request: NodeJS 20.x layer HOT 3
- Remove dependency on deprecated aws-sdk v2 HOT 4
- DNSResolvePlugin.finish throws TypeError HOT 13
- Cannot import package as ES6 module using AWS SAM CLI HOT 2
- `bind EMFILE 0.0.0.0` errors with Node 20 HOT 10
- DNSResolvePlugin.finish still throws TypeError on layer version 102 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datadog-lambda-js.