Comparing version 0.7.0-beta.5 to 0.7.0-beta.6
@@ -1,1 +0,1 @@ | ||
module.exports = '0.7.0-beta.5' | ||
module.exports = '0.7.0-beta.6' |
{ | ||
"name": "dd-trace", | ||
"version": "0.7.0-beta.5", | ||
"version": "0.7.0-beta.6", | ||
"description": "Datadog APM tracing client for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,3 +25,2 @@ 'use strict' | ||
function formatSpan (span) { | ||
const tracer = span.tracer() | ||
const spanContext = span.context() | ||
@@ -33,5 +32,4 @@ | ||
parent_id: spanContext.parentId, | ||
name: String(span._operationName), | ||
resource: String(span._operationName), | ||
service: String(tracer._service), | ||
name: String(spanContext.name), | ||
resource: String(spanContext.name), | ||
error: 0, | ||
@@ -38,0 +36,0 @@ meta: {}, |
@@ -29,3 +29,2 @@ 'use strict' | ||
this._prioritySampler = prioritySampler | ||
this._operationName = operationName | ||
this._startTime = startTime | ||
@@ -89,3 +88,3 @@ | ||
_setOperationName (name) { | ||
this._operationName = name | ||
this._spanContext.name = name | ||
} | ||
@@ -92,0 +91,0 @@ |
@@ -45,7 +45,5 @@ 'use strict' | ||
const tags = { | ||
'resource.name': name | ||
'service.name': this._service | ||
} | ||
tags['service.name'] = this._service | ||
if (this._env) { | ||
@@ -52,0 +50,0 @@ tags.env = this._env |
@@ -124,2 +124,5 @@ 'use strict' | ||
req._datadog.hooks.forEach(hooks => hooks.request(req._datadog.span, req, res)) | ||
addResourceTag(req) | ||
req._datadog.span.finish() | ||
@@ -162,16 +165,9 @@ req._datadog.scope && req._datadog.scope.close() | ||
const span = req._datadog.span | ||
const tags = span.context().tags | ||
const res = req._datadog.res | ||
if (!tags.hasOwnProperty(HTTP_ROUTE) && req._datadog.paths.length > 0) { | ||
if (req._datadog.paths.length > 0) { | ||
span.setTag(HTTP_ROUTE, req._datadog.paths.join('')) | ||
} | ||
const resource = [req.method] | ||
.concat(tags[HTTP_ROUTE]) | ||
.filter(val => val) | ||
.join(' ') | ||
span.addTags({ | ||
[RESOURCE_NAME]: resource, | ||
[HTTP_STATUS_CODE]: res.statusCode | ||
@@ -183,2 +179,16 @@ }) | ||
function addResourceTag (req) { | ||
const span = req._datadog.span | ||
const tags = span.context().tags | ||
if (tags['resource.name']) return | ||
const resource = [req.method] | ||
.concat(tags[HTTP_ROUTE]) | ||
.filter(val => val) | ||
.join(' ') | ||
span.setTag(RESOURCE_NAME, resource) | ||
} | ||
function addHeaders (req) { | ||
@@ -185,0 +195,0 @@ const span = req._datadog.span |
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
3570
126535