aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/protos/lwtrace.proto
blob: 005109571972047d77bd61efbb3d00ef18ff692b (plain) (blame)
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*
 * This file defines language for trace queries and serialization format for trace logs
 */
syntax = "proto3";

package NLWTrace;

option go_package = "a.yandex-team.ru/library/cpp/lwtrace/protos";

message TProbeDesc {
    string Name = 1; // Use either name+provider
    string Provider = 3;
    string Group = 2; // or group
}

enum EOperatorType {
    OT_EQ = 0;
    OT_NE = 1;
    OT_LT = 2;
    OT_LE = 3;
    OT_GT = 4;
    OT_GE = 5;
}

message TArgument {
    string Param = 1;
    bytes Value = 2;
    string Variable = 3;
}

message TOperator {
    EOperatorType Type = 1;
    repeated TArgument Argument = 8;
}

message TPredicate {
    repeated TOperator Operators = 1; // All operators are combined using logical AND
    double SampleRate = 2; // value 1.0 means trigger actions on 100% events (do not sample if value is not set)
}

message TLogAction {
    bool DoNotLogParams = 2;
    bool LogTimestamp = 3;
    uint32 MaxRecords = 4; // Do not write more than MaxRecords records to the log (count from the trace beginning, not start)
}

message TPrintToStderrAction {
}

message TKillAction {
}

message TSleepAction {
    uint64 NanoSeconds = 1;
}

message TCustomAction {
    string Name = 1;
    repeated string Opts = 2;
}

enum EStatementType {
    ST_MOV = 0;
    ST_ADD = 1;
    ST_SUB = 2;
    ST_MUL = 3;
    ST_DIV = 4;
    ST_MOD = 5;
    ST_ADD_EQ = 6;
    ST_SUB_EQ = 7;
    ST_INC = 8;
    ST_DEC = 9;
}

message TStatementAction {
    EStatementType Type = 1;
    repeated TArgument Argument = 2;
}

message TRunLogShuttleAction {
    bool Ignore = 1;
    uint64 ShuttlesCount = 2;
    uint64 MaxTrackLength = 3;
}

message TEditLogShuttleAction {
    bool Ignore = 1;
}

message TDropLogShuttleAction {
}

message TAction {
    TLogAction LogAction = 2;
    TPrintToStderrAction PrintToStderrAction = 3;
    TCustomAction CustomAction = 4;
    TKillAction KillAction = 6;
    TSleepAction SleepAction = 7;
    TStatementAction StatementAction = 8;

    TRunLogShuttleAction RunLogShuttleAction = 100;
    TEditLogShuttleAction EditLogShuttleAction = 101;
    TDropLogShuttleAction DropLogShuttleAction = 102;
}

message TBlock {
    TProbeDesc ProbeDesc = 1;
    TPredicate Predicate = 2;
    repeated TAction Action = 3;
}

message TQuery {
    // Number of events to hold for every thread in cyclic buffer
    // (Won't be used if LogDurationUs is set to non-zero value)
    uint32 PerThreadLogSize = 1;

    // Hold events for last Duration microseconds
    // (If zero, than per-thread cyclic buffer will be used to store events)
    uint64 LogDurationUs = 2;

    repeated TBlock Blocks = 3;
}

message TDashboard {
    message TCell {
        optional string Url = 1;
        optional string Title = 2;
        optional string Text = 3;
        optional uint32 RowSpan = 4;
        optional uint32 ColSpan = 5;
    }

    message TRow {
        repeated TCell Cells = 1;
    }

    optional string Name = 1;
    optional string Description = 2;
    repeated TRow Rows = 3;
}

//////////////////////////////////////////////////////////////////////////////////////////////
//                       Serialization format for trace logs                                //
//////////////////////////////////////////////////////////////////////////////////////////////
enum EParamTypePb {
    PT_UNKNOWN = 0;
    PT_I64 = 1;
    PT_Ui64 = 2;
    PT_Double = 3;
    PT_Str = 4;
    PT_Symbol = 5;
    PT_Check = 6;
}

message TEventPb {
    string Name = 1;
    repeated string Groups = 2; // First group is provider
    repeated EParamTypePb ParamTypes = 3;
    repeated string ParamNames = 4;
}

message TLogItemPb {
    uint64 Thread = 1;
    string Name = 2;
    string Provider = 3;
    repeated bytes Params = 4;
    uint64 Timestamp = 5; // microseconds since epoch
    uint64 TimestampCycles = 6; // cycles since machine boot
}

message TThreadLogPb {
    uint64 ThreadId = 1;
    repeated TLogItemPb LogItems = 2;
}

message TLogPb {
    // Trace info
    string Name = 1;
    string Description = 2;
    uint64 EventsCount = 3;
    uint64 CrtTime = 4; // Log creation time (seconds since epoch)

    // Traced host info
    string Hostname = 101;

    // Traced process info
    string ProcessName = 201;
    bytes CommandLine = 202;
    uint64 ProcessStartTime = 203;
    uint64 Pid = 204;
    string VersionInfo = 205; // Svn info

    // Trace query and results
    TQuery Query = 301;
    repeated TEventPb Events = 302;
    repeated TThreadLogPb ThreadLogs = 303;
}

message TShuttlePb {
    repeated TLogPb Parts = 1;
    TQuery Query = 2;
}

message TOrbitPb {
    repeated TShuttlePb Shuttles = 1;
}

////////////////////////////////////////////////////////////////////////////////
// Trace parameter.

message TTraceParam
{
    // Value.
    oneof Value
    {
        int64  IntValue = 2;
        uint64 UintValue = 3;
        double DoubleValue = 4;
        bytes StrValue = 5;
    }
}

////////////////////////////////////////////////////////////////////////////////
// Trace Event .

message TTraceEvent
{
    // Probe name.
    string Name = 1;

    // Provider name.
    string Provider = 2;

    // Probe parameters.
    repeated TTraceParam Params = 3;

    // Event timestamp in nanosec since epoch.
    uint64 TimestampNanosec = 4;
}

////////////////////////////////////////////////////////////////////////////////
// Shuttle trace .

message TShuttleTrace
{
    // Request events.
    repeated TTraceEvent Events = 1;
}

////////////////////////////////////////////////////////////////////////////////
// Trace request.

message TTraceRequest
{
    // trace id of remote trace session
    bool IsTraced = 1;
}

////////////////////////////////////////////////////////////////////////////////
// Trace response.

message TTraceResponse
{
    // traced events
    TShuttleTrace Trace = 1;
}