UNPKG

2.02 kBTypeScriptView Raw
1import { baggageEntryMetadataSymbol } from './internal/symbol';
2export interface BaggageEntry {
3 /** `String` value of the `BaggageEntry`. */
4 value: string;
5 /**
6 * Metadata is an optional string property defined by the W3C baggage specification.
7 * It currently has no special meaning defined by the specification.
8 */
9 metadata?: BaggageEntryMetadata;
10}
11/**
12 * Serializable Metadata defined by the W3C baggage specification.
13 * It currently has no special meaning defined by the OpenTelemetry or W3C.
14 */
15export declare type BaggageEntryMetadata = {
16 toString(): string;
17} & {
18 __TYPE__: typeof baggageEntryMetadataSymbol;
19};
20/**
21 * Baggage represents collection of key-value pairs with optional metadata.
22 * Each key of Baggage is associated with exactly one value.
23 * Baggage may be used to annotate and enrich telemetry data.
24 */
25export interface Baggage {
26 /**
27 * Get an entry from Baggage if it exists
28 *
29 * @param key The key which identifies the BaggageEntry
30 */
31 getEntry(key: string): BaggageEntry | undefined;
32 /**
33 * Get a list of all entries in the Baggage
34 */
35 getAllEntries(): [string, BaggageEntry][];
36 /**
37 * Returns a new baggage with the entries from the current bag and the specified entry
38 *
39 * @param key string which identifies the baggage entry
40 * @param entry BaggageEntry for the given key
41 */
42 setEntry(key: string, entry: BaggageEntry): Baggage;
43 /**
44 * Returns a new baggage with the entries from the current bag except the removed entry
45 *
46 * @param key key identifying the entry to be removed
47 */
48 removeEntry(key: string): Baggage;
49 /**
50 * Returns a new baggage with the entries from the current bag except the removed entries
51 *
52 * @param key keys identifying the entries to be removed
53 */
54 removeEntries(...key: string[]): Baggage;
55 /**
56 * Returns a new baggage with no entries
57 */
58 clear(): Baggage;
59}
60//# sourceMappingURL=types.d.ts.map
\No newline at end of file