LCOV - code coverage report
Current view: top level - datadog - id_generator.h (source / functions) Hit Total Coverage
Test: filtered.info Lines: 1 1 100.0 %
Date: 2024-01-03 20:30:12 Functions: 1 2 50.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : // This component provides facilities for generating sequences of IDs used as
       4             : // span IDs and trace IDs.
       5             : //
       6             : // `IDGenerator` is an interface for generating trace IDs and span IDs.
       7             : //
       8             : // `default_id_generator` is an `IDGenerator` that produces a thread-local
       9             : // pseudo-random sequence of uniformly distributed 63-bit unsigned integers. The
      10             : // sequence is randomly seeded once per thread and anytime the process forks.
      11             : 
      12             : #include <cstdint>
      13             : #include <memory>
      14             : 
      15             : #include "clock.h"
      16             : #include "trace_id.h"
      17             : 
      18             : namespace datadog {
      19             : namespace tracing {
      20             : 
      21             : class IDGenerator {
      22             :  public:
      23         607 :   virtual ~IDGenerator() = default;
      24             : 
      25             :   // Generate a span ID.
      26             :   virtual std::uint64_t span_id() const = 0;
      27             :   // Generate a trace ID for a trace having the specified `start` time.
      28             :   virtual TraceID trace_id(const TimePoint& start) const = 0;
      29             : };
      30             : 
      31             : std::shared_ptr<const IDGenerator> default_id_generator(bool trace_id_128_bit);
      32             : 
      33             : }  // namespace tracing
      34             : }  // namespace datadog

Generated by: LCOV version 1.16