-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtrace_item_attribute.proto
More file actions
165 lines (144 loc) · 4.33 KB
/
trace_item_attribute.proto
File metadata and controls
165 lines (144 loc) · 4.33 KB
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
syntax = "proto3";
package sentry_protos.snuba.v1;
message AttributeKey {
enum Type { //this mostly reflects what types are able to be ingested, see eap_spans consumer for ingest details
TYPE_UNSPECIFIED = 0; // protobuf requirement, do not send this
TYPE_STRING = 1;
TYPE_BOOLEAN = 2;
// deprecated, use TYPE_DOUBLE instead
TYPE_FLOAT = 3 [deprecated = true];
TYPE_INT = 4; //note: all numbers are stored as float64, so massive integers can be rounded. USE STRING FOR IDS.
TYPE_DOUBLE = 5;
TYPE_ARRAY = 6;
}
Type type = 1;
// the name of the trace item attribute, everything that sentry sends by default is prefixed with
// `sentry.` to allow users to send attributes of the same name.
// Exampe: `sentry.duration`, `sentry.span_id` etc
string name = 2;
// Optional indexed access into an array-typed attribute (only meaningful when type == TYPE_ARRAY).
// Signed to allow negative indexing (e.g. -1 for the last element).
optional sint32 index = 3;
}
// this allow us to select single key such as span.attr1
// and also combine multiple keys such as (span.attr1 * span.attr2)
// Grammar: f = k | f op f (formula is either a key or formula operation formula)
message AttributeKeyExpression {
enum Op {
OP_UNSPECIFIED = 0;
OP_ADD = 1;
OP_SUB = 2;
OP_MULT = 3;
OP_DIV = 4;
}
oneof expression {
// f = k (single key)
AttributeKey key = 1;
// f = f op f (binary operation between two formulas)
Formula formula = 2;
}
message Formula {
Op op = 1;
AttributeKeyExpression left = 2;
AttributeKeyExpression right = 3;
}
}
// custom mappings of column values
//
// for example, `project_name` is changeable by the user and not stored in EAP,
// but sorting by it may be desired. So something like this might be done:
//
// ORDER BY sentry.project_name
// VirtualColumnContext(
// from_column_name="sentry.project_id",
// to_column_name="sentry.project_name",
// value_map={"1": "sentry", "2": "snuba"},
// )
//
// in this example `sentry.project_name` is a virtual column created by mapping
// values from the real column `sentry.project_id` to new values. project_id of 1
// gets mapped to project_name="sentry" etc.
message VirtualColumnContext {
string from_column_name = 1;
string to_column_name = 2;
map<string, string> value_map = 3;
string default_value = 4;
// Alternatively, I could just use AttributeKey and deprecate from_column_name, but it might be confusing for the caller
AttributeKey.Type from_column_type = 5;
}
message StrArray {
option deprecated = true;
repeated string values = 1;
}
message IntArray {
option deprecated = true;
repeated int64 values = 1;
}
message FloatArray {
option deprecated = true;
repeated float values = 1;
}
message DoubleArray {
option deprecated = true;
repeated double values = 1;
}
message Array {
repeated AttributeValue values = 1;
}
message AttributeValue {
// true if the value is null
bool is_null = 11;
oneof value {
bool val_bool = 1;
string val_str = 2;
int64 val_int = 4;
double val_double = 9;
Array val_array = 12;
// Deprecated fields
float val_float = 3 [deprecated = true];
FloatArray val_float_array = 8 [deprecated = true];
DoubleArray val_double_array = 10 [deprecated = true];
IntArray val_int_array = 7 [deprecated = true];
StrArray val_str_array = 6 [deprecated = true];
bool val_null = 5 [deprecated = true];
}
}
enum Function {
FUNCTION_UNSPECIFIED = 0;
FUNCTION_SUM = 1;
// deprecated, use FUNCTION_AVG instead
FUNCTION_AVERAGE = 2 [deprecated = true];
FUNCTION_COUNT = 3;
FUNCTION_P50 = 4;
FUNCTION_P75 = 12;
FUNCTION_P90 = 5;
FUNCTION_P95 = 6;
FUNCTION_P99 = 7;
FUNCTION_AVG = 8;
FUNCTION_MAX = 9;
FUNCTION_MIN = 10;
FUNCTION_UNIQ = 11;
FUNCTION_ANY = 13;
}
enum ExtrapolationMode {
EXTRAPOLATION_MODE_UNSPECIFIED = 0;
EXTRAPOLATION_MODE_NONE = 1;
EXTRAPOLATION_MODE_SAMPLE_WEIGHTED = 2;
EXTRAPOLATION_MODE_CLIENT_ONLY = 3;
EXTRAPOLATION_MODE_SERVER_ONLY = 4;
}
message AttributeAggregation {
Function aggregate = 1;
AttributeKey key = 2;
string label = 3;
ExtrapolationMode extrapolation_mode = 4;
oneof default_value {
double default_value_double = 5;
int64 default_value_int64 = 6;
}
}
enum Reliability {
RELIABILITY_UNSPECIFIED = 0;
RELIABILITY_LOW = 1;
RELIABILITY_HIGH = 2;
}