LCOV - code coverage report
Current view: top level - source/extensions/tracers/opentelemetry - span_context.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 6 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 6 0.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <cstdint>
       4             : #include <string>
       5             : 
       6             : #include "absl/strings/string_view.h"
       7             : 
       8             : namespace Envoy {
       9             : namespace Extensions {
      10             : namespace Tracers {
      11             : namespace OpenTelemetry {
      12             : 
      13             : /**
      14             :  * This class represents the context of an OpenTelemetry span, including the following
      15             :  * characteristics: trace id, span id, parent id, and trace flags.
      16             :  */
      17             : class SpanContext {
      18             : public:
      19             :   /*
      20             :    * Default constructor creates an empty context.
      21             :    */
      22             :   SpanContext() = default;
      23             : 
      24             :   /*
      25             :    * Constructor that creates a context object from the supplied attributes.
      26             :    */
      27             :   SpanContext(const absl::string_view& version, const absl::string_view& trace_id,
      28             :               const absl::string_view& parent_id, bool sampled, const absl::string_view& tracestate)
      29             :       : version_(version), trace_id_(trace_id), parent_id_(parent_id), sampled_(sampled),
      30           0 :         tracestate_(tracestate) {}
      31             : 
      32             :   /**
      33             :    * @return the span's version as a hex string.
      34             :    */
      35           0 :   const std::string& version() const { return version_; }
      36             : 
      37             :   /**
      38             :    * @return the span's parent id as a hex string.
      39             :    */
      40           0 :   const std::string& parentId() const { return parent_id_; }
      41             : 
      42             :   /**
      43             :    * @return the trace id as an integer.
      44             :    */
      45           0 :   const std::string& traceId() const { return trace_id_; }
      46             : 
      47             :   /**
      48             :    * @return the sampled flag.
      49             :    */
      50           0 :   bool sampled() const { return sampled_; }
      51             : 
      52             :   /**
      53             :    * @return the parsed tracestate header.
      54             :    */
      55           0 :   const std::string& tracestate() const { return tracestate_; }
      56             : 
      57             : private:
      58             :   const std::string version_;
      59             :   const std::string trace_id_;
      60             :   const std::string parent_id_;
      61             :   const bool sampled_{false};
      62             :   const std::string tracestate_;
      63             : };
      64             : 
      65             : } // namespace OpenTelemetry
      66             : } // namespace Tracers
      67             : } // namespace Extensions
      68             : } // namespace Envoy

Generated by: LCOV version 1.15