appinsights-logger
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -22,2 +22,3 @@ import * as appInsights from 'applicationinsights'; | ||
export declare function addMetadataProps<T extends Telemetry>(telemetry: T): T; | ||
export declare function httpTriggerWrapper(fn: any, customDimensions?: {}): (context: any, req: any) => Promise<void>; | ||
export {}; |
@@ -66,2 +66,21 @@ "use strict"; | ||
exports.addMetadataProps = addMetadataProps; | ||
function httpTriggerWrapper(fn, customDimensions = {}) { | ||
return async function contextPropagatingHttpTrigger(context, req) { | ||
const correlationContext = exports.ai.startOperation(context, req); | ||
return exports.ai.wrapWithCorrelationContext(async () => { | ||
const startTime = Date.now(); | ||
await fn(context, req); | ||
exports.ai.defaultClient.trackRequest({ | ||
name: context.req.method + " " + context.req.url, | ||
resultCode: context.res.status, | ||
success: true, | ||
url: req.url, | ||
duration: Date.now() - startTime, | ||
id: correlationContext.operation.parentId, | ||
properties: customDimensions | ||
}); | ||
}, correlationContext)(); | ||
}; | ||
} | ||
exports.httpTriggerWrapper = httpTriggerWrapper; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "appinsights-logger", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "thin, yet opinionated wrapper for applcation insights", | ||
@@ -23,3 +23,3 @@ "repository": "gopuff/appinsights-logger", | ||
"dependencies": { | ||
"applicationinsights": "^1.7.3" | ||
"applicationinsights": "^1.8.10" | ||
}, | ||
@@ -26,0 +26,0 @@ "devDependencies": { |
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
13792
128
Updatedapplicationinsights@^1.8.10