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

@dazn/datadog-metrics

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dazn/datadog-metrics - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

13

datadog-metrics-async.js
let defaultTags = [], isInitialized = false, prefix
let logger = console

@@ -13,2 +14,6 @@ function init() {

if (process.env.DISABLE_METRICS && process.env.DISABLE_METRICS.toLowerCase() === 'true') {
logger = { log: () => null }
}
isInitialized = true

@@ -22,3 +27,3 @@ }

tags = defaultTags.concat(tags || [])
console.log(`MONITORING|${timestamp}|${value}|gauge|${key}|#${tags.join(',')}`)
logger.log(`MONITORING|${timestamp}|${value}|gauge|${key}|#${tags.join(',')}`)
}

@@ -33,3 +38,3 @@

tags = defaultTags.concat(tags || [])
console.log(`MONITORING|${timestamp}|${value}|count|${key}|#${tags.join(',')}`)
logger.log(`MONITORING|${timestamp}|${value}|count|${key}|#${tags.join(',')}`)
}

@@ -42,3 +47,3 @@

tags = defaultTags.concat(tags || [])
console.log(`MONITORING|${timestamp}|${value}|histogram|${key}|#${tags.join(',')}`)
logger.log(`MONITORING|${timestamp}|${value}|histogram|${key}|#${tags.join(',')}`)
}

@@ -51,3 +56,3 @@

tags = defaultTags.concat(tags || [])
console.log(`MONITORING|${timestamp}|${value}|distribution|${key}|#${tags.join(',')}`)
logger.log(`MONITORING|${timestamp}|${value}|distribution|${key}|#${tags.join(',')}`)
}

@@ -54,0 +59,0 @@

{
"name": "@dazn/datadog-metrics",
"version": "1.4.0",
"version": "1.5.0",
"description": "Records metrics with Datadog, supports both synchronous (via HTTP) and asynchronous (via Datadog's Lambda integration) modes. Defaults to asynchronous mode.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -78,1 +78,12 @@ # DAZN Datadog Metrics

```
## Disabling console output
Sometimes you won't want the console output to be displayed (e.g. when running your unit tests) when running in async mode. In order to do this, you can set the environment variable `DISABLE_METRICS=true`; this will disable console logging output. Note: Only set this for scenarios you don't want metrics to be recorded, as setting this will stop any metrics from being recorded.
For example, your scripts section in `package.json` may look like this:
```json
"scripts": {
"unit:test": "DISABLE_METRICS=true jest",
...
}
```
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