UNPKG

1.66 kBTypeScriptView Raw
1/**
2 * Copyright 2018, OpenCensus Authors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { HeaderGetter, HeaderSetter, Propagation, SpanContext } from '@opencensus/core';
17export declare const X_B3_TRACE_ID = "x-b3-traceid";
18export declare const X_B3_SPAN_ID = "x-b3-spanid";
19export declare const X_B3_PARENT_SPAN_ID = "x-b3-parentspanid";
20export declare const X_B3_SAMPLED = "x-b3-sampled";
21export declare const SAMPLED_VALUE = 1;
22export declare const NOT_SAMPLED_VALUE = 0;
23/** Propagates span context through B3 Format propagation. */
24export declare class B3Format implements Propagation {
25 /**
26 * Gets the trace context from a request headers. If there is no trace context
27 * in the headers, null is returned.
28 * @param getter
29 */
30 extract(getter: HeaderGetter): SpanContext | null;
31 /**
32 * Adds a trace context in a request headers.
33 * @param setter
34 * @param spanContext
35 */
36 inject(setter: HeaderSetter, spanContext: SpanContext): void;
37 /**
38 * Generate SpanContexts
39 */
40 generate(): SpanContext;
41 /** Converts a headers type to a string. */
42 private parseHeader;
43}