Comparing version 0.7.0-beta.4 to 0.7.0-beta.5
@@ -1,1 +0,1 @@ | ||
module.exports = '0.7.0-beta.4' | ||
module.exports = '0.7.0-beta.5' |
{ | ||
"name": "dd-trace", | ||
"version": "0.7.0-beta.4", | ||
"version": "0.7.0-beta.5", | ||
"description": "Datadog APM tracing client for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,4 +8,4 @@ 'use strict' | ||
class Config { | ||
constructor (options) { | ||
options = options || {} | ||
constructor (service, options) { | ||
options = typeof service === 'object' ? service : options || {} | ||
@@ -32,14 +32,3 @@ const enabled = coalesce(options.enabled, platform.env('DD_TRACE_ENABLED'), true) | ||
this.plugins = !!plugins | ||
Object.defineProperty(this, 'service', { | ||
get () { | ||
const service = coalesce(options.service, platform.env('DD_SERVICE_NAME')) | ||
if (service) { | ||
return service | ||
} | ||
return platform.service() || 'node' | ||
} | ||
}) | ||
this.service = coalesce(options.service, platform.env('DD_SERVICE_NAME'), service, 'node') | ||
} | ||
@@ -46,0 +35,0 @@ } |
@@ -7,2 +7,3 @@ 'use strict' | ||
const env = require('./env') | ||
const validate = require('./validate') | ||
const service = require('./service') | ||
@@ -25,2 +26,3 @@ const request = require('./request') | ||
env, | ||
validate, | ||
service, | ||
@@ -27,0 +29,0 @@ request, |
@@ -6,15 +6,4 @@ 'use strict' | ||
const parentModule = require('parent-module') | ||
const semver = require('semver') | ||
const SUPPORTED_VERSIONS = '^4.7 || ^6.9 || >=8' | ||
function service () { | ||
if (!semver.satisfies(process.versions.node, SUPPORTED_VERSIONS)) { | ||
throw new Error([ | ||
`Node ${process.versions.node} is not supported.`, | ||
`Only versions of Node matching "${SUPPORTED_VERSIONS}" are supported.`, | ||
`Tracing has been disabled.` | ||
].join(' ')) | ||
} | ||
const callerPath = parentModule() | ||
@@ -21,0 +10,0 @@ const parentPath = parentModule(callerPath) |
@@ -52,5 +52,7 @@ 'use strict' | ||
try { | ||
const config = new Config(options) | ||
const service = platform.service() | ||
const config = new Config(service, options) | ||
if (config.enabled) { | ||
platform.validate() | ||
platform.configure(config) | ||
@@ -57,0 +59,0 @@ |
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
126579
76