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

Commit 2ddf84f

Browse files
eduardoemerykjin
authored andcommitted
refactor: address b3 propagation TODOs (#48)
* refactor: address b3 propagation TODOs * refactor(fix): changes to address review comments
1 parent 952a666 commit 2ddf84f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

packages/opencensus-propagation-b3/src/b3-format.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export class B3Format implements types.Propagation {
3939
* @param getter
4040
*/
4141
extract(getter: types.HeaderGetter): types.SpanContext {
42-
// TODO: Review this logic, maybe make it more robust.
43-
// Question: are this logic valid if any of the getHeader operations returns
44-
// a string[].
4542
if (getter) {
46-
const opt = getter.getHeader(X_B3_SAMPLED);
43+
let opt = getter.getHeader(X_B3_SAMPLED);
44+
if (opt instanceof Array) {
45+
opt = opt[0];
46+
}
4747
const spanContext = {
4848
traceId: getter.getHeader(X_B3_TRACE_ID),
4949
spanId: getter.getHeader(X_B3_SPAN_ID),

0 commit comments

Comments
 (0)