serverless-plugin-datadog
Advanced tools
Comparing version 0.12.0 to 0.13.0
@@ -5,4 +5,5 @@ import { FunctionDefinition } from "serverless"; | ||
NODE = 0, | ||
PYTHON = 1, | ||
UNSUPPORTED = 2 | ||
NODE_TS = 1, | ||
PYTHON = 2, | ||
UNSUPPORTED = 3 | ||
} | ||
@@ -9,0 +10,0 @@ export interface HandlerInfo { |
@@ -13,4 +13,5 @@ "use strict"; | ||
RuntimeType[RuntimeType["NODE"] = 0] = "NODE"; | ||
RuntimeType[RuntimeType["PYTHON"] = 1] = "PYTHON"; | ||
RuntimeType[RuntimeType["UNSUPPORTED"] = 2] = "UNSUPPORTED"; | ||
RuntimeType[RuntimeType["NODE_TS"] = 1] = "NODE_TS"; | ||
RuntimeType[RuntimeType["PYTHON"] = 2] = "PYTHON"; | ||
RuntimeType[RuntimeType["UNSUPPORTED"] = 3] = "UNSUPPORTED"; | ||
})(RuntimeType = exports.RuntimeType || (exports.RuntimeType = {})); | ||
@@ -17,0 +18,0 @@ exports.runtimeLookup = { |
@@ -26,2 +26,3 @@ "use strict"; | ||
const node_js_template_1 = require("./templates/node-js-template"); | ||
const node_ts_template_1 = require("./templates/node-ts-template"); | ||
const python_template_1 = require("./templates/python-template"); | ||
@@ -35,2 +36,9 @@ const util_2 = require("./util"); | ||
const promises = handlers.map((handlerInfo) => __awaiter(this, void 0, void 0, function* () { | ||
const handlerPath = getHandlerPath(handlerInfo); | ||
if (handlerPath === undefined) { | ||
return; | ||
} | ||
if (handlerInfo.type === layer_1.RuntimeType.NODE && fs_1.default.existsSync(`./${handlerPath.filename}.ts`)) { | ||
handlerInfo = Object.assign({}, handlerInfo, { type: layer_1.RuntimeType.NODE_TS }); | ||
} | ||
const result = getWrapperText(handlerInfo); | ||
@@ -77,2 +85,4 @@ if (result === undefined) { | ||
return { text: node_js_template_1.nodeTemplate(filename, method), method }; | ||
case layer_1.RuntimeType.NODE_TS: | ||
return { text: node_ts_template_1.typescriptTemplate(filename, method), method }; | ||
case layer_1.RuntimeType.PYTHON: | ||
@@ -85,3 +95,3 @@ return { text: python_template_1.pythonTemplate(filename, method), method }; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const extension = handlerInfo.type === layer_1.RuntimeType.PYTHON ? "py" : "js"; | ||
const extension = getHandlerExtension(handlerInfo.type); | ||
const filename = `${handlerInfo.name}.${extension}`; | ||
@@ -118,2 +128,14 @@ const pathname = path_1.default.join(exports.datadogDirectory, filename); | ||
exports.addToExclusionList = addToExclusionList; | ||
function getHandlerExtension(type) { | ||
switch (type) { | ||
case layer_1.RuntimeType.NODE: | ||
return "js"; | ||
case layer_1.RuntimeType.NODE_TS: | ||
return "ts"; | ||
case layer_1.RuntimeType.PYTHON: | ||
return "py"; | ||
case layer_1.RuntimeType.UNSUPPORTED: | ||
return ""; | ||
} | ||
} | ||
//# sourceMappingURL=wrapper.js.map |
{ | ||
"name": "serverless-plugin-datadog", | ||
"version": "0.12.0", | ||
"version": "0.13.0", | ||
"description": "Serverless plugin to automatically instrument python and node functions with datadog tracing", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65879
43
685