SOFATracer Documentation

repository·master·Indexed 22 days ago

https://github.com/sofastack/sofa-tracer

A distributed tracing component that uses a unified traceId to track network calls across microservices. It is OpenTracing compliant, integrates with Zipkin for visualization and SLF4J MDC for logging, and utilizes the Disruptor lock-free ring buffer for high-performance asynchronous logging of summary and statistical logs.

Tokens
829
Snippets
0
Records
4
Agent score
28%

What's inside SOFATracer

  1. What is SOFATracer and its core capabilities

    master

    SOFATracer is a distributed tracing component designed to provide visibility into network calls across distributed systems using a unified traceId. It helps in rapid fault discovery and service governance by recording call chains as logs.

    Key capabilities include:

    • OpenTracing Compliance: Provides a distributed tracing solution based on the OpenTracing specification.
    • High-Performance Asynchronous Logging: Uses the Disruptor lock-free ring buffer to write logs to local disk asynchronously. It supports two log types:
      • Summary Logs (摘要日志): Records every single call to the disk.
      • Statistical Logs (统计日志): Outputs aggregated statistics at specific time intervals.
    • Log Management: Supports automatic log rotation (by hour or day) and self-cleaning (by day).
    • SLF4J MDC Integration: Integrates with SLF4J's Mapped Diagnostic Context (MDC), allowing users to include tracerId and spanId in their logs simply by modifying their logging configuration.
    • Visualization: Supports remote reporting of tracing data to Zipkin for UI-based distributed tracing visualization.
    • Unified Configuration: Offers extensive configuration options to customize application needs.
  2. How to use SLF4J MDC to output tracerId and spanId

    master
    SOFATracer integrates with SLF4J MDC (Mapped Diagnostic Contexts). This allows you to include the current tracing context (tracerId and spanId) in your application logs without changing your code. You only need to update your logging configuration (e.g., Logback or Log4j pattern) to include these MDC keys.
  3. Available SOFATracer usage examples

    master

    The tracer-samples directory in the repository contains several reference implementations for different scenarios. You can find detailed guides for these in the sofa-tracer-guides repository: