seek-datadog-custom-metrics
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -13,4 +13,3 @@ "use strict"; | ||
* @deprecated This depends on Datadog's deprecated CloudWatch log integration. | ||
* This has been superseded by the Datadog Lambda Extension which does not | ||
* support the `count` metric type required by our `MetricClient` interface. | ||
* Consumers should migrate to the `createLambdaExtensionClient` function. | ||
* | ||
@@ -17,0 +16,0 @@ * @see {@link https://docs.datadoghq.com/serverless/libraries_integrations/extension/} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.httpTracingConfig = exports.createTimedSpan = exports.createStatsDClient = exports.createNoOpClient = exports.createCloudWatchClient = void 0; | ||
exports.httpTracingConfig = exports.createTimedSpan = exports.createStatsDClient = exports.createNoOpClient = exports.createLambdaExtensionClient = exports.createCloudWatchClient = void 0; | ||
var createCloudWatchClient_1 = require("./createCloudWatchClient"); | ||
Object.defineProperty(exports, "createCloudWatchClient", { enumerable: true, get: function () { return createCloudWatchClient_1.createCloudWatchClient; } }); | ||
var createLambdaExtensionClient_1 = require("./createLambdaExtensionClient"); | ||
Object.defineProperty(exports, "createLambdaExtensionClient", { enumerable: true, get: function () { return createLambdaExtensionClient_1.createLambdaExtensionClient; } }); | ||
var createNoOpClient_1 = require("./createNoOpClient"); | ||
@@ -7,0 +9,0 @@ Object.defineProperty(exports, "createNoOpClient", { enumerable: true, get: function () { return createNoOpClient_1.createNoOpClient; } }); |
@@ -10,4 +10,3 @@ import { globalTags } from './globalTags'; | ||
* @deprecated This depends on Datadog's deprecated CloudWatch log integration. | ||
* This has been superseded by the Datadog Lambda Extension which does not | ||
* support the `count` metric type required by our `MetricClient` interface. | ||
* Consumers should migrate to the `createLambdaExtensionClient` function. | ||
* | ||
@@ -14,0 +13,0 @@ * @see {@link https://docs.datadoghq.com/serverless/libraries_integrations/extension/} |
export { createCloudWatchClient } from './createCloudWatchClient'; | ||
export { createLambdaExtensionClient } from './createLambdaExtensionClient'; | ||
export { createNoOpClient } from './createNoOpClient'; | ||
@@ -3,0 +4,0 @@ export { createStatsDClient } from './createStatsDClient'; |
@@ -7,4 +7,3 @@ import { AppConfig } from './AppConfig'; | ||
* @deprecated This depends on Datadog's deprecated CloudWatch log integration. | ||
* This has been superseded by the Datadog Lambda Extension which does not | ||
* support the `count` metric type required by our `MetricClient` interface. | ||
* Consumers should migrate to the `createLambdaExtensionClient` function. | ||
* | ||
@@ -11,0 +10,0 @@ * @see {@link https://docs.datadoghq.com/serverless/libraries_integrations/extension/} |
import { MetricsClient } from './MetricsClient'; | ||
type TimingMetricsClient = Pick<MetricsClient, 'increment' | 'timing'>; | ||
/** | ||
@@ -13,2 +14,3 @@ * Sends timing related metrics for an asynchronous operation | ||
*/ | ||
export declare const createTimedSpan: (metricsClient: MetricsClient) => <T>(name: string, block: () => PromiseLike<T>) => Promise<T>; | ||
export declare const createTimedSpan: (metricsClient: TimingMetricsClient) => <T>(name: string, block: () => PromiseLike<T>) => Promise<T>; | ||
export {}; |
export { createCloudWatchClient } from './createCloudWatchClient'; | ||
export { createLambdaExtensionClient } from './createLambdaExtensionClient'; | ||
export { createNoOpClient } from './createNoOpClient'; | ||
@@ -3,0 +4,0 @@ export { createStatsDClient } from './createStatsDClient'; |
{ | ||
"name": "seek-datadog-custom-metrics", | ||
"version": "4.2.0", | ||
"private": false, | ||
"description": "Helpers for sending Datadog custom metrics", | ||
"homepage": "https://github.com/seek-oss/datadog-custom-metrics#readme", | ||
"bugs": { | ||
"url": "https://github.com/seek-oss/datadog-custom-metrics/issues" | ||
}, | ||
"dependencies": {}, | ||
"description": "Helpers for sending Datadog custom metrics", | ||
"devDependencies": { | ||
"@types/node": "16.11.38", | ||
"dd-trace": "3.8.0", | ||
"hot-shots": "9.2.0", | ||
"skuba": "5.0.1" | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/seek-oss/datadog-custom-metrics.git" | ||
}, | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"main": "./lib-commonjs/index.js", | ||
"module": "./lib-es2015/index.js", | ||
"types": "./lib-types/index.d.ts", | ||
"files": [ | ||
@@ -18,20 +24,2 @@ "lib*/**/*.d.ts", | ||
], | ||
"homepage": "https://github.com/seek-oss/datadog-custom-metrics#readme", | ||
"license": "MIT", | ||
"main": "./lib-commonjs/index.js", | ||
"module": "./lib-es2015/index.js", | ||
"name": "seek-datadog-custom-metrics", | ||
"peerDependencies": { | ||
"hot-shots": "6.x || 7.x || 8.x || 9.x" | ||
}, | ||
"peerDependenciesMeta": { | ||
"hot-shots": { | ||
"optional": true | ||
} | ||
}, | ||
"private": false, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/seek-oss/datadog-custom-metrics.git" | ||
}, | ||
"scripts": { | ||
@@ -46,3 +34,24 @@ "build": "skuba build-package", | ||
}, | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@types/aws-lambda": "^8.10.108" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "16.18.12", | ||
"datadog-lambda-js": "6.84.0", | ||
"dd-trace": "3.9.3", | ||
"hot-shots": "9.3.0", | ||
"skuba": "5.1.1" | ||
}, | ||
"peerDependencies": { | ||
"datadog-lambda-js": "6.x", | ||
"hot-shots": "6.x || 7.x || 8.x || 9.x" | ||
}, | ||
"peerDependenciesMeta": { | ||
"datadog-lambda-js": { | ||
"optional": true | ||
}, | ||
"hot-shots": { | ||
"optional": true | ||
} | ||
}, | ||
"skuba": { | ||
@@ -53,5 +62,3 @@ "entryPoint": "src/index.ts", | ||
"version": "4.0.0" | ||
}, | ||
"types": "./lib-types/index.d.ts", | ||
"version": "4.1.0" | ||
} | ||
} |
@@ -15,12 +15,2 @@ # 🐶 Datadog Custom Metrics | ||
## Table of contents | ||
- [Tagging convention](#tagging-convention) | ||
- [API reference](#api-reference) | ||
- [createStatsDClient](#createstatsdclient) | ||
- [createNoOpClient](#createnoopclient) | ||
- [createTimedSpan](#createtimedspan) | ||
- [httpTracingConfig](#httptracingconfig) | ||
- [Contributing](https://github.com/seek-oss/datadog-custom-metrics/blob/master/CONTRIBUTING.md) | ||
## Tagging convention | ||
@@ -60,2 +50,34 @@ | ||
### `createLambdaExtensionClient` | ||
`createLambdaExtensionClient` creates a [Lambda extension](https://docs.datadoghq.com/serverless/libraries_integrations/extension/) client. | ||
This is intended for AWS Lambda functions and is a replacement for `createCloudWatchClient`. | ||
This client will only submit metrics as a [distribution](https://docs.datadoghq.com/metrics/distributions/) which enables globally accurate aggregations for percentiles (p50, p75, p90, etc). | ||
```typescript | ||
import { createLambdaExtensionClient } from 'seek-datadog-custom-metrics'; | ||
// Expects `name` and `metrics` properties | ||
import config from '../config'; | ||
// Returns a standard hot-shots StatsD instance | ||
const { metricsClient, withLambdaExtension } = | ||
createLambdaExtensionClient(config); | ||
export const handler = withLambdaExtension((event, _ctx) => { | ||
try { | ||
logger.info('request'); | ||
await lambdaFunction(event); | ||
} catch (err) { | ||
logger.error({ err }, 'request'); | ||
metricsClient.increment('invocation_error'); | ||
throw new Error('invoke error'); | ||
} | ||
}); | ||
``` | ||
### `createNoOpClient` | ||
@@ -62,0 +84,0 @@ |
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
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
55834
3817
58
831
147
3
5
+ Added@types/aws-lambda@^8.10.108
+ Added@types/aws-lambda@8.10.146(transitive)
+ Addedbignumber.js@9.1.2(transitive)
+ Addeddatadog-lambda-js@6.89.0(transitive)
+ Addederr-code@2.0.3(transitive)
+ Addedhot-shots@8.5.0(transitive)
+ Addedpromise-retry@2.0.1(transitive)
+ Addedretry@0.12.0(transitive)
+ Addedserialize-error@8.1.0(transitive)
+ Addedshimmer@1.2.1(transitive)
+ Addedts-md5@1.3.1(transitive)
+ Addedtype-fest@0.20.2(transitive)