Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
fix: don't attempt to propagate a null span. (#120)
Browse files Browse the repository at this point in the history
Strictly this should not happen, we should always get a spanContext,
however, this is not currently the case.
  • Loading branch information
tcolgate authored and kjin committed Sep 4, 2018
1 parent 073ddb4 commit 209beba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/opencensus-instrumentation-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,11 @@ export class HttpPlugin extends BasePlugin {
return (span: Span): httpModule.ClientRequest => {
plugin.logger.debug('makeRequestTrace');

if (!span) {
plugin.logger.debug('makeRequestTrace span is null');
return request;
}

const setter: HeaderSetter = {
setHeader(name: string, value: string) {
request.setHeader(name, value);
Expand All @@ -267,11 +272,6 @@ export class HttpPlugin extends BasePlugin {
propagation.inject(setter, span.spanContext);
}

if (!span) {
plugin.logger.debug('makeRequestTrace span is null');
return request;
}

request.on('response', (response: httpModule.ClientResponse) => {
plugin.tracer.wrapEmitter(response);
plugin.logger.debug('outgoingRequest on response()');
Expand Down

0 comments on commit 209beba

Please sign in to comment.