@opencensus/propagation-b3
Version:
Opencensus propagation package for B3 format.
44 lines (43 loc) • 1.66 kB
TypeScript
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HeaderGetter, HeaderSetter, Propagation, SpanContext } from '@opencensus/core';
export declare const X_B3_TRACE_ID = "x-b3-traceid";
export declare const X_B3_SPAN_ID = "x-b3-spanid";
export declare const X_B3_PARENT_SPAN_ID = "x-b3-parentspanid";
export declare const X_B3_SAMPLED = "x-b3-sampled";
export declare const SAMPLED_VALUE = 1;
export declare const NOT_SAMPLED_VALUE = 0;
/** Propagates span context through B3 Format propagation. */
export declare class B3Format implements Propagation {
/**
* Gets the trace context from a request headers. If there is no trace context
* in the headers, null is returned.
* @param getter
*/
extract(getter: HeaderGetter): SpanContext | null;
/**
* Adds a trace context in a request headers.
* @param setter
* @param spanContext
*/
inject(setter: HeaderSetter, spanContext: SpanContext): void;
/**
* Generate SpanContexts
*/
generate(): SpanContext;
/** Converts a headers type to a string. */
private parseHeader;
}