Skip to content

Instantly share code, notes, and snippets.

@notionquest
Last active June 22, 2020 13:32
Show Gist options
  • Save notionquest/1c1c1e3377dcbba9f76076de42270b8e to your computer and use it in GitHub Desktop.
Save notionquest/1c1c1e3377dcbba9f76076de42270b8e to your computer and use it in GitHub Desktop.
Distributed_Logging.md

Distributed Logging:-

B3 Propogation:-

https://github.com/openzipkin/b3-propagation

B3 Propagation is a specification for the header "b3" and those that start with "x-b3-". These headers are used for trace context propagation across service boundaries.

Span Id:-

https://opentracing.io/docs/overview/spans/

The “span” is the primary building block of a distributed trace, representing an individual unit of work done in a distributed system.

Trace Id:-

Bagging Item:-

These are key:value pairs that cross process-boundaries.

Spring Cloud Sleuth:-

Sleuth provides distributed tracing mechanism.

  • Trace data reported to Zipkin server
  • Traces connect from service to service using header propagation. The default format is B3

What is Sampling?

Sampling only applies to tracing backends, such as Zipkin. Trace IDs appear in logs regardless of sample rate. Sampling is a way to prevent overloading the system, by consistently tracing some, but not all requests.

Span Lifecycle:-

  • Start
  • Close
  • Continue
  • Detach
  • Create with explicit parent

Span Name:-

Picking a span name is not a trivial task. A span name should depict an operation name. The name should be low cardinality, so it should not include identifiers.

Use @SpanName annotation

Sending Span to ZipKin:-

By default, if you add spring-cloud-starter-zipkin as a dependency to your project, when the span is closed, it is sent to Zipkin over HTTP.

Open Tracing:-

Easy integration with OpenTracing

References:-

https://cloud.spring.io/spring-cloud-sleuth/reference/html/#span-lifecycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment