CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
TextMapPropagator.d.ts84 linesDownload Raw Back to propagation
1import { Context } from '../context/types';2/**3 * Injects `Context` into and extracts it from carriers that travel4 * in-band across process boundaries. Encoding is expected to conform to the5 * HTTP Header Field semantics. Values are often encoded as RPC/HTTP request6 * headers.7 *8 * The carrier of propagated data on both the client (injector) and server9 * (extractor) side is usually an object such as http headers. Propagation is10 * usually implemented via library-specific request interceptors, where the11 * client-side injects values and the server-side extracts them.12 */13export interface TextMapPropagator<Carrier = any> {14    /**15     * Injects values from a given `Context` into a carrier.16     *17     * OpenTelemetry defines a common set of format values (TextMapPropagator),18     * and each has an expected `carrier` type.19     *20     * @param context the Context from which to extract values to transmit over21     *     the wire.22     * @param carrier the carrier of propagation fields, such as http request23     *     headers.24     * @param setter an optional {@link TextMapSetter}. If undefined, values will be25     *     set by direct object assignment.26     */27    inject(context: Context, carrier: Carrier, setter: TextMapSetter<Carrier>): void;28    /**29     * Given a `Context` and a carrier, extract context values from a30     * carrier and return a new context, created from the old context, with the31     * extracted values.32     *33     * @param context the Context from which to extract values to transmit over34     *     the wire.35     * @param carrier the carrier of propagation fields, such as http request36     *     headers.37     * @param getter an optional {@link TextMapGetter}. If undefined, keys will be all38     *     own properties, and keys will be accessed by direct object access.39     */40    extract(context: Context, carrier: Carrier, getter: TextMapGetter<Carrier>): Context;41    /**42     * Return a list of all fields which may be used by the propagator.43     */44    fields(): string[];45}46/**47 * A setter is specified by the caller to define a specific method48 * to set key/value pairs on the carrier within a propagator.49 */50export interface TextMapSetter<Carrier = any> {51    /**52     * Callback used to set a key/value pair on an object.53     *54     * Should be called by the propagator each time a key/value pair55     * should be set, and should set that key/value pair on the propagator.56     *57     * @param carrier object or class which carries key/value pairs58     * @param key string key to modify59     * @param value value to be set to the key on the carrier60     */61    set(carrier: Carrier, key: string, value: string): void;62}63/**64 * A getter is specified by the caller to define a specific method65 * to get the value of a key from a carrier.66 */67export interface TextMapGetter<Carrier = any> {68    /**69     * Get a list of all keys available on the carrier.70     *71     * @param carrier72     */73    keys(carrier: Carrier): string[];74    /**75     * Get the value of a specific key from the carrier.76     *77     * @param carrier78     * @param key79     */80    get(carrier: Carrier, key: string): undefined | string | string[];81}82export declare const defaultTextMapGetter: TextMapGetter;83export declare const defaultTextMapSetter: TextMapSetter;84//# sourceMappingURL=TextMapPropagator.d.ts.map
basant307/AI_Governance_Project · CoolFace