SamplingResult.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { SpanAttributes } from './attributes';
  2. import { TraceState } from './trace_state';
  3. /**
  4. * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
  5. * A sampling decision that determines how a {@link Span} will be recorded
  6. * and collected.
  7. */
  8. export declare enum SamplingDecision {
  9. /**
  10. * `Span.isRecording() === false`, span will not be recorded and all events
  11. * and attributes will be dropped.
  12. */
  13. NOT_RECORD = 0,
  14. /**
  15. * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags}
  16. * MUST NOT be set.
  17. */
  18. RECORD = 1,
  19. /**
  20. * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags}
  21. * MUST be set.
  22. */
  23. RECORD_AND_SAMPLED = 2
  24. }
  25. /**
  26. * @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
  27. * A sampling result contains a decision for a {@link Span} and additional
  28. * attributes the sampler would like to added to the Span.
  29. */
  30. export interface SamplingResult {
  31. /**
  32. * A sampling decision, refer to {@link SamplingDecision} for details.
  33. */
  34. decision: SamplingDecision;
  35. /**
  36. * The list of attributes returned by SamplingResult MUST be immutable.
  37. * Caller may call {@link Sampler}.shouldSample any number of times and
  38. * can safely cache the returned value.
  39. */
  40. attributes?: Readonly<SpanAttributes>;
  41. /**
  42. * A {@link TraceState} that will be associated with the {@link Span} through
  43. * the new {@link SpanContext}. Samplers SHOULD return the TraceState from
  44. * the passed-in {@link Context} if they do not intend to change it. Leaving
  45. * the value undefined will also leave the TraceState unchanged.
  46. */
  47. traceState?: TraceState;
  48. }
  49. //# sourceMappingURL=SamplingResult.d.ts.map