@opencensus/exporter-zipkin
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -27,3 +27,3 @@ "use strict"; | ||
1: 'SENT', | ||
2: 'RECEIVED' | ||
2: 'RECEIVED', | ||
}; | ||
@@ -34,4 +34,5 @@ exports.MICROS_PER_MILLI = 1000; | ||
constructor(options) { | ||
this.zipkinUrl = options.url && url.parse(options.url) || | ||
url.parse(ZipkinTraceExporter.DEFAULT_URL); | ||
this.zipkinUrl = | ||
(options.url && url.parse(options.url)) || | ||
url.parse(ZipkinTraceExporter.DEFAULT_URL); | ||
this.serviceName = options.serviceName; | ||
@@ -67,18 +68,21 @@ this.buffer = new core_1.ExporterBuffer(this, options); | ||
'Content-Type': 'application/json', | ||
} | ||
}, | ||
}; | ||
return new Promise((resolve, reject) => { | ||
/** Request object */ | ||
const req = http.request(options, (res) => { | ||
res.on('data', (chunk) => { }); | ||
const req = http.request(options, res => { | ||
res.on('data', chunk => { }); | ||
// Resolve on end | ||
res.on('end', () => { | ||
resolve({ statusCode: res.statusCode, statusMessage: res.statusMessage }); | ||
resolve({ | ||
statusCode: res.statusCode, | ||
statusMessage: res.statusMessage, | ||
}); | ||
}); | ||
}); | ||
/** Request error event */ | ||
req.on('error', (e) => { | ||
req.on('error', e => { | ||
reject({ | ||
statusCode: 0, | ||
statusMessage: `Problem with request: ${e.message}` | ||
statusMessage: `Problem with request: ${e.message}`, | ||
}); | ||
@@ -108,5 +112,5 @@ }); | ||
spanList.push(this.translateSpan(span)); | ||
// Builds spans data | ||
for (const child of span.spans) { | ||
spanList.push(this.translateSpan(child)); | ||
// Traverse child spans recursively | ||
if (span.spans.length > 0) { | ||
Array.prototype.push.apply(spanList, this.mountSpanList(span.spans)); | ||
} | ||
@@ -134,3 +138,3 @@ } | ||
tags: this.createTags(span.attributes, span.status), | ||
annotations: this.createAnnotations(span.annotations, span.messageEvents) | ||
annotations: this.createAnnotations(span.annotations, span.messageEvents), | ||
}; | ||
@@ -161,11 +165,11 @@ if (span.parentSpanId) { | ||
if (annotationTimedEvents) { | ||
annotations = annotationTimedEvents.map((annotation) => ({ | ||
annotations = annotationTimedEvents.map(annotation => ({ | ||
timestamp: annotation.timestamp * exports.MICROS_PER_MILLI, | ||
value: annotation.description | ||
value: annotation.description, | ||
})); | ||
} | ||
if (messageEventTimedEvents) { | ||
annotations.push(...messageEventTimedEvents.map((messageEvent) => ({ | ||
annotations.push(...messageEventTimedEvents.map(messageEvent => ({ | ||
timestamp: messageEvent.timestamp * exports.MICROS_PER_MILLI, | ||
value: MESSAGE_EVENT_TYPE_TRANSLATION[messageEvent.type] | ||
value: MESSAGE_EVENT_TYPE_TRANSLATION[messageEvent.type], | ||
}))); | ||
@@ -183,3 +187,3 @@ } | ||
const spanList = this.mountSpanList(spans); | ||
return this.sendTraces(spanList).catch((err) => { | ||
return this.sendTraces(spanList).catch(err => { | ||
return err; | ||
@@ -186,0 +190,0 @@ }); |
{ | ||
"name": "@opencensus/exporter-zipkin", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "OpenCensus Zipkin Exporter allows the user to send collected traces with OpenCensus Node.js to Zipkin.", | ||
@@ -55,4 +55,4 @@ "main": "build/src/index.js", | ||
"@types/node": "^10.12.12", | ||
"codecov": "^3.4.0", | ||
"gts": "^0.9.0", | ||
"codecov": "^3.5.0", | ||
"gts": "^1.0.0", | ||
"mocha": "^6.1.0", | ||
@@ -66,4 +66,4 @@ "nock": "^10.0.0", | ||
"dependencies": { | ||
"@opencensus/core": "^0.0.14" | ||
"@opencensus/core": "^0.0.15" | ||
} | ||
} |
26748
311
+ Added@opencensus/core@0.0.15(transitive)
- Removed@opencensus/core@0.0.14(transitive)
Updated@opencensus/core@^0.0.15