propagation.d.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { Context } from '../context/types';
  2. import { TextMapGetter, TextMapPropagator, TextMapSetter } from '../propagation/TextMapPropagator';
  3. import { getBaggage, getActiveBaggage, setBaggage, deleteBaggage } from '../baggage/context-helpers';
  4. import { createBaggage } from '../baggage/utils';
  5. /**
  6. * Singleton object which represents the entry point to the OpenTelemetry Propagation API
  7. */
  8. export declare class PropagationAPI {
  9. private static _instance?;
  10. /** Empty private constructor prevents end users from constructing a new instance of the API */
  11. private constructor();
  12. /** Get the singleton instance of the Propagator API */
  13. static getInstance(): PropagationAPI;
  14. /**
  15. * Set the current propagator.
  16. *
  17. * @returns true if the propagator was successfully registered, else false
  18. */
  19. setGlobalPropagator(propagator: TextMapPropagator): boolean;
  20. /**
  21. * Inject context into a carrier to be propagated inter-process
  22. *
  23. * @param context Context carrying tracing data to inject
  24. * @param carrier carrier to inject context into
  25. * @param setter Function used to set values on the carrier
  26. */
  27. inject<Carrier>(context: Context, carrier: Carrier, setter?: TextMapSetter<Carrier>): void;
  28. /**
  29. * Extract context from a carrier
  30. *
  31. * @param context Context which the newly created context will inherit from
  32. * @param carrier Carrier to extract context from
  33. * @param getter Function used to extract keys from a carrier
  34. */
  35. extract<Carrier>(context: Context, carrier: Carrier, getter?: TextMapGetter<Carrier>): Context;
  36. /**
  37. * Return a list of all fields which may be used by the propagator.
  38. */
  39. fields(): string[];
  40. /** Remove the global propagator */
  41. disable(): void;
  42. createBaggage: typeof createBaggage;
  43. getBaggage: typeof getBaggage;
  44. getActiveBaggage: typeof getActiveBaggage;
  45. setBaggage: typeof setBaggage;
  46. deleteBaggage: typeof deleteBaggage;
  47. private _getGlobalPropagator;
  48. }
  49. //# sourceMappingURL=propagation.d.ts.map