Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Commit 08a1dd6

Browse files
renovate[bot]Benjamin E. Coe
authored andcommitted
fix(deps): update dependency @opencensus/propagation-stackdriver to v0.0.14 (#1045)
1 parent 0f0c916 commit 08a1dd6

14 files changed

Lines changed: 33 additions & 71 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
},
9595
"dependencies": {
9696
"@google-cloud/common": "^2.0.0",
97-
"@opencensus/propagation-stackdriver": "0.0.13",
97+
"@opencensus/propagation-stackdriver": "0.0.14",
9898
"builtin-modules": "^3.0.0",
9999
"console-log-level": "^1.4.0",
100100
"continuation-local-storage": "^3.2.1",

src/cls.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ export class TraceCLS implements CLS<RootContext> {
119119
case TraceCLSMechanism.ASYNC_HOOKS:
120120
if (!asyncHooksAvailable) {
121121
throw new Error(
122-
`CLS mechanism [${
123-
config.mechanism
124-
}] is not compatible with Node <8.`
122+
`CLS mechanism [${config.mechanism}] is not compatible with Node <8.`
125123
);
126124
}
127125
this.CLSClass = AsyncHooksCLS;

src/plugins/plugin-http.ts

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -228,27 +228,23 @@ function patchHttp(http: HttpModule, api: Tracer) {
228228
if (semver.satisfies(process.version, '>=8.0.0')) {
229229
// http.get in Node 8 calls the private copy of request rather than the one
230230
// we have patched on module.export, so patch get as well.
231-
shimmer.wrap(
232-
http,
233-
'get',
234-
(): typeof http.get => {
235-
// Re-implement http.get. This needs to be done (instead of using
236-
// makeRequestTrace to patch it) because we need to set the trace
237-
// context header before the returned ClientRequest is ended.
238-
// The Node.js docs state that the only differences between request and
239-
// get are that (1) get defaults to the HTTP GET method and (2) the
240-
// returned request object is ended immediately.
241-
// The former is already true (at least in supported Node versions up to
242-
// v9), so we simply follow the latter.
243-
// Ref:
244-
// https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback
245-
return function getTrace(options, callback) {
246-
const req = http.request(options, callback);
247-
req.end();
248-
return req;
249-
};
250-
}
251-
);
231+
shimmer.wrap(http, 'get', (): typeof http.get => {
232+
// Re-implement http.get. This needs to be done (instead of using
233+
// makeRequestTrace to patch it) because we need to set the trace
234+
// context header before the returned ClientRequest is ended.
235+
// The Node.js docs state that the only differences between request and
236+
// get are that (1) get defaults to the HTTP GET method and (2) the
237+
// returned request object is ended immediately.
238+
// The former is already true (at least in supported Node versions up to
239+
// v9), so we simply follow the latter.
240+
// Ref:
241+
// https://nodejs.org/dist/latest/docs/api/http.html#http_http_get_options_callback
242+
return function getTrace(options, callback) {
243+
const req = http.request(options, callback);
244+
req.end();
245+
return req;
246+
};
247+
});
252248
}
253249
}
254250

src/trace-api.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ export class StackdriverTracer implements Tracer {
201201
const rootSpan = cls.get().getContext();
202202
if (rootSpan.type === SpanType.ROOT && !rootSpan.span.endTime) {
203203
this.logger!.warn(
204-
`TraceApi#runInRootSpan: [${
205-
this.pluginNameToLog
206-
}] Cannot create nested root spans.`
204+
`TraceApi#runInRootSpan: [${this.pluginNameToLog}] Cannot create nested root spans.`
207205
);
208206
return fn(UNCORRELATED_ROOT_SPAN);
209207
}
@@ -319,11 +317,7 @@ export class StackdriverTracer implements Tracer {
319317
// seems to have some value, but isn't representable. The user probably
320318
// needs a custom outer span that encompasses the entirety of work.
321319
this.logger!.warn(
322-
`TraceApi#createChildSpan: [${
323-
this.pluginNameToLog
324-
}] Creating phantom child span [${options.name}] because root span [${
325-
rootSpan.span.name
326-
}] was already closed.`
320+
`TraceApi#createChildSpan: [${this.pluginNameToLog}] Creating phantom child span [${options.name}] because root span [${rootSpan.span.name}] was already closed.`
327321
);
328322
return UNCORRELATED_CHILD_SPAN;
329323
}
@@ -385,9 +379,7 @@ export class StackdriverTracer implements Tracer {
385379
skipFrames: options.skipFrames ? options.skipFrames + 1 : 1,
386380
});
387381
this.logger!.info(
388-
`TraceApi#createChildSpan: [${
389-
this.pluginNameToLog
390-
}] Created child span [${options.name}]`
382+
`TraceApi#createChildSpan: [${this.pluginNameToLog}] Created child span [${options.name}]`
391383
);
392384
return childContext;
393385
} else if (rootSpan.type === SpanType.UNSAMPLED) {
@@ -398,11 +390,7 @@ export class StackdriverTracer implements Tracer {
398390
} else {
399391
// Context was lost.
400392
this.logger!.warn(
401-
`TraceApi#createChildSpan: [${
402-
this.pluginNameToLog
403-
}] Creating phantom child span [${
404-
options.name
405-
}] because there is no root span.`
393+
`TraceApi#createChildSpan: [${this.pluginNameToLog}] Creating phantom child span [${options.name}] because there is no root span.`
406394
);
407395
return UNCORRELATED_CHILD_SPAN;
408396
}

src/trace-plugin-loader.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,7 @@ export class PluginLoader {
518518
}
519519
} catch (e) {
520520
this.logger.error(
521-
`PluginLoader#getVersion: [${pjsonPath}] An error occurred while retrieving version string. ${
522-
e.message
523-
}`
521+
`PluginLoader#getVersion: [${pjsonPath}] An error occurred while retrieving version string. ${e.message}`
524522
);
525523
version = null;
526524
}

test/plugins/test-cls-bluebird.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,7 @@ describe('Patch plugin for bluebird', () => {
163163

164164
// tslint:disable-next-line:no-any
165165
testCases.forEach((testCase: TestCase<any>) => {
166-
it(`enables context propagation in the same way as native promises for test case: ${
167-
testCase.description
168-
}`, async () => {
166+
it(`enables context propagation in the same way as native promises for test case: ${testCase.description}`, async () => {
169167
const actual = (await getTracesForPromiseImplementation(
170168
testCase.makePromise,
171169
testCase.thenFn

test/plugins/test-trace-http.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ for (const nodule of Object.keys(servers) as Array<keyof typeof servers>) {
249249
});
250250

251251
for (const testCase of testCases) {
252-
it(`creates spans with accurate timespans when ${
253-
testCase.description
254-
}`, async () => {
252+
it(`creates spans with accurate timespans when ${testCase.description}`, async () => {
255253
let recordedTime = 0;
256254
await testTraceModule
257255
.get()

test/test-cls-ah.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,7 @@ maybeSkip(describe)('AsyncHooks-based CLS', () => {
200200
for (const testCase of testCases) {
201201
const skipIfTestSpecifies = !!testCase.skip ? it.skip : it;
202202
skipIfTestSpecifies(
203-
`Doesn't retain stale references when running ${
204-
testCase.description
205-
} in a context`,
203+
`Doesn't retain stale references when running ${testCase.description} in a context`,
206204
async () => {
207205
createdPromiseIDs.length = 0;
208206
try {

test/utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ export function assertSpanDuration(span: TraceSpan, bounds: [number, number?]) {
8585
assert.ok(
8686
spanDuration >= lowerBound - ASSERT_SPAN_TIME_TOLERANCE_MS &&
8787
spanDuration <= upperBound + ASSERT_SPAN_TIME_TOLERANCE_MS,
88-
`Span duration of ${spanDuration} ms is not in the acceptable expected range of [${
89-
bounds[0]
90-
}, ${bounds[1]}] ms (w/ ${ASSERT_SPAN_TIME_TOLERANCE_MS} ms leniency)`
88+
`Span duration of ${spanDuration} ms is not in the acceptable expected range of [${bounds[0]}, ${bounds[1]}] ms (w/ ${ASSERT_SPAN_TIME_TOLERANCE_MS} ms leniency)`
9189
);
9290
}
9391

test/web-frameworks/connect.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ export class Connect3 implements WebFramework {
4040
addHandler(options: WebFrameworkAddHandlerOptions): void {
4141
if (!options.hasResponse && !options.blocking) {
4242
throw new Error(
43-
`${
44-
this.constructor.name
45-
} wrapper for testing doesn't support non-blocking handlers.`
43+
`${this.constructor.name} wrapper for testing doesn't support non-blocking handlers.`
4644
);
4745
}
4846
this.app.use(

0 commit comments

Comments
 (0)