Commit 1f08c98
committed
builtins,sql: Add new request_transaction_bundle builtin
This new builtin creates a transaction diagnostic request
to capture and generate a transaction bundle for a specified
transaction fingerprint id.
This builtin has the following signature:
```
crdb_internal.request_transaction_bundle(
transaction_fingerprint_id: string,
sampling_probability: float,
min_execution_latency: interval,
expires_after: interval,
redacted: bool) -> (int as request_id, bool as created)
```
transaction_fingerprint_id - a hex-encoded fingerprint id for the transaction
intended to be captured
sampling_probability - the probability used to determine if a transaction bundle
should be recorded. This value must be between [0,1].
min_execution_latency - the minimum execution latency for a transaction. If the
execution time of a transaction is lower than this value,
the request will not be considered fulfilled and will remain
uncompleted. If sampling_probability is non-zero, this value
must also be non-zero.
expires_after - the duration in which a request will remain open. If zero is provided,
the request will exist until it is completed or deleted.
redacted - whether or not the collected bundle will be redacted or unredacted
The builtin will return request_id, true if the request is generated successfully, or
null, false if creating a request for transaction fingerprint id that doesn't exist.
Existence of a transaction fingerprint id is determined by its existence in
`crdb_internal.transaction_statistics`. This is necessary because it is currently
the only system of record for transaction fingerprints in cockroachdb.
The user making the request for a transaction diagnostics bundle must have either
VIEWACTIVITY or VIEWACTIVITYREDACTED grants to call this builtin. If they have
VIEWACTIVITYREDACTED, only redacted bundles can be requested.
Resolves: CRDB-54322
Epic: CRDB-53541
Release note (sql change): adds a new builtin:
```
crdb_internal.request_transaction_bundle(
transaction_fingerprint_id: string,
sampling_probability: float,
min_execution_latency: interval,
expires_after: interval,
redacted: bool) -> (int as request_id, bool as created)
```
transaction_fingerprint_id - a hex-encoded fingerprint id for the transaction
intended to be captured
sampling_probability - the probability used to determine if a transaction bundle
should be recorded. This value must be between [0,1].
min_execution_latency - the minimum execution latency for a transaction. If the
execution time of a transaction is lower than this value,
the request will not be considered fulfilled and will remain
uncompleted. If sampling_probability is non-zero, this value
must also be non-zero.
expires_after - the duration in which a request will remain open. If zero is provided,
the request will exist until it is completed or deleted.
redacted - whether or not the collected bundle will be redacted or unredacted
The built-in will return request_id, true if the request is generated successfully, or
null, false if creating a request for transaction fingerprint id that doesn't exist.
The user making the request for a transaction diagnostics bundle must have either
VIEWACTIVITY or VIEWACTIVITYREDACTED grants to call this builtin. If they have
VIEWACTIVITYREDACTED, only redacted bundles can be requested.1 parent eb654e4 commit 1f08c98
File tree
10 files changed
+426
-8
lines changed- pkg/sql
- sem
- builtins
- eval
- stmtdiagnostics
10 files changed
+426
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3825 | 3825 | | |
3826 | 3826 | | |
3827 | 3827 | | |
| 3828 | + | |
3828 | 3829 | | |
3829 | 3830 | | |
3830 | 3831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
| 559 | + | |
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2859 | 2859 | | |
2860 | 2860 | | |
2861 | 2861 | | |
| 2862 | + | |
2862 | 2863 | | |
2863 | 2864 | | |
2864 | 2865 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
838 | 838 | | |
839 | 839 | | |
840 | 840 | | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
841 | 860 | | |
842 | 861 | | |
843 | 862 | | |
| |||
4199 | 4218 | | |
4200 | 4219 | | |
4201 | 4220 | | |
| 4221 | + | |
| 4222 | + | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
| 4226 | + | |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
| 4237 | + | |
| 4238 | + | |
| 4239 | + | |
| 4240 | + | |
| 4241 | + | |
| 4242 | + | |
| 4243 | + | |
| 4244 | + | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + | |
| 4248 | + | |
| 4249 | + | |
| 4250 | + | |
| 4251 | + | |
| 4252 | + | |
| 4253 | + | |
| 4254 | + | |
| 4255 | + | |
| 4256 | + | |
| 4257 | + | |
| 4258 | + | |
| 4259 | + | |
| 4260 | + | |
| 4261 | + | |
| 4262 | + | |
| 4263 | + | |
| 4264 | + | |
| 4265 | + | |
| 4266 | + | |
| 4267 | + | |
| 4268 | + | |
| 4269 | + | |
| 4270 | + | |
| 4271 | + | |
| 4272 | + | |
| 4273 | + | |
| 4274 | + | |
| 4275 | + | |
| 4276 | + | |
| 4277 | + | |
| 4278 | + | |
| 4279 | + | |
| 4280 | + | |
| 4281 | + | |
| 4282 | + | |
| 4283 | + | |
| 4284 | + | |
| 4285 | + | |
| 4286 | + | |
| 4287 | + | |
| 4288 | + | |
| 4289 | + | |
| 4290 | + | |
| 4291 | + | |
| 4292 | + | |
| 4293 | + | |
| 4294 | + | |
| 4295 | + | |
| 4296 | + | |
| 4297 | + | |
| 4298 | + | |
| 4299 | + | |
| 4300 | + | |
| 4301 | + | |
| 4302 | + | |
| 4303 | + | |
| 4304 | + | |
| 4305 | + | |
| 4306 | + | |
| 4307 | + | |
| 4308 | + | |
| 4309 | + | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
| 4314 | + | |
| 4315 | + | |
| 4316 | + | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
| 4320 | + | |
| 4321 | + | |
| 4322 | + | |
| 4323 | + | |
| 4324 | + | |
| 4325 | + | |
| 4326 | + | |
| 4327 | + | |
| 4328 | + | |
| 4329 | + | |
| 4330 | + | |
| 4331 | + | |
| 4332 | + | |
| 4333 | + | |
| 4334 | + | |
| 4335 | + | |
| 4336 | + | |
| 4337 | + | |
| 4338 | + | |
| 4339 | + | |
| 4340 | + | |
| 4341 | + | |
| 4342 | + | |
| 4343 | + | |
| 4344 | + | |
| 4345 | + | |
| 4346 | + | |
| 4347 | + | |
| 4348 | + | |
| 4349 | + | |
| 4350 | + | |
| 4351 | + | |
| 4352 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
249 | 254 | | |
250 | 255 | | |
251 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
765 | 765 | | |
766 | 766 | | |
767 | 767 | | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
768 | 782 | | |
769 | 783 | | |
770 | 784 | | |
| |||
0 commit comments