1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#pragma once
#include <util/generic/strbuf.h>
#include <util/generic/yexception.h>
namespace NYql {
namespace NLog {
// keep this enum in sync with simmilar enum from ydb/library/yql/utils/log/proto/logger_config.proto
enum class EComponent {
Default = 0,
Core,
CoreExecution,
Sql,
ProviderCommon,
ProviderConfig,
ProviderResult,
ProviderYt,
ProviderKikimr,
ProviderKqp,
ProviderRtmr,
Performance, Perf = Performance,
Net,
ProviderStat,
ProviderSolomon,
CoreEval,
CorePeepHole,
ProviderDq,
ProviderClickHouse,
ProviderYdb,
ProviderPq,
ProviderS3,
CoreDq,
HttpGateway,
ProviderGeneric,
ProviderPg,
ProviderPure,
FastMapReduce,
ProviderYtflow,
// <--- put other log components here
MaxValue
};
struct EComponentHelpers {
static constexpr int ToInt(EComponent component) {
return static_cast<int>(component);
}
static constexpr EComponent FromInt(int component) {
return (component >= ToInt(EComponent::Default) &&
component < ToInt(EComponent::MaxValue))
? static_cast<EComponent>(component)
: EComponent::Default;
}
static TStringBuf ToString(EComponent component) {
switch (component) {
case EComponent::Default: return TStringBuf("default");
case EComponent::Core: return TStringBuf("core");
case EComponent::CoreEval: return TStringBuf("core eval");
case EComponent::CorePeepHole: return TStringBuf("core peephole");
case EComponent::CoreExecution: return TStringBuf("core exec");
case EComponent::Sql: return TStringBuf("sql");
case EComponent::ProviderCommon: return TStringBuf("common provider");
case EComponent::ProviderConfig: return TStringBuf("CONFIG");
case EComponent::ProviderResult: return TStringBuf("RESULT");
case EComponent::ProviderYt: return TStringBuf("YT");
case EComponent::ProviderKikimr: return TStringBuf("KIKIMR");
case EComponent::ProviderKqp: return TStringBuf("KQP");
case EComponent::ProviderRtmr: return TStringBuf("RTMR");
case EComponent::Performance: return TStringBuf("perf");
case EComponent::Net: return TStringBuf("net");
case EComponent::ProviderStat: return TStringBuf("STATFACE");
case EComponent::ProviderSolomon: return TStringBuf("SOLOMON");
case EComponent::ProviderDq: return TStringBuf("DQ");
case EComponent::ProviderClickHouse: return TStringBuf("CLICKHOUSE");
case EComponent::ProviderYdb: return TStringBuf("YDB");
case EComponent::ProviderPq: return TStringBuf("PQ");
case EComponent::ProviderS3: return TStringBuf("S3");
case EComponent::CoreDq: return TStringBuf("core dq");
case EComponent::HttpGateway: return TStringBuf("http gw");
case EComponent::ProviderGeneric: return TStringBuf("generic");
case EComponent::ProviderPg: return TStringBuf("PG");
case EComponent::ProviderPure: return TStringBuf("pure");
case EComponent::FastMapReduce: return TStringBuf("FMR");
case EComponent::ProviderYtflow: return TStringBuf("YTFLOW");
default:
ythrow yexception() << "invalid log component value: "
<< ToInt(component);
}
}
static EComponent FromString(TStringBuf str) {
if (str == TStringBuf("default")) return EComponent::Default;
if (str == TStringBuf("core")) return EComponent::Core;
if (str == TStringBuf("core eval")) return EComponent::CoreEval;
if (str == TStringBuf("core peephole")) return EComponent::CorePeepHole;
if (str == TStringBuf("core exec")) return EComponent::CoreExecution;
if (str == TStringBuf("sql")) return EComponent::Sql;
if (str == TStringBuf("common provider")) return EComponent::ProviderCommon;
if (str == TStringBuf("CONFIG")) return EComponent::ProviderConfig;
if (str == TStringBuf("RESULT")) return EComponent::ProviderResult;
if (str == TStringBuf("YT")) return EComponent::ProviderYt;
if (str == TStringBuf("KIKIMR")) return EComponent::ProviderKikimr;
if (str == TStringBuf("KQP")) return EComponent::ProviderKqp;
if (str == TStringBuf("RTMR")) return EComponent::ProviderRtmr;
if (str == TStringBuf("perf")) return EComponent::Performance;
if (str == TStringBuf("net")) return EComponent::Net;
if (str == TStringBuf("STATFACE")) return EComponent::ProviderStat;
if (str == TStringBuf("SOLOMON")) return EComponent::ProviderSolomon;
if (str == TStringBuf("DQ")) return EComponent::ProviderDq;
if (str == TStringBuf("CLICKHOUSE")) return EComponent::ProviderClickHouse;
if (str == TStringBuf("YDB")) return EComponent::ProviderYdb;
if (str == TStringBuf("PQ")) return EComponent::ProviderPq;
if (str == TStringBuf("S3")) return EComponent::ProviderS3;
if (str == TStringBuf("core dq")) return EComponent::CoreDq;
if (str == TStringBuf("http gw")) return EComponent::HttpGateway;
if (str == TStringBuf("generic")) return EComponent::ProviderGeneric;
if (str == TStringBuf("PG")) return EComponent::ProviderPg;
if (str == TStringBuf("pure")) return EComponent::ProviderPure;
if (str == TStringBuf("FMR")) return EComponent::FastMapReduce;
if (str == TStringBuf("YTFLOW")) return EComponent::ProviderYtflow;
ythrow yexception() << "unknown log component: '" << str << '\'';
}
template <typename TFunctor>
static void ForEach(TFunctor&& f) {
static const int minValue = ToInt(EComponent::Default);
static const int maxValue = ToInt(EComponent::MaxValue);
for (int c = minValue; c < maxValue; c++) {
f(FromInt(c));
}
}
};
} // namespace NLog
} // namespace NYql
|