Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

datadog-lambda-js

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datadog-lambda-js - npm Package Compare versions

Comparing version 9.112.0 to 9.113.0

2

dist/constants.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.STREAM_RESPONSE = exports.HANDLER_STREAMING = exports.datadogLambdaVersion = void 0;
exports.datadogLambdaVersion = "9.112.0";
exports.datadogLambdaVersion = "9.113.0";
// Response streaming functions

@@ -6,0 +6,0 @@ exports.HANDLER_STREAMING = Symbol.for("aws.lambda.runtime.handler.streaming");

@@ -184,3 +184,3 @@ "use strict";

_c.sent();
return [4 /*yield*/, metricsListener.onStartInvocation(event)];
return [4 /*yield*/, metricsListener.onStartInvocation(event, context)];
case 3:

@@ -335,3 +335,3 @@ _c.sent();

}
tags = __spreadArray(__spreadArray([], __read(tags), false), [getRuntimeTag()], false);
tags = __spreadArray(__spreadArray(__spreadArray([], __read(tags), false), [getRuntimeTag()], false), __read(getDDTags()), false);
if (currentMetricsListener !== undefined) {

@@ -468,2 +468,14 @@ currentMetricsListener.sendDistributionMetricWithDate.apply(currentMetricsListener, __spreadArray([name, value, metricTime, false], __read(tags), false));

}
function getDDTags() {
var ddTags = getEnvValue("DD_TAGS", "").split(",");
var ddService = getEnvValue("DD_SERVICE", "");
if (ddService.length > 0) {
ddTags.push("service:".concat(ddService));
}
var ddEnv = getEnvValue("DD_ENV", "");
if (ddEnv.length > 0) {
ddTags.push("env:".concat(ddEnv));
}
return ddTags;
}
function emitTelemetryOnErrorOutsideHandler(error, functionName, startTime) {

@@ -470,0 +482,0 @@ return __awaiter(this, void 0, void 0, function () {

@@ -52,4 +52,3 @@ "use strict";

Batcher.prototype.toAPIMetrics = function () {
return __spreadArray([], __read(this.metrics.values()), false).map(function (metric) { return metric.toAPIMetrics(); }) // No flatMap support yet in node 10
.reduce(function (prev, curr) { return prev.concat(curr); }, []);
return __spreadArray([], __read(this.metrics.values()), false).flatMap(function (metric) { return metric.toAPIMetrics(); });
};

@@ -56,0 +55,0 @@ Batcher.prototype.getBatchKey = function (metric) {

import { KMSService } from "./kms-service";
import { Context } from "aws-lambda";
export interface MetricsConfig {

@@ -50,4 +51,5 @@ /**

private isExtensionRunning?;
private globalTags?;
constructor(kmsClient: KMSService, config: MetricsConfig);
onStartInvocation(_: any): Promise<void>;
onStartInvocation(_: any, context?: Context): Promise<void>;
onCompleteInvocation(): Promise<void>;

@@ -59,3 +61,4 @@ sendDistributionMetricWithDate(name: string, value: number, metricTime: Date, // TODO: Next breaking change to update to optional or 'Date | undefined'?

private getAPIKey;
private getGlobalTags;
}
//# sourceMappingURL=listener.d.ts.map

@@ -71,3 +71,5 @@ "use strict";

var model_1 = require("./model");
var enhanced_metrics_1 = require("./enhanced-metrics");
var METRICS_BATCH_SEND_INTERVAL = 10000; // 10 seconds
var HISTORICAL_METRICS_THRESHOLD_HOURS = 4 * 60 * 60 * 1000; // 4 hours
var MetricsListener = /** @class */ (function () {

@@ -78,6 +80,7 @@ function MetricsListener(kmsClient, config) {

this.isExtensionRunning = undefined;
this.globalTags = [];
this.apiKey = this.getAPIKey(config);
this.config = config;
}
MetricsListener.prototype.onStartInvocation = function (_) {
MetricsListener.prototype.onStartInvocation = function (_, context) {
return __awaiter(this, void 0, void 0, function () {

@@ -98,2 +101,3 @@ var _a;

(0, utils_1.logDebug)("Using StatsD client");
this.globalTags = this.getGlobalTags(context);
this.statsDClient = new hot_shots_1.StatsD({ host: "127.0.0.1", closingFlushInterval: 1 });

@@ -187,5 +191,14 @@ return [2 /*return*/];

if (isMetricTimeValid) {
var dateCeiling = new Date(Date.now() - HISTORICAL_METRICS_THRESHOLD_HOURS); // 4 hours ago
if (dateCeiling > metricTime) {
(0, utils_1.logWarning)("Timestamp ".concat(metricTime.toISOString(), " is older than 4 hours, not submitting metric ").concat(name));
return;
}
// Only create the processor to submit metrics to the API when a user provides a valid timestamp as
// Dogstatsd does not support timestamps for distributions.
this.currentProcessor = this.createProcessor(this.config, this.apiKey);
// Add global tags to metrics sent to the API
if (this.globalTags !== undefined && this.globalTags.length > 0) {
tags = __spreadArray(__spreadArray([], __read(tags), false), __read(this.globalTags), false);
}
}

@@ -241,3 +254,3 @@ else {

processor = new Processor(apiClient, METRICS_BATCH_SEND_INTERVAL, config.shouldRetryMetrics);
processor.startProcessing();
processor.startProcessing(this.globalTags);
return [2 /*return*/, processor];

@@ -273,2 +286,15 @@ case 2: return [2 /*return*/];

};
MetricsListener.prototype.getGlobalTags = function (context) {
var tags = (0, enhanced_metrics_1.getEnhancedMetricTags)(context);
if (context === null || context === void 0 ? void 0 : context.invokedFunctionArn) {
var splitArn = context.invokedFunctionArn.split(":");
if (splitArn.length > 7) {
// Get rid of the alias
splitArn.pop();
}
var arn = splitArn.join(":");
tags.push("function_arn:".concat(arn));
}
return tags;
};
return MetricsListener;

@@ -275,0 +301,0 @@ }());

{
"name": "datadog-lambda-js",
"version": "9.112.0",
"version": "9.113.0",
"description": "Lambda client library that supports hybrid tracing in node js",

@@ -31,3 +31,3 @@ "main": "dist/index.js",

"@types/shimmer": "^1.0.1",
"dd-trace": "^4.37.0",
"dd-trace": "^4.42.0",
"jest": "^27.0.1",

@@ -34,0 +34,0 @@ "mock-fs": "4.14.0",

@@ -55,2 +55,5 @@ # datadog-lambda-js

### 9.x.x
The 9.x.x release changed how Lambda's traceID is hashed if the incoming payload contains Step Functions context object. This change only affects those who uses inject Step Functions context object into Lambda payload.
There is a full migration guide available [here](https://github.com/DataDog/dd-trace-js/blob/master/MIGRATING.md).

@@ -57,0 +60,0 @@ Some changes are more likely to impact Serverless users:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc