seek-datadog-custom-metrics
Advanced tools
Comparing version 4.3.0 to 4.4.0
@@ -15,3 +15,3 @@ "use strict"; | ||
*/ | ||
const createTimedSpan = (metricsClient) => async (name, block) => { | ||
const createTimedSpan = (metricsClient) => async (name, block, afterCompletion) => { | ||
const startTime = process.hrtime.bigint(); | ||
@@ -21,4 +21,6 @@ const handleCompletion = (success) => { | ||
const successTag = success ? 'success' : 'failure'; | ||
metricsClient.timing(`${name}.latency`, Number(durationNanos) / 1e6); | ||
const durationMilliseconds = Number(durationNanos) / 1e6; | ||
metricsClient.timing(`${name}.latency`, durationMilliseconds); | ||
metricsClient.increment(`${name}.count`, [successTag]); | ||
afterCompletion === null || afterCompletion === void 0 ? void 0 : afterCompletion(durationMilliseconds, success); | ||
}; | ||
@@ -25,0 +27,0 @@ try { |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export const createTimedSpan = (metricsClient) => async (name, block) => { | ||
export const createTimedSpan = (metricsClient) => async (name, block, afterCompletion) => { | ||
const startTime = process.hrtime.bigint(); | ||
@@ -18,4 +18,6 @@ const handleCompletion = (success) => { | ||
const successTag = success ? 'success' : 'failure'; | ||
metricsClient.timing(`${name}.latency`, Number(durationNanos) / 1e6); | ||
const durationMilliseconds = Number(durationNanos) / 1e6; | ||
metricsClient.timing(`${name}.latency`, durationMilliseconds); | ||
metricsClient.increment(`${name}.count`, [successTag]); | ||
afterCompletion === null || afterCompletion === void 0 ? void 0 : afterCompletion(durationMilliseconds, success); | ||
}; | ||
@@ -22,0 +24,0 @@ try { |
@@ -14,3 +14,3 @@ import type { MetricsClient } from './MetricsClient'; | ||
*/ | ||
export declare const createTimedSpan: (metricsClient: TimingMetricsClient) => <T>(name: string, block: () => PromiseLike<T>) => Promise<T>; | ||
export declare const createTimedSpan: (metricsClient: TimingMetricsClient) => <T>(name: string, block: () => PromiseLike<T>, afterCompletion?: ((duration: number, success: boolean) => void) | undefined) => Promise<T>; | ||
export {}; |
{ | ||
"name": "seek-datadog-custom-metrics", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"private": false, | ||
@@ -37,3 +37,3 @@ "description": "Helpers for sending Datadog custom metrics", | ||
"devDependencies": { | ||
"@types/node": "16.18.12", | ||
"@types/node": "16.18.37", | ||
"datadog-lambda-js": "6.84.0", | ||
@@ -40,0 +40,0 @@ "dd-trace": "3.9.3", |
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
57105
850