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

          Line data    Source code
       1             : #include "span_defaults.h"
       2             : 
       3             : #include "json.hpp"
       4             : 
       5             : namespace datadog {
       6             : namespace tracing {
       7             : 
       8           1 : bool operator==(const SpanDefaults& left, const SpanDefaults& right) {
       9             : #define EQ(FIELD) left.FIELD == right.FIELD
      10           3 :   return EQ(service) && EQ(service_type) && EQ(environment) && EQ(version) &&
      11           3 :          EQ(name) && EQ(tags);
      12             : #undef EQ
      13             : }
      14             : 
      15         503 : nlohmann::json to_json(const SpanDefaults& defaults) {
      16         503 :   auto result = nlohmann::json::object({});
      17             : #define TO_JSON(FIELD) \
      18             :   if (!defaults.FIELD.empty()) result[#FIELD] = defaults.FIELD
      19         503 :   TO_JSON(service);
      20         503 :   TO_JSON(service_type);
      21         503 :   TO_JSON(environment);
      22         503 :   TO_JSON(version);
      23         503 :   TO_JSON(name);
      24         503 :   TO_JSON(tags);
      25             : #undef TO_JSON
      26         503 :   return result;
      27           0 : }
      28             : 
      29             : }  // namespace tracing
      30             : }  // namespace datadog

Generated by: LCOV version 1.16