@opencensus/propagation-stackdriver
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -31,8 +31,11 @@ "use strict"; | ||
inject: v1API.inject, | ||
generate: v1API.generate | ||
generate: v1API.generate, | ||
}; | ||
// Also export the v1 API as the default API. | ||
// tslint:disable-next-line:deprecation | ||
exports.extract = exports.v1.extract; | ||
// tslint:disable-next-line:deprecation | ||
exports.inject = exports.v1.inject; | ||
// tslint:disable-next-line:deprecation | ||
exports.generate = exports.v1.generate; | ||
//# sourceMappingURL=index.js.map |
@@ -53,3 +53,5 @@ "use strict"; | ||
const matches = traceContextHeader.match(/^([0-9a-fA-F]+)(?:\/([0-9]+))(?:;o=(.*))?/); | ||
if (!matches || matches.length !== 4 || matches[0] !== traceContextHeader || | ||
if (!matches || | ||
matches.length !== 4 || | ||
matches[0] !== traceContextHeader || | ||
(matches[2] && isNaN(Number(matches[2])))) { | ||
@@ -63,3 +65,3 @@ return null; | ||
spanId: `0000000000000000${hex2dec_1.decToHex(matches[2]).slice(2)}`.slice(-16), | ||
options: isNaN(Number(matches[3])) ? TRACE_TRUE : Number(matches[3]) | ||
options: isNaN(Number(matches[3])) ? TRACE_TRUE : Number(matches[3]), | ||
}; | ||
@@ -84,3 +86,3 @@ } | ||
spanId: spanRandomBuffer().toString('hex'), | ||
options: TRACE_TRUE | ||
options: TRACE_TRUE, | ||
}; | ||
@@ -97,5 +99,5 @@ } | ||
const randomBytes = crypto.randomBytes; | ||
const spanRandomBuffer = randomFillSync ? | ||
() => randomFillSync(spanIdBuffer) : | ||
() => randomBytes(SPAN_ID_RANDOM_BYTES); | ||
const spanRandomBuffer = randomFillSync | ||
? () => randomFillSync(spanIdBuffer) | ||
: () => randomBytes(SPAN_ID_RANDOM_BYTES); | ||
//# sourceMappingURL=stackdriver-format.js.map |
@@ -32,3 +32,5 @@ "use strict"; | ||
const matches = str.match(/^([0-9a-fA-F]+)(?:\/([0-9]+))(?:;o=(.*))?/); | ||
if (!matches || matches.length !== 4 || matches[0] !== str || | ||
if (!matches || | ||
matches.length !== 4 || | ||
matches[0] !== str || | ||
(matches[2] && isNaN(Number(matches[2])))) { | ||
@@ -42,3 +44,3 @@ return null; | ||
spanId: `0000000000000000${hex2dec_1.decToHex(matches[2]).slice(2)}`.slice(-16), | ||
options: isNaN(Number(matches[3])) ? undefined : Number(matches[3]) | ||
options: isNaN(Number(matches[3])) ? undefined : Number(matches[3]), | ||
}; | ||
@@ -71,9 +73,12 @@ } | ||
const randomBytes = crypto.randomBytes; | ||
const spanRandomBuffer = randomFillSync ? | ||
() => randomFillSync(spanIdBuffer) : | ||
() => randomBytes(SPAN_ID_RANDOM_BYTES); | ||
const spanRandomBuffer = randomFillSync | ||
? () => randomFillSync(spanIdBuffer) | ||
: () => randomBytes(SPAN_ID_RANDOM_BYTES); | ||
function generate() { | ||
return { | ||
traceId: uuid.v4().split('-').join(''), | ||
spanId: spanRandomBuffer().toString('hex') | ||
traceId: uuid | ||
.v4() | ||
.split('-') | ||
.join(''), | ||
spanId: spanRandomBuffer().toString('hex'), | ||
}; | ||
@@ -80,0 +85,0 @@ } |
{ | ||
"name": "@opencensus/propagation-stackdriver", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Opencensus propagation package for Stackdriver format.", | ||
@@ -32,4 +32,4 @@ "main": "build/src/index.js", | ||
"@types/uuid": "^3.4.3", | ||
"codecov": "^3.4.0", | ||
"gts": "^0.9.0", | ||
"codecov": "^3.5.0", | ||
"gts": "^1.0.0", | ||
"mocha": "^6.1.0", | ||
@@ -41,3 +41,3 @@ "nyc": "^14.0.0", | ||
"dependencies": { | ||
"@opencensus/core": "^0.0.14", | ||
"@opencensus/core": "^0.0.15", | ||
"hex2dec": "^1.0.1", | ||
@@ -44,0 +44,0 @@ "uuid": "^3.2.1" |
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
31302
326
+ Added@opencensus/core@0.0.15(transitive)
- Removed@opencensus/core@0.0.14(transitive)
Updated@opencensus/core@^0.0.15