Skip to content

Commit 0e4e4f6

Browse files
committed
chore: add fields operation to TextMapPropagator (open-telemetry#1615)
1 parent c7ec46a commit 0e4e4f6

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

api/src/context/propagation/NoopTextMapPropagator.ts

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export class NoopTextMapPropagator implements TextMapPropagator {
2727
extract(context: Context, carrier: unknown): Context {
2828
return context;
2929
}
30+
fields(): string[] {
31+
return [];
32+
}
3033
}
3134

3235
export const NOOP_TEXT_MAP_PROPAGATOR = new NoopTextMapPropagator();

api/src/context/propagation/TextMapPropagator.ts

+8
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ export interface TextMapPropagator<Carrier = any> {
6464
carrier: Carrier,
6565
getter: TextMapGetter<Carrier>
6666
): Context;
67+
68+
/**
69+
* Return a list of all fields which may be used by the propagator.
70+
*
71+
* This list should be used to clear fields before calling inject if a carrier is
72+
* used more than once.
73+
*/
74+
fields(): string[];
6775
}
6876

6977
/**

0 commit comments

Comments
 (0)