|
16 | 16 | * SPDX-License-Identifier: Apache-2.0 |
17 | 17 | */ |
18 | 18 |
|
19 | | - syntax = "proto3"; |
20 | | - |
21 | | - package px.carnot.planner.dynamic_tracing.ir.logical; |
22 | | - |
23 | | - option go_package = "logicalpb"; |
24 | | - |
25 | | - import "github.com/gogo/protobuf/gogoproto/gogo.proto"; |
26 | | - import "google/protobuf/duration.proto"; |
27 | | - |
28 | | - message Argument { |
29 | | - // Used to reference this argument. |
30 | | - string id = 1; |
31 | | - // An expression that accesses a subfield of this argument. |
32 | | - // For example, "foo" refers to an argument named "foo". |
33 | | - // And "foo.bar" refers to the "bar" field of argument named "foo". |
34 | | - // |
35 | | - // NOTE: This should only be a accessor expression started with the name of an |
36 | | - // argument. |
37 | | - string expr = 2; |
38 | | - } |
39 | | - |
40 | | - message ReturnValue { |
41 | | - // Used to reference this return value. |
42 | | - string id = 1; |
43 | | - // The expression describes how to access this value. |
44 | | - // The expression is in the form of `$<return value index>.<field>.<field>`. |
45 | | - // For example, |
46 | | - // `$0.i32`, which is the first return value's `i32` field. |
47 | | - // |
48 | | - // The index to this return value. This is only meaningful for languages that |
49 | | - // support multiple return values, like Go. Note that Golang index all return |
50 | | - // values along with the input arguments (excluding the receiver). |
51 | | - string expr = 2; |
52 | | - } |
53 | | - |
54 | | - // Describes the structure of the data Output. |
55 | | - message Output { |
56 | | - string name = 1; |
57 | | - repeated string fields = 2; |
58 | | - } |
59 | | - |
60 | | - message OutputAction { |
61 | | - string output_name = 1; |
62 | | - // The name of the variables to be output. |
63 | | - repeated string variable_names = 2; |
64 | | - } |
65 | | - |
66 | | - // Describes where to attach a probe. |
67 | | - message Tracepoint { |
68 | | - string symbol = 1; |
69 | | - } |
70 | | - |
71 | | - // Indicates a variable named 'id' should be generated, and represents the latency from function |
72 | | - // entry to return. |
73 | | - message FunctionLatency { |
74 | | - string id = 1; |
75 | | - } |
76 | | - |
77 | | - // Corresponds to a logical probe. |
78 | | - message Probe { |
79 | | - string name = 1; |
80 | | - // Where to attach this probe. |
81 | | - Tracepoint tracepoint = 2; |
82 | | - // Input arguments of a function. |
83 | | - repeated Argument args = 3; |
84 | | - // Return values of a function. |
85 | | - repeated ReturnValue ret_vals = 4; |
86 | | - // Latency of a function. |
87 | | - oneof function_latency_oneof { |
88 | | - FunctionLatency function_latency = 5; |
89 | | - } |
90 | | - // Writes a value to the output table. |
91 | | - // |
92 | | - // The variable to be inserted into the output table must be one of the above |
93 | | - // args, ret_vals, and function_latency. |
94 | | - repeated OutputAction output_actions = 6; |
95 | | - } |
96 | | - |
97 | | - message TracepointSpec { |
98 | | - // The programs table outputs. |
99 | | - repeated Output outputs = 1; |
100 | | - // The probe definition for this tracepoint. |
101 | | - Probe probe = 2; |
102 | | - } |
103 | | - |
104 | | - message BPFTrace { |
105 | | - // Bpftrace code to be deployed. |
106 | | - string program = 1; |
107 | | - } |
108 | | - |
109 | | - // This cannot replace class UPID in src/shared/metadata/base_types.h, because the C++ UPID is |
110 | | - // created to be compatible with Arrow and uses uint128 for efficient processing. |
111 | | - message UPID { |
112 | | - // A unique ID for a particular agent. |
113 | | - uint32 asid = 1; |
114 | | - // The PID of the running process on a particular node. |
115 | | - uint32 pid = 2; |
116 | | - // The start time stamp of the process, used to distinguish between processes having the same |
117 | | - // PID across different time frame. |
118 | | - uint64 ts_ns = 3; |
119 | | - } |
120 | | - |
121 | | - // Describes the target of attaching a Tracepoint. |
122 | | - message DeploymentSpec { |
123 | | - message SharedObject { |
124 | | - // The name of the shared library to trace. |
125 | | - // The name should not include a path or the version number. |
126 | | - // E.g. /lib/x86_64-linux-gnu/libc.so.6 -> libc |
127 | | - string name = 1; |
128 | | - // A running process which is used to locate the shared library. |
129 | | - // The shared object must be used by this process. |
130 | | - // Note, however, that the tracepoint is attached to the shared library; not just this process. |
131 | | - UPID upid = 2; |
132 | | - } |
133 | | - message PodProcess { |
134 | | - // The name of the Pod. |
135 | | - repeated string pods = 1; |
136 | | - // The name of the container inside the above Pod. |
137 | | - string container = 2; |
138 | | - // The application processes whose cmdline contains this regexp are selected. |
139 | | - string process = 3; |
140 | | - } |
141 | | - |
142 | | - // Describes a map of K8s labels in a namespace that can be used to select a set of pods. |
143 | | - // Container and/or process can be set to select a target UPID when there are multiple containers |
144 | | - // or processes in the pods. |
145 | | - message LabelSelector { |
146 | | - // The set of label keys and values the target pods have. |
147 | | - map<string, string> labels = 1; |
148 | | - // The namespace the target pods are in. |
149 | | - string namespace = 2; |
150 | | - // The name of the container in the target pods. |
151 | | - string container = 3; |
152 | | - // The application process whose cmdline contains this regexp are selected. |
153 | | - string process = 4; |
154 | | - } |
155 | | - |
156 | | - oneof target_oneof { |
157 | | - // The UPID of a running process. |
158 | | - // Resolved to an executable. |
159 | | - UPID upid = 1; |
160 | | - // An way to specify a shared object to be traced. |
161 | | - SharedObject shared_object = 2; |
162 | | - // Describes the target process to attach. |
163 | | - PodProcess pod_process = 3; |
164 | | - // Describes pods matching a set of labels, and processes within them. |
165 | | - LabelSelector label_selector = 4; |
166 | | - } |
167 | | - } |
168 | | - |
169 | | - enum SelectorType { |
170 | | - NO_CONDITION = 0; // default if none specified |
171 | | - MAX_KERNEL = 1; |
172 | | - MIN_KERNEL = 2; |
173 | | - HOST_NAME = 3; |
174 | | - // Other selectors here in the future (e.g. OS version) |
175 | | - } |
176 | | - |
177 | | - // One selector can enforce one thing |
178 | | - message TracepointSelector { |
179 | | - SelectorType selector_type = 1; |
180 | | - string value = 2; |
181 | | - } |
182 | | - |
183 | | - // A logical program, either an application tracepoint, or a bpftrace. |
184 | | - message TracepointDeployment { |
185 | | - // The name of this deployment. Used to identify this operation. |
186 | | - string name = 1; |
187 | | - // The liveness time of the tracepoint, represented in ns. After this time, |
188 | | - // the tracepoint will be deleted. |
189 | | - google.protobuf.Duration ttl = 2 [ (gogoproto.customname) = "TTL" ]; |
190 | | - // The target processes of this deployment. |
191 | | - // Right now this only applies to PXL application tracepoints. |
192 | | - // May become applicable to bpftrace when we support bpftrace uprobes. |
193 | | - DeploymentSpec deployment_spec = 3; |
194 | | - // Describes a TracepointProgram with a output table name. |
195 | | - message TracepointProgram { |
196 | | - // The name of the table to hold the output data. |
197 | | - string table_name = 1; |
198 | | - // A native PXL tracepoint specification. |
199 | | - TracepointSpec spec = 2; |
200 | | - // This applies to bpftrace. Note that only one bpftrace program is allowed. |
201 | | - BPFTrace bpftrace = 3 [ (gogoproto.customname) = "BPFTrace" ]; |
202 | | - // The selectors to enforce on this deployment. Program will be deployed only to agents that |
203 | | - // match. |
204 | | - repeated TracepointSelector selectors = 4; |
205 | | - } |
206 | | - repeated TracepointProgram programs = 4; |
207 | | - } |
| 19 | +syntax = "proto3"; |
| 20 | + |
| 21 | +package px.carnot.planner.dynamic_tracing.ir.logical; |
| 22 | + |
| 23 | +option go_package = "logicalpb"; |
| 24 | + |
| 25 | +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; |
| 26 | +import "google/protobuf/duration.proto"; |
| 27 | + |
| 28 | +message Argument { |
| 29 | + // Used to reference this argument. |
| 30 | + string id = 1; |
| 31 | + // An expression that accesses a subfield of this argument. |
| 32 | + // For example, "foo" refers to an argument named "foo". |
| 33 | + // And "foo.bar" refers to the "bar" field of argument named "foo". |
| 34 | + // |
| 35 | + // NOTE: This should only be a accessor expression started with the name of an |
| 36 | + // argument. |
| 37 | + string expr = 2; |
| 38 | +} |
| 39 | + |
| 40 | +message ReturnValue { |
| 41 | + // Used to reference this return value. |
| 42 | + string id = 1; |
| 43 | + // The expression describes how to access this value. |
| 44 | + // The expression is in the form of `$<return value index>.<field>.<field>`. |
| 45 | + // For example, |
| 46 | + // `$0.i32`, which is the first return value's `i32` field. |
| 47 | + // |
| 48 | + // The index to this return value. This is only meaningful for languages that |
| 49 | + // support multiple return values, like Go. Note that Golang index all return |
| 50 | + // values along with the input arguments (excluding the receiver). |
| 51 | + string expr = 2; |
| 52 | +} |
| 53 | + |
| 54 | +// Describes the structure of the data Output. |
| 55 | +message Output { |
| 56 | + string name = 1; |
| 57 | + repeated string fields = 2; |
| 58 | +} |
| 59 | + |
| 60 | +message OutputAction { |
| 61 | + string output_name = 1; |
| 62 | + // The name of the variables to be output. |
| 63 | + repeated string variable_names = 2; |
| 64 | +} |
| 65 | + |
| 66 | +// Describes where to attach a probe. |
| 67 | +message Tracepoint { |
| 68 | + string symbol = 1; |
| 69 | +} |
| 70 | + |
| 71 | +// Indicates a variable named 'id' should be generated, and represents the latency from function |
| 72 | +// entry to return. |
| 73 | +message FunctionLatency { |
| 74 | + string id = 1; |
| 75 | +} |
| 76 | + |
| 77 | +// Corresponds to a logical probe. |
| 78 | +message Probe { |
| 79 | + string name = 1; |
| 80 | + // Where to attach this probe. |
| 81 | + Tracepoint tracepoint = 2; |
| 82 | + // Input arguments of a function. |
| 83 | + repeated Argument args = 3; |
| 84 | + // Return values of a function. |
| 85 | + repeated ReturnValue ret_vals = 4; |
| 86 | + // Latency of a function. |
| 87 | + oneof function_latency_oneof { |
| 88 | + FunctionLatency function_latency = 5; |
| 89 | + } |
| 90 | + // Writes a value to the output table. |
| 91 | + // |
| 92 | + // The variable to be inserted into the output table must be one of the above |
| 93 | + // args, ret_vals, and function_latency. |
| 94 | + repeated OutputAction output_actions = 6; |
| 95 | +} |
| 96 | + |
| 97 | +message TracepointSpec { |
| 98 | + // The programs table outputs. |
| 99 | + repeated Output outputs = 1; |
| 100 | + // The probe definition for this tracepoint. |
| 101 | + Probe probe = 2; |
| 102 | +} |
| 103 | + |
| 104 | +message BPFTrace { |
| 105 | + // Bpftrace code to be deployed. |
| 106 | + string program = 1; |
| 107 | +} |
| 108 | + |
| 109 | +// This cannot replace class UPID in src/shared/metadata/base_types.h, because the C++ UPID is |
| 110 | +// created to be compatible with Arrow and uses uint128 for efficient processing. |
| 111 | +message UPID { |
| 112 | + // A unique ID for a particular agent. |
| 113 | + uint32 asid = 1; |
| 114 | + // The PID of the running process on a particular node. |
| 115 | + uint32 pid = 2; |
| 116 | + // The start time stamp of the process, used to distinguish between processes having the same |
| 117 | + // PID across different time frame. |
| 118 | + uint64 ts_ns = 3; |
| 119 | +} |
| 120 | + |
| 121 | +// Describes the target of attaching a Tracepoint. |
| 122 | +message DeploymentSpec { |
| 123 | + message SharedObject { |
| 124 | + // The name of the shared library to trace. |
| 125 | + // The name should not include a path or the version number. |
| 126 | + // E.g. /lib/x86_64-linux-gnu/libc.so.6 -> libc |
| 127 | + string name = 1; |
| 128 | + // A running process which is used to locate the shared library. |
| 129 | + // The shared object must be used by this process. |
| 130 | + // Note, however, that the tracepoint is attached to the shared library; not just this process. |
| 131 | + UPID upid = 2; |
| 132 | + } |
| 133 | + message PodProcess { |
| 134 | + // The name of the Pod. |
| 135 | + repeated string pods = 1; |
| 136 | + // The name of the container inside the above Pod. |
| 137 | + string container = 2; |
| 138 | + // The application processes whose cmdline contains this regexp are selected. |
| 139 | + string process = 3; |
| 140 | + } |
| 141 | + |
| 142 | + // Describes a map of K8s labels in a namespace that can be used to select a set of pods. |
| 143 | + // Container and/or process can be set to select a target UPID when there are multiple containers |
| 144 | + // or processes in the pods. |
| 145 | + message LabelSelector { |
| 146 | + // The set of label keys and values the target pods have. |
| 147 | + map<string, string> labels = 1; |
| 148 | + // The namespace the target pods are in. |
| 149 | + string namespace = 2; |
| 150 | + // The name of the container in the target pods. |
| 151 | + string container = 3; |
| 152 | + // The application process whose cmdline contains this regexp are selected. |
| 153 | + string process = 4; |
| 154 | + } |
| 155 | + |
| 156 | + oneof target_oneof { |
| 157 | + // The UPID of a running process. |
| 158 | + // Resolved to an executable. |
| 159 | + UPID upid = 1; |
| 160 | + // An way to specify a shared object to be traced. |
| 161 | + SharedObject shared_object = 2; |
| 162 | + // Describes the target process to attach. |
| 163 | + PodProcess pod_process = 3; |
| 164 | + // Describes pods matching a set of labels, and processes within them. |
| 165 | + LabelSelector label_selector = 4; |
| 166 | + } |
| 167 | +} |
| 168 | + |
| 169 | +enum SelectorType { |
| 170 | + NO_CONDITION = 0; // default if none specified |
| 171 | + MAX_KERNEL = 1; |
| 172 | + MIN_KERNEL = 2; |
| 173 | + HOST_NAME = 3; |
| 174 | + // Other selectors here in the future (e.g. OS version) |
| 175 | +} |
| 176 | + |
| 177 | +// One selector can enforce one thing |
| 178 | +message TracepointSelector { |
| 179 | + SelectorType selector_type = 1; |
| 180 | + string value = 2; |
| 181 | +} |
| 182 | + |
| 183 | +// A logical program, either an application tracepoint, or a bpftrace. |
| 184 | +message TracepointDeployment { |
| 185 | + // The name of this deployment. Used to identify this operation. |
| 186 | + string name = 1; |
| 187 | + // The liveness time of the tracepoint, represented in ns. After this time, |
| 188 | + // the tracepoint will be deleted. |
| 189 | + google.protobuf.Duration ttl = 2 [ (gogoproto.customname) = "TTL" ]; |
| 190 | + // The target processes of this deployment. |
| 191 | + // Right now this only applies to PXL application tracepoints. |
| 192 | + // May become applicable to bpftrace when we support bpftrace uprobes. |
| 193 | + DeploymentSpec deployment_spec = 3; |
| 194 | + // Describes a TracepointProgram with a output table name. |
| 195 | + message TracepointProgram { |
| 196 | + // The name of the table to hold the output data. |
| 197 | + string table_name = 1; |
| 198 | + // A native PXL tracepoint specification. |
| 199 | + TracepointSpec spec = 2; |
| 200 | + // This applies to bpftrace. Note that only one bpftrace program is allowed. |
| 201 | + BPFTrace bpftrace = 3 [ (gogoproto.customname) = "BPFTrace" ]; |
| 202 | + // The selectors to enforce on this deployment. Program will be deployed only to agents that |
| 203 | + // match. |
| 204 | + repeated TracepointSelector selectors = 4; |
| 205 | + } |
| 206 | + repeated TracepointProgram programs = 4; |
| 207 | +} |
0 commit comments