• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

llnl / dftracer-utils / 26195612357

20 May 2026 11:19PM UTC coverage: 49.859% (-2.3%) from 52.2%
26195612357

push

github

hariharan-devarajan
feat(aggregator): improve system metrics scanning and persistence error handling

16041 of 43831 branches covered (36.6%)

Branch coverage included in aggregate %.

6 of 17 new or added lines in 2 files covered. (35.29%)

1072 existing lines in 104 files now uncovered.

21423 of 31309 relevant lines covered (68.42%)

13054.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

54.13
/src/dftracer/utils/utilities/common/query/ast.cpp
1
#include <dftracer/utils/utilities/common/query/ast.h>
2

3
#include <sstream>
4
#include <string>
5

6
namespace dftracer::utils::utilities::common::query {
7

8
const char* compare_op_str(CompareOp op) {
3✔
9
    switch (op) {
3!
10
        case CompareOp::EQ:
2✔
11
            return "==";
2✔
UNCOV
12
        case CompareOp::NE:
×
13
            return "!=";
×
14
        case CompareOp::GT:
1✔
15
            return ">";
1✔
UNCOV
16
        case CompareOp::LT:
×
17
            return "<";
×
UNCOV
18
        case CompareOp::GE:
×
19
            return ">=";
×
UNCOV
20
        case CompareOp::LE:
×
21
            return "<=";
×
22
    }
23
    return "??";
×
24
}
25

26
namespace {
27

28
void literal_to_string(std::ostringstream& os, const LiteralNode& lit) {
3✔
29
    std::visit(
6✔
30
        [&os](auto&& v) {
3✔
31
            using T = std::decay_t<decltype(v)>;
32
            if constexpr (std::is_same_v<T, std::string>) {
33
                os << '"' << v << '"';
2✔
34
            } else if constexpr (std::is_same_v<T, bool>) {
35
                os << (v ? "true" : "false");
×
36
            } else if constexpr (std::is_same_v<T, int64_t>) {
37
                os << v;
×
38
            } else if constexpr (std::is_same_v<T, uint64_t>) {
39
                os << v;
1✔
40
            } else if constexpr (std::is_same_v<T, double>) {
41
                os << v;
×
42
            }
43
        },
3✔
44
        lit.value);
3!
45
}
3✔
46

47
void array_to_string(std::ostringstream& os, const ArrayNode& arr) {
×
48
    os << '[';
×
49
    for (std::size_t i = 0; i < arr.elements.size(); ++i) {
×
50
        if (i > 0) os << ", ";
×
51
        literal_to_string(os, arr.elements[i]);
×
52
    }
53
    os << ']';
×
54
}
×
55

56
void node_to_string(std::ostringstream& os, const QueryNode& node) {
4✔
57
    std::visit(
8✔
58
        [&os](auto&& n) {
11✔
59
            using T = std::decay_t<decltype(n)>;
60
            if constexpr (std::is_same_v<T, CompareNode>) {
61
                os << n.field.path << ' ' << compare_op_str(n.op) << ' ';
3✔
62
                literal_to_string(os, n.value);
3✔
63
            } else if constexpr (std::is_same_v<T, InNode>) {
64
                os << n.field.path << " in ";
×
65
                array_to_string(os, n.values);
×
66
            } else if constexpr (std::is_same_v<T, NotInNode>) {
67
                os << n.field.path << " not in ";
×
68
                array_to_string(os, n.values);
×
69
            } else if constexpr (std::is_same_v<T, AndNode>) {
70
                os << '(';
1✔
71
                node_to_string(os, *n.left);
1✔
72
                os << " and ";
1✔
73
                node_to_string(os, *n.right);
1✔
74
                os << ')';
1✔
75
            } else if constexpr (std::is_same_v<T, OrNode>) {
76
                os << '(';
×
77
                node_to_string(os, *n.left);
×
78
                os << " or ";
×
79
                node_to_string(os, *n.right);
×
80
                os << ')';
×
81
            } else if constexpr (std::is_same_v<T, NotNode>) {
82
                os << "not (";
×
83
                node_to_string(os, *n.operand);
×
84
                os << ')';
×
85
            }
86
        },
4✔
87
        node.data);
4!
88
}
4✔
89

90
void collect_fields_impl(const QueryNode& node,
406✔
91
                         dftracer::utils::StringViewSet& out) {
92
    std::visit(
811✔
93
        [&out](auto&& n) {
490✔
94
            using T = std::decay_t<decltype(n)>;
95
            if constexpr (std::is_same_v<T, CompareNode>) {
96
                out.insert(n.field.path);
300✔
97
            } else if constexpr (std::is_same_v<T, InNode>) {
98
                out.insert(n.field.path);
16✔
99
            } else if constexpr (std::is_same_v<T, NotInNode>) {
100
                out.insert(n.field.path);
2✔
101
            } else if constexpr (std::is_same_v<T, AndNode>) {
102
                collect_fields_impl(*n.left, out);
36✔
103
                collect_fields_impl(*n.right, out);
36✔
104
            } else if constexpr (std::is_same_v<T, OrNode>) {
105
                collect_fields_impl(*n.left, out);
49✔
106
                collect_fields_impl(*n.right, out);
49✔
107
            } else if constexpr (std::is_same_v<T, NotNode>) {
108
                collect_fields_impl(*n.operand, out);
2✔
109
            }
110
        },
406✔
111
        node.data);
406!
112
}
405✔
113

114
}  // namespace
115

116
std::string to_string(const QueryNode& node) {
2✔
117
    std::ostringstream os;
2!
118
    node_to_string(os, node);
2!
119
    return os.str();
4!
120
}
2✔
121

122
dftracer::utils::StringViewSet collect_fields(const QueryNode& node) {
234✔
123
    dftracer::utils::StringViewSet fields;
234✔
124
    collect_fields_impl(node, fields);
234!
125
    return fields;
233✔
UNCOV
126
}
×
127

128
}  // namespace dftracer::utils::utilities::common::query
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc