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

Propagation/B3: Enforce strictNullChecks and noUnusedLocals #421

Conversation

mayurkale22
Copy link
Member

This is part of #348 and #340

@codecov-io
Copy link

codecov-io commented Mar 13, 2019

Codecov Report

Merging #421 into master will increase coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #421      +/-   ##
==========================================
+ Coverage   94.81%   94.86%   +0.05%     
==========================================
  Files         136      136              
  Lines        9000     9042      +42     
  Branches      666      665       -1     
==========================================
+ Hits         8533     8578      +45     
+ Misses        467      464       -3
Impacted Files Coverage Δ
test/test-b3-format.ts 97.33% <0%> (-2.67%) ⬇️
src/validators.ts 100% <0%> (ø) ⬆️
src/stackdriver-monitoring.ts 83.33% <0%> (+3.12%) ⬆️
src/b3-format.ts 96.96% <0%> (+8.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3111ab8...9b0f8ad. Read the comment docs.

return null;
const opt = this.parseHeader(getter.getHeader(X_B3_SAMPLED));
return {
traceId: this.parseHeader(getter.getHeader(X_B3_TRACE_ID)),
Copy link
Contributor

@kjin kjin Mar 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC the extract method should return null if there is no incoming traceID/spanID, rather than fill an object with empty strings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is valid point, I have changed the implementation to return null in case of no incoming traceID/spanID.

} else {
setter.setHeader(X_B3_SAMPLED, `${NOT_SAMPLED_VALUE}`);
}
setter.setHeader(X_B3_TRACE_ID, spanContext.traceId || '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a similar note as above, I'm not sure if we should be writing an empty value to a header. That being said the SpanContext interface should guarantee that traceId and spanId are not blank.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, does not make sense to write empty values to a header. Added check for the same. PTAL

@@ -0,0 +1,72 @@
/**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayurkale22
Copy link
Member Author

@kjin Please take a look again once you have time.

@mayurkale22 mayurkale22 merged commit 6e666d3 into census-instrumentation:master Mar 15, 2019
@mayurkale22 mayurkale22 deleted the enforce_strictNullcheck_b3 branch March 15, 2019 20:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants