Options
All
  • Public
  • Public/Protected
  • All
Menu

EnvoyContext is where all information related to the current envoy environment.

Hierarchy

  • EnvoyContext

Index

Constructors

constructor

Properties

Optional Readonly clientTraceId

clientTraceId: undefined | string

If an external client sets this header, Envoy will join the provided trace ID with the internally generated x-request-id.

Private Readonly directMode

directMode: boolean

For dev or test environment, we usually don't have Envoy running. By setting directMode = true will make all the traffic being sent directly. If you set directMode to true, envoyManagedHosts will be ignored and set to an empty set.

Readonly envoyEgressAddr

envoyEgressAddr: string

the bind address of envoy egress

Readonly envoyEgressPort

envoyEgressPort: number

The port local Envoy listening on for egress traffic. (So all the egress will be sent to that port)

Private Optional Readonly envoyManagedHosts

envoyManagedHosts: Set<string>

For easier migrate service to envoy step by step, we can route traffic to envoy for those service migrated. Fill this set for the migrated service. This field is default to undefined which means all traffic will be route to envoy. If this field is set to undefined, this library will also try to read it from x-tubi-envoy-managed-host. You can set in envoy config, like this:

request_headers_to_add:
- key: x-tubi-envoy-managed-host
  value: hostname:12345
- key: x-tubi-envoy-managed-host
  value: foo.bar:8080

If you set this to be an empty set, then no traffic will be route to envoy.

Optional Readonly expectedRequestTimeout

expectedRequestTimeout: undefined | number

This is the time in milliseconds the router expects the request to be completed. Envoy sets this header so that the upstream host receiving the request can make decisions based on the request timeout, e.g., early exit. This is set on internal requests and is either taken from the x-envoy-upstream-rq-timeout-ms header or the route timeout, in that order.

Optional Readonly flags

flags: undefined | string

The x-b3-flags HTTP header is used by the Zipkin tracer in Envoy. The encode one or more options. For example, Debug is encoded as X-B3-Flags: 1. See more on zipkin tracing here https://github.com/openzipkin/b3-propagation.

Optional Readonly otSpanContext

otSpanContext: undefined | string

The x-ot-span-context HTTP header is used by Envoy to establish proper parent-child relationships between tracing spans. This header can be used with both LightStep and Zipkin tracers. For example, an egress span is a child of an ingress span (if the ingress span was present). Envoy injects the x-ot-span-context header on ingress requests and forwards it to the local service. Envoy relies on the application to propagate x-ot-span-context on the egress call to an upstream. See more on tracing here https://www.envoyproxy.io/docs/envoy/v1.5.0/intro/arch_overview/tracing.html#arch-overview-tracing.

Optional Readonly parentSpanId

parentSpanId: undefined | string

The x-b3-parentspanid HTTP header is used by the Zipkin tracer in Envoy. The ParentSpanId is 64-bit in length and indicates the position of the parent operation in the trace tree. When the span is the root of the trace tree, the ParentSpanId is absent. See more on zipkin tracing here https://github.com/openzipkin/b3-propagation.

Optional Readonly requestId

requestId: undefined | string

The x-request-id header is used by Envoy to uniquely identify a request as well as perform stable access logging and tracing. Envoy will generate an x-request-id header for all external origin requests (the header is sanitized). It will also generate an x-request-id header for internal requests that do not already have one. This means that x-request-id can and should be propagated between client applications in order to have stable IDs across the entire mesh. Due to the out of process architecture of Envoy, the header can not be automatically forwarded by Envoy itself. This is one of the few areas where a thin client library is needed to perform this duty. How that is done is out of scope for this documentation. If x-request-id is propagated across all hosts, the following features are available:

  • Stable access logging via the v1 API runtime filter or the v2 API runtime filter.
  • Stable tracing when performing random sampling via the tracing.random_sampling runtime setting or via forced tracing using the x-envoy-force-trace and x-client-trace-id headers.

Optional Readonly sampled

sampled: undefined | string

The x-b3-sampled HTTP header is used by the Zipkin tracer in Envoy. When the Sampled flag is 1, the soan will be reported to the tracing system. Once Sampled is set to 0 or 1, the same value should be consistently sent downstream. See more on zipkin tracing here https://github.com/openzipkin/b3-propagation.

Optional Readonly spanId

spanId: undefined | string

The x-b3-spanid HTTP header is used by the Zipkin tracer in Envoy. The SpanId is 64-bit in length and indicates the position of the current operation in the trace tree. The value should not be interpreted: it may or may not be derived from the value of the TraceId. See more on zipkin tracing here https://github.com/openzipkin/b3-propagation.

Optional Readonly traceId

traceId: undefined | string

The x-b3-traceid HTTP header is used by the Zipkin tracer in Envoy. The TraceId is 64-bit in length and indicates the overall ID of the trace. Every span in a trace shares this ID. See more on zipkin tracing here https://github.com/openzipkin/b3-propagation.

Methods

assembleTracingHeader

shouldCallWithoutEnvoy

  • shouldCallWithoutEnvoy(host: string): boolean

Legend

  • Constructor
  • Property
  • Method
  • Private property
  • Private method
  • Property
  • Inherited property

Generated using TypeDoc