libdatadog 10.0.0.1.0-x86_64-linux → 12.0.0.1.0-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libdatadog/version.rb +1 -1
- data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +6687 -1277
- data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +1229 -0
- data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/common.h +487 -262
- data/vendor/libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +419 -0
- data/vendor/{libdatadog-10.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/profiling.h +10 -248
- data/vendor/libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +6687 -1277
- data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +1229 -0
- data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/common.h +487 -262
- data/vendor/libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/crashtracker.h +419 -0
- data/vendor/{libdatadog-10.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +10 -248
- data/vendor/libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
- metadata +25 -23
- data/vendor/libdatadog-10.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +0 -895
- data/vendor/libdatadog-10.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/libdatadog-10.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +0 -895
- data/vendor/libdatadog-10.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
- /data/vendor/{libdatadog-10.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
@@ -0,0 +1,419 @@
|
|
1
|
+
// Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
|
5
|
+
#ifndef DDOG_CRASHTRACKER_H
|
6
|
+
#define DDOG_CRASHTRACKER_H
|
7
|
+
|
8
|
+
#pragma once
|
9
|
+
|
10
|
+
#include <stdbool.h>
|
11
|
+
#include <stddef.h>
|
12
|
+
#include <stdint.h>
|
13
|
+
#include "common.h"
|
14
|
+
|
15
|
+
#ifdef __cplusplus
|
16
|
+
extern "C" {
|
17
|
+
#endif // __cplusplus
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Cleans up after the crash-tracker:
|
21
|
+
* Unregister the crash handler, restore the previous handler (if any), and
|
22
|
+
* shut down the receiver. Note that the use of this function is optional:
|
23
|
+
* the receiver will automatically shutdown when the pipe is closed on program
|
24
|
+
* exit.
|
25
|
+
*
|
26
|
+
* # Preconditions
|
27
|
+
* This function assumes that the crashtracker has previously been
|
28
|
+
* initialized.
|
29
|
+
* # Safety
|
30
|
+
* Crash-tracking functions are not reentrant.
|
31
|
+
* No other crash-handler functions should be called concurrently.
|
32
|
+
* # Atomicity
|
33
|
+
* This function is not atomic. A crash during its execution may lead to
|
34
|
+
* unexpected crash-handling behaviour.
|
35
|
+
*/
|
36
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_shutdown(void);
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Reinitialize the crash-tracking infrastructure after a fork.
|
40
|
+
* This should be one of the first things done after a fork, to minimize the
|
41
|
+
* chance that a crash occurs between the fork, and this call.
|
42
|
+
* In particular, reset the counters that track the profiler state machine,
|
43
|
+
* and start a new receiver to collect data from this fork.
|
44
|
+
* NOTE: An alternative design would be to have a 1:many sidecar listening on a
|
45
|
+
* socket instead of 1:1 receiver listening on a pipe, but the only real
|
46
|
+
* advantage would be to have fewer processes in `ps -a`.
|
47
|
+
*
|
48
|
+
* # Preconditions
|
49
|
+
* This function assumes that the crash-tracker has previously been
|
50
|
+
* initialized.
|
51
|
+
* # Safety
|
52
|
+
* Crash-tracking functions are not reentrant.
|
53
|
+
* No other crash-handler functions should be called concurrently.
|
54
|
+
* # Atomicity
|
55
|
+
* This function is not atomic. A crash during its execution may lead to
|
56
|
+
* unexpected crash-handling behaviour.
|
57
|
+
*/
|
58
|
+
DDOG_CHECK_RETURN
|
59
|
+
struct ddog_crasht_Result ddog_crasht_update_on_fork(struct ddog_crasht_Config config,
|
60
|
+
struct ddog_crasht_ReceiverConfig receiver_config,
|
61
|
+
struct ddog_crasht_Metadata metadata);
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Initialize the crash-tracking infrastructure.
|
65
|
+
*
|
66
|
+
* # Preconditions
|
67
|
+
* None.
|
68
|
+
* # Safety
|
69
|
+
* Crash-tracking functions are not reentrant.
|
70
|
+
* No other crash-handler functions should be called concurrently.
|
71
|
+
* # Atomicity
|
72
|
+
* This function is not atomic. A crash during its execution may lead to
|
73
|
+
* unexpected crash-handling behaviour.
|
74
|
+
*/
|
75
|
+
DDOG_CHECK_RETURN
|
76
|
+
struct ddog_crasht_Result ddog_crasht_init_with_receiver(struct ddog_crasht_Config config,
|
77
|
+
struct ddog_crasht_ReceiverConfig receiver_config,
|
78
|
+
struct ddog_crasht_Metadata metadata);
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Resets all counters to 0.
|
82
|
+
* Expected to be used after a fork, to reset the counters on the child
|
83
|
+
* ATOMICITY:
|
84
|
+
* This is NOT ATOMIC.
|
85
|
+
* Should only be used when no conflicting updates can occur,
|
86
|
+
* e.g. after a fork but before profiling ops start on the child.
|
87
|
+
* # Safety
|
88
|
+
* No safety concerns.
|
89
|
+
*/
|
90
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_reset_counters(void);
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Atomically increments the count associated with `op`.
|
94
|
+
* Useful for tracking what operations were occuring when a crash occurred.
|
95
|
+
*
|
96
|
+
* # Safety
|
97
|
+
* No safety concerns.
|
98
|
+
*/
|
99
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_begin_op(enum ddog_crasht_OpTypes op);
|
100
|
+
|
101
|
+
/**
|
102
|
+
* Atomically decrements the count associated with `op`.
|
103
|
+
* Useful for tracking what operations were occuring when a crash occurred.
|
104
|
+
*
|
105
|
+
* # Safety
|
106
|
+
* No safety concerns.
|
107
|
+
*/
|
108
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_end_op(enum ddog_crasht_OpTypes op);
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Resets all stored spans to 0.
|
112
|
+
* Expected to be used after a fork, to reset the spans on the child
|
113
|
+
* ATOMICITY:
|
114
|
+
* This is NOT ATOMIC.
|
115
|
+
* Should only be used when no conflicting updates can occur,
|
116
|
+
* e.g. after a fork but before profiling ops start on the child.
|
117
|
+
* # Safety
|
118
|
+
* No safety concerns.
|
119
|
+
*/
|
120
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_clear_span_ids(void);
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Resets all stored traces to 0.
|
124
|
+
* Expected to be used after a fork, to reset the traces on the child
|
125
|
+
* ATOMICITY:
|
126
|
+
* This is NOT ATOMIC.
|
127
|
+
* Should only be used when no conflicting updates can occur,
|
128
|
+
* e.g. after a fork but before profiling ops start on the child.
|
129
|
+
* # Safety
|
130
|
+
* No safety concerns.
|
131
|
+
*/
|
132
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_clear_trace_ids(void);
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Atomically registers an active traceId.
|
136
|
+
* Useful for tracking what operations were occurring when a crash occurred.
|
137
|
+
* 0 is reserved for "NoId"
|
138
|
+
* The set does not check for duplicates. Adding the same id twice is an error.
|
139
|
+
*
|
140
|
+
* Inputs:
|
141
|
+
* id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
|
142
|
+
*
|
143
|
+
* Returns:
|
144
|
+
* Ok(handle) on success. The handle is needed to later remove the id;
|
145
|
+
* Err() on failure. The most likely cause of failure is that the underlying set is full.
|
146
|
+
*
|
147
|
+
* Note: 128 bit ints in FFI were not stabilized until Rust 1.77
|
148
|
+
* https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
|
149
|
+
* We're currently locked into 1.71, have to do an ugly workaround involving 2 64 bit ints
|
150
|
+
* until we can upgrade.
|
151
|
+
*
|
152
|
+
* # Safety
|
153
|
+
* No safety concerns.
|
154
|
+
*/
|
155
|
+
DDOG_CHECK_RETURN
|
156
|
+
struct ddog_crasht_UsizeResult ddog_crasht_insert_trace_id(uint64_t id_high,
|
157
|
+
uint64_t id_low);
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Atomically registers an active SpanId.
|
161
|
+
* Useful for tracking what operations were occurring when a crash occurred.
|
162
|
+
* 0 is reserved for "NoId".
|
163
|
+
* The set does not check for duplicates. Adding the same id twice is an error.
|
164
|
+
*
|
165
|
+
* Inputs:
|
166
|
+
* id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
|
167
|
+
*
|
168
|
+
* Returns:
|
169
|
+
* Ok(handle) on success. The handle is needed to later remove the id;
|
170
|
+
* Err() on failure. The most likely cause of failure is that the underlying set is full.
|
171
|
+
*
|
172
|
+
* Note: 128 bit ints in FFI were not stabilized until Rust 1.77
|
173
|
+
* https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
|
174
|
+
* We're currently locked into 1.71, have to do an ugly workaround involving 2 64 bit ints
|
175
|
+
* until we can upgrade.
|
176
|
+
*
|
177
|
+
* # Safety
|
178
|
+
* No safety concerns.
|
179
|
+
*/
|
180
|
+
DDOG_CHECK_RETURN
|
181
|
+
struct ddog_crasht_UsizeResult ddog_crasht_insert_span_id(uint64_t id_high,
|
182
|
+
uint64_t id_low);
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Atomically removes a completed SpanId.
|
186
|
+
* Useful for tracking what operations were occurring when a crash occurred.
|
187
|
+
* 0 is reserved for "NoId"
|
188
|
+
*
|
189
|
+
* Inputs:
|
190
|
+
* id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
|
191
|
+
* idx: The handle for the id, from a previous successful call to `insert_span_id`.
|
192
|
+
* Attempting to remove the same element twice is an error.
|
193
|
+
* Returns:
|
194
|
+
* `Ok` on success.
|
195
|
+
* `Err` on failure. If `id` is not found at `idx`, `Err` will be returned and the set will not
|
196
|
+
* be modified.
|
197
|
+
*
|
198
|
+
* Note: 128 bit ints in FFI were not stabilized until Rust 1.77
|
199
|
+
* https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
|
200
|
+
* We're currently locked into 1.71, have to do an ugly workaround involving 2 64 bit ints
|
201
|
+
* until we can upgrade.
|
202
|
+
*
|
203
|
+
* # Safety
|
204
|
+
* No safety concerns.
|
205
|
+
*/
|
206
|
+
DDOG_CHECK_RETURN
|
207
|
+
struct ddog_crasht_Result ddog_crasht_remove_span_id(uint64_t id_high,
|
208
|
+
uint64_t id_low,
|
209
|
+
uintptr_t idx);
|
210
|
+
|
211
|
+
/**
|
212
|
+
* Atomically removes a completed TraceId.
|
213
|
+
* Useful for tracking what operations were occurring when a crash occurred.
|
214
|
+
* 0 is reserved for "NoId"
|
215
|
+
*
|
216
|
+
* Inputs:
|
217
|
+
* id<high/low>: the 128 bit id, broken into 2 64 bit chunks (see note)
|
218
|
+
* idx: The handle for the id, from a previous successful call to `insert_span_id`.
|
219
|
+
* Attempting to remove the same element twice is an error.
|
220
|
+
* Returns:
|
221
|
+
* `Ok` on success.
|
222
|
+
* `Err` on failure. If `id` is not found at `idx`, `Err` will be returned and the set will not
|
223
|
+
* be modified.
|
224
|
+
*
|
225
|
+
* Note: 128 bit ints in FFI were not stabilized until Rust 1.77
|
226
|
+
* https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
|
227
|
+
* We're currently locked into 1.71, have to do an ugly workaround involving 2 64 bit ints
|
228
|
+
* until we can upgrade.
|
229
|
+
*
|
230
|
+
* # Safety
|
231
|
+
* No safety concerns.
|
232
|
+
*/
|
233
|
+
DDOG_CHECK_RETURN
|
234
|
+
struct ddog_crasht_Result ddog_crasht_remove_trace_id(uint64_t id_high,
|
235
|
+
uint64_t id_low,
|
236
|
+
uintptr_t idx);
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Create a new crashinfo, and returns an opaque reference to it.
|
240
|
+
* # Safety
|
241
|
+
* No safety issues.
|
242
|
+
*/
|
243
|
+
DDOG_CHECK_RETURN struct ddog_crasht_CrashInfoNewResult ddog_crasht_CrashInfo_new(void);
|
244
|
+
|
245
|
+
/**
|
246
|
+
* # Safety
|
247
|
+
* The `crash_info` can be null, but if non-null it must point to a CrashInfo
|
248
|
+
* made by this module, which has not previously been dropped.
|
249
|
+
*/
|
250
|
+
void ddog_crasht_CrashInfo_drop(struct ddog_crasht_CrashInfo *crashinfo);
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Best effort attempt to normalize all `ip` on the stacktrace.
|
254
|
+
* `pid` must be the pid of the currently active process where the ips came from.
|
255
|
+
*
|
256
|
+
* # Safety
|
257
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
258
|
+
*/
|
259
|
+
DDOG_CHECK_RETURN
|
260
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_normalize_ips(struct ddog_crasht_CrashInfo *crashinfo,
|
261
|
+
uint32_t pid);
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Adds a "counter" variable, with the given value. Useful for determining if
|
265
|
+
* "interesting" operations were occurring when the crash did.
|
266
|
+
*
|
267
|
+
* # Safety
|
268
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
269
|
+
* `name` should be a valid reference to a utf8 encoded String.
|
270
|
+
* The string is copied into the crashinfo, so it does not need to outlive this
|
271
|
+
* call.
|
272
|
+
*/
|
273
|
+
DDOG_CHECK_RETURN
|
274
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_add_counter(struct ddog_crasht_CrashInfo *crashinfo,
|
275
|
+
ddog_CharSlice name,
|
276
|
+
int64_t val);
|
277
|
+
|
278
|
+
/**
|
279
|
+
* Adds the contents of "file" to the crashinfo
|
280
|
+
*
|
281
|
+
* # Safety
|
282
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
283
|
+
* `name` should be a valid reference to a utf8 encoded String.
|
284
|
+
* The string is copied into the crashinfo, so it does not need to outlive this
|
285
|
+
* call.
|
286
|
+
*/
|
287
|
+
DDOG_CHECK_RETURN
|
288
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_add_file(struct ddog_crasht_CrashInfo *crashinfo,
|
289
|
+
ddog_CharSlice filename);
|
290
|
+
|
291
|
+
/**
|
292
|
+
* Adds the tag with given "key" and "value" to the crashinfo
|
293
|
+
*
|
294
|
+
* # Safety
|
295
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
296
|
+
* `key` should be a valid reference to a utf8 encoded String.
|
297
|
+
* `value` should be a valid reference to a utf8 encoded String.
|
298
|
+
* The string is copied into the crashinfo, so it does not need to outlive this
|
299
|
+
* call.
|
300
|
+
*/
|
301
|
+
DDOG_CHECK_RETURN
|
302
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_add_tag(struct ddog_crasht_CrashInfo *crashinfo,
|
303
|
+
ddog_CharSlice key,
|
304
|
+
ddog_CharSlice value);
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Sets the crashinfo metadata
|
308
|
+
*
|
309
|
+
* # Safety
|
310
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
311
|
+
* All references inside `metadata` must be valid.
|
312
|
+
* Strings are copied into the crashinfo, and do not need to outlive this call.
|
313
|
+
*/
|
314
|
+
DDOG_CHECK_RETURN
|
315
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_set_metadata(struct ddog_crasht_CrashInfo *crashinfo,
|
316
|
+
struct ddog_crasht_Metadata metadata);
|
317
|
+
|
318
|
+
/**
|
319
|
+
* Sets the crashinfo siginfo
|
320
|
+
*
|
321
|
+
* # Safety
|
322
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
323
|
+
* All references inside `metadata` must be valid.
|
324
|
+
* Strings are copied into the crashinfo, and do not need to outlive this call.
|
325
|
+
*/
|
326
|
+
DDOG_CHECK_RETURN
|
327
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_set_siginfo(struct ddog_crasht_CrashInfo *crashinfo,
|
328
|
+
struct ddog_crasht_SigInfo siginfo);
|
329
|
+
|
330
|
+
/**
|
331
|
+
* If `thread_id` is empty, sets `stacktrace` as the default stacktrace.
|
332
|
+
* Otherwise, adds an additional stacktrace with id "thread_id".
|
333
|
+
*
|
334
|
+
* # Safety
|
335
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
336
|
+
* All references inside `stacktraces` must be valid.
|
337
|
+
* Strings are copied into the crashinfo, and do not need to outlive this call.
|
338
|
+
*/
|
339
|
+
DDOG_CHECK_RETURN
|
340
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_set_stacktrace(struct ddog_crasht_CrashInfo *crashinfo,
|
341
|
+
ddog_CharSlice thread_id,
|
342
|
+
struct ddog_crasht_Slice_StackFrame stacktrace);
|
343
|
+
|
344
|
+
/**
|
345
|
+
* Sets the timestamp to the given unix timestamp
|
346
|
+
*
|
347
|
+
* # Safety
|
348
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
349
|
+
*/
|
350
|
+
DDOG_CHECK_RETURN
|
351
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_set_timestamp(struct ddog_crasht_CrashInfo *crashinfo,
|
352
|
+
struct ddog_Timespec ts);
|
353
|
+
|
354
|
+
/**
|
355
|
+
* Sets the timestamp to the current time
|
356
|
+
*
|
357
|
+
* # Safety
|
358
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
359
|
+
*/
|
360
|
+
DDOG_CHECK_RETURN
|
361
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_set_timestamp_to_now(struct ddog_crasht_CrashInfo *crashinfo);
|
362
|
+
|
363
|
+
/**
|
364
|
+
* Exports `crashinfo` to the backend at `endpoint`
|
365
|
+
* Note that we support the "file://" endpoint for local file output.
|
366
|
+
* # Safety
|
367
|
+
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
368
|
+
*/
|
369
|
+
DDOG_CHECK_RETURN
|
370
|
+
struct ddog_crasht_Result ddog_crasht_CrashInfo_upload_to_endpoint(struct ddog_crasht_CrashInfo *crashinfo,
|
371
|
+
const struct ddog_Endpoint *endpoint);
|
372
|
+
|
373
|
+
/**
|
374
|
+
* Demangles the string "name".
|
375
|
+
* If demangling fails, returns an empty string ""
|
376
|
+
*
|
377
|
+
* # Safety
|
378
|
+
* `name` should be a valid reference to a utf8 encoded String.
|
379
|
+
* The string is copied into the result, and does not need to outlive this call
|
380
|
+
*/
|
381
|
+
DDOG_CHECK_RETURN
|
382
|
+
struct ddog_crasht_StringWrapperResult ddog_crasht_demangle(ddog_CharSlice name,
|
383
|
+
enum ddog_crasht_DemangleOptions options);
|
384
|
+
|
385
|
+
/**
|
386
|
+
* Receives data from a crash collector via a pipe on `stdin`, formats it into
|
387
|
+
* `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
|
388
|
+
*
|
389
|
+
* At a high-level, this exists because doing anything in a
|
390
|
+
* signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
|
391
|
+
* allowed to do in the handler.
|
392
|
+
*
|
393
|
+
* See comments in [crashtracker/lib.rs] for a full architecture description.
|
394
|
+
* # Safety
|
395
|
+
* No safety concerns
|
396
|
+
*/
|
397
|
+
DDOG_CHECK_RETURN struct ddog_crasht_Result ddog_crasht_receiver_entry_point_stdin(void);
|
398
|
+
|
399
|
+
/**
|
400
|
+
* Receives data from a crash collector via a pipe on `stdin`, formats it into
|
401
|
+
* `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
|
402
|
+
*
|
403
|
+
* At a high-level, this exists because doing anything in a
|
404
|
+
* signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
|
405
|
+
* allowed to do in the handler.
|
406
|
+
*
|
407
|
+
* See comments in [profiling/crashtracker/mod.rs] for a full architecture
|
408
|
+
* description.
|
409
|
+
* # Safety
|
410
|
+
* No safety concerns
|
411
|
+
*/
|
412
|
+
DDOG_CHECK_RETURN
|
413
|
+
struct ddog_crasht_Result ddog_crasht_receiver_entry_point_unix_socket(ddog_CharSlice socket_path);
|
414
|
+
|
415
|
+
#ifdef __cplusplus
|
416
|
+
} // extern "C"
|
417
|
+
#endif // __cplusplus
|
418
|
+
|
419
|
+
#endif /* DDOG_CRASHTRACKER_H */
|
@@ -16,252 +16,6 @@
|
|
16
16
|
extern "C" {
|
17
17
|
#endif // __cplusplus
|
18
18
|
|
19
|
-
/**
|
20
|
-
* Cleans up after the crash-tracker:
|
21
|
-
* Unregister the crash handler, restore the previous handler (if any), and
|
22
|
-
* shut down the receiver. Note that the use of this function is optional:
|
23
|
-
* the receiver will automatically shutdown when the pipe is closed on program
|
24
|
-
* exit.
|
25
|
-
*
|
26
|
-
* # Preconditions
|
27
|
-
* This function assumes that the crash-tracker has previously been
|
28
|
-
* initialized.
|
29
|
-
* # Safety
|
30
|
-
* Crash-tracking functions are not reentrant.
|
31
|
-
* No other crash-handler functions should be called concurrently.
|
32
|
-
* # Atomicity
|
33
|
-
* This function is not atomic. A crash during its execution may lead to
|
34
|
-
* unexpected crash-handling behaviour.
|
35
|
-
*/
|
36
|
-
DDOG_CHECK_RETURN struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_shutdown(void);
|
37
|
-
|
38
|
-
/**
|
39
|
-
* Reinitialize the crash-tracking infrastructure after a fork.
|
40
|
-
* This should be one of the first things done after a fork, to minimize the
|
41
|
-
* chance that a crash occurs between the fork, and this call.
|
42
|
-
* In particular, reset the counters that track the profiler state machine,
|
43
|
-
* and start a new receiver to collect data from this fork.
|
44
|
-
* NOTE: An alternative design would be to have a 1:many sidecar listening on a
|
45
|
-
* socket instead of 1:1 receiver listening on a pipe, but the only real
|
46
|
-
* advantage would be to have fewer processes in `ps -a`.
|
47
|
-
*
|
48
|
-
* # Preconditions
|
49
|
-
* This function assumes that the crash-tracker has previously been
|
50
|
-
* initialized.
|
51
|
-
* # Safety
|
52
|
-
* Crash-tracking functions are not reentrant.
|
53
|
-
* No other crash-handler functions should be called concurrently.
|
54
|
-
* # Atomicity
|
55
|
-
* This function is not atomic. A crash during its execution may lead to
|
56
|
-
* unexpected crash-handling behaviour.
|
57
|
-
*/
|
58
|
-
DDOG_CHECK_RETURN
|
59
|
-
struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_update_on_fork(struct ddog_prof_CrashtrackerConfiguration config,
|
60
|
-
struct ddog_prof_CrashtrackerReceiverConfig receiver_config,
|
61
|
-
struct ddog_prof_CrashtrackerMetadata metadata);
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Receives data from a crash collector via a pipe on `stdin`, formats it into
|
65
|
-
* `CrashInfo` json, and emits it to the endpoint/file defined in `config`.
|
66
|
-
*
|
67
|
-
* At a high-level, this exists because doing anything in a
|
68
|
-
* signal handler is dangerous, so we fork a sidecar to do the stuff we aren't
|
69
|
-
* allowed to do in the handler.
|
70
|
-
*
|
71
|
-
* See comments in [profiling/crashtracker/mod.rs] for a full architecture
|
72
|
-
* description.
|
73
|
-
* # Safety
|
74
|
-
* No safety concerns
|
75
|
-
*/
|
76
|
-
DDOG_CHECK_RETURN
|
77
|
-
struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_receiver_entry_point(void);
|
78
|
-
|
79
|
-
/**
|
80
|
-
* Initialize the crash-tracking infrastructure.
|
81
|
-
*
|
82
|
-
* # Preconditions
|
83
|
-
* None.
|
84
|
-
* # Safety
|
85
|
-
* Crash-tracking functions are not reentrant.
|
86
|
-
* No other crash-handler functions should be called concurrently.
|
87
|
-
* # Atomicity
|
88
|
-
* This function is not atomic. A crash during its execution may lead to
|
89
|
-
* unexpected crash-handling behaviour.
|
90
|
-
*/
|
91
|
-
DDOG_CHECK_RETURN
|
92
|
-
struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_init(struct ddog_prof_CrashtrackerConfiguration config,
|
93
|
-
struct ddog_prof_CrashtrackerReceiverConfig receiver_config,
|
94
|
-
struct ddog_prof_CrashtrackerMetadata metadata);
|
95
|
-
|
96
|
-
/**
|
97
|
-
* Resets all counters to 0.
|
98
|
-
* Expected to be used after a fork, to reset the counters on the child
|
99
|
-
* ATOMICITY:
|
100
|
-
* This is NOT ATOMIC.
|
101
|
-
* Should only be used when no conflicting updates can occur,
|
102
|
-
* e.g. after a fork but before profiling ops start on the child.
|
103
|
-
* # Safety
|
104
|
-
* No safety concerns.
|
105
|
-
*/
|
106
|
-
DDOG_CHECK_RETURN struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_reset_counters(void);
|
107
|
-
|
108
|
-
/**
|
109
|
-
* Atomically increments the count associated with `op`.
|
110
|
-
* Useful for tracking what operations were occuring when a crash occurred.
|
111
|
-
*
|
112
|
-
* # Safety
|
113
|
-
* No safety concerns.
|
114
|
-
*/
|
115
|
-
DDOG_CHECK_RETURN
|
116
|
-
struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_begin_profiling_op(enum ddog_prof_ProfilingOpTypes op);
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Atomically decrements the count associated with `op`.
|
120
|
-
* Useful for tracking what operations were occuring when a crash occurred.
|
121
|
-
*
|
122
|
-
* # Safety
|
123
|
-
* No safety concerns.
|
124
|
-
*/
|
125
|
-
DDOG_CHECK_RETURN
|
126
|
-
struct ddog_prof_CrashtrackerResult ddog_prof_Crashtracker_end_profiling_op(enum ddog_prof_ProfilingOpTypes op);
|
127
|
-
|
128
|
-
/**
|
129
|
-
* Create a new crashinfo, and returns an opaque reference to it.
|
130
|
-
* # Safety
|
131
|
-
* No safety issues.
|
132
|
-
*/
|
133
|
-
DDOG_CHECK_RETURN struct ddog_prof_CrashInfoNewResult ddog_crashinfo_new(void);
|
134
|
-
|
135
|
-
/**
|
136
|
-
* # Safety
|
137
|
-
* The `crash_info` can be null, but if non-null it must point to a CrashInfo
|
138
|
-
* made by this module, which has not previously been dropped.
|
139
|
-
*/
|
140
|
-
void ddog_crashinfo_drop(struct ddog_prof_CrashInfo *crashinfo);
|
141
|
-
|
142
|
-
/**
|
143
|
-
* Adds a "counter" variable, with the given value. Useful for determining if
|
144
|
-
* "interesting" operations were occurring when the crash did.
|
145
|
-
*
|
146
|
-
* # Safety
|
147
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
148
|
-
* `name` should be a valid reference to a utf8 encoded String.
|
149
|
-
* The string is copied into the crashinfo, so it does not need to outlive this
|
150
|
-
* call.
|
151
|
-
*/
|
152
|
-
DDOG_CHECK_RETURN
|
153
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_add_counter(struct ddog_prof_CrashInfo *crashinfo,
|
154
|
-
ddog_CharSlice name,
|
155
|
-
int64_t val);
|
156
|
-
|
157
|
-
/**
|
158
|
-
* Adds the contents of "file" to the crashinfo
|
159
|
-
*
|
160
|
-
* # Safety
|
161
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
162
|
-
* `name` should be a valid reference to a utf8 encoded String.
|
163
|
-
* The string is copied into the crashinfo, so it does not need to outlive this
|
164
|
-
* call.
|
165
|
-
*/
|
166
|
-
DDOG_CHECK_RETURN
|
167
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_add_file(struct ddog_prof_CrashInfo *crashinfo,
|
168
|
-
ddog_CharSlice name);
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Adds the tag with given "key" and "value" to the crashinfo
|
172
|
-
*
|
173
|
-
* # Safety
|
174
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
175
|
-
* `key` should be a valid reference to a utf8 encoded String.
|
176
|
-
* `value` should be a valid reference to a utf8 encoded String.
|
177
|
-
* The string is copied into the crashinfo, so it does not need to outlive this
|
178
|
-
* call.
|
179
|
-
*/
|
180
|
-
DDOG_CHECK_RETURN
|
181
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_add_tag(struct ddog_prof_CrashInfo *crashinfo,
|
182
|
-
ddog_CharSlice key,
|
183
|
-
ddog_CharSlice value);
|
184
|
-
|
185
|
-
/**
|
186
|
-
* Sets the crashinfo metadata
|
187
|
-
*
|
188
|
-
* # Safety
|
189
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
190
|
-
* All references inside `metadata` must be valid.
|
191
|
-
* Strings are copied into the crashinfo, and do not need to outlive this call.
|
192
|
-
*/
|
193
|
-
DDOG_CHECK_RETURN
|
194
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_set_metadata(struct ddog_prof_CrashInfo *crashinfo,
|
195
|
-
struct ddog_prof_CrashtrackerMetadata metadata);
|
196
|
-
|
197
|
-
/**
|
198
|
-
* Sets the crashinfo siginfo
|
199
|
-
*
|
200
|
-
* # Safety
|
201
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
202
|
-
* All references inside `metadata` must be valid.
|
203
|
-
* Strings are copied into the crashinfo, and do not need to outlive this call.
|
204
|
-
*/
|
205
|
-
DDOG_CHECK_RETURN
|
206
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_set_siginfo(struct ddog_prof_CrashInfo *crashinfo,
|
207
|
-
struct ddog_prof_SigInfo siginfo);
|
208
|
-
|
209
|
-
/**
|
210
|
-
* If `thread_id` is empty, sets `stacktrace` as the default stacktrace.
|
211
|
-
* Otherwise, adds an additional stacktrace with id "thread_id".
|
212
|
-
*
|
213
|
-
* # Safety
|
214
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
215
|
-
* All references inside `stacktraces` must be valid.
|
216
|
-
* Strings are copied into the crashinfo, and do not need to outlive this call.
|
217
|
-
*/
|
218
|
-
DDOG_CHECK_RETURN
|
219
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_set_stacktrace(struct ddog_prof_CrashInfo *crashinfo,
|
220
|
-
ddog_CharSlice thread_id,
|
221
|
-
struct ddog_prof_Slice_StackFrame stacktrace);
|
222
|
-
|
223
|
-
/**
|
224
|
-
* Sets the timestamp to the given unix timestamp
|
225
|
-
*
|
226
|
-
* # Safety
|
227
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
228
|
-
*/
|
229
|
-
DDOG_CHECK_RETURN
|
230
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_set_timestamp(struct ddog_prof_CrashInfo *crashinfo,
|
231
|
-
int64_t secs,
|
232
|
-
uint32_t nsecs);
|
233
|
-
|
234
|
-
/**
|
235
|
-
* Sets the timestamp to the current time
|
236
|
-
*
|
237
|
-
* # Safety
|
238
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
239
|
-
*/
|
240
|
-
DDOG_CHECK_RETURN
|
241
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_set_timestamp_to_now(struct ddog_prof_CrashInfo *crashinfo);
|
242
|
-
|
243
|
-
/**
|
244
|
-
* Exports `crashinfo` to the backend at `endpoint`
|
245
|
-
* Note that we support the "file://" endpoint for local file output.
|
246
|
-
* # Safety
|
247
|
-
* `crashinfo` must be a valid pointer to a `CrashInfo` object.
|
248
|
-
*/
|
249
|
-
DDOG_CHECK_RETURN
|
250
|
-
struct ddog_prof_CrashtrackerResult ddog_crashinfo_upload_to_endpoint(struct ddog_prof_CrashInfo *crashinfo,
|
251
|
-
struct ddog_prof_CrashtrackerConfiguration config);
|
252
|
-
|
253
|
-
/**
|
254
|
-
* Demangles the string "name".
|
255
|
-
* If demangling fails, returns an empty string ""
|
256
|
-
*
|
257
|
-
* # Safety
|
258
|
-
* `name` should be a valid reference to a utf8 encoded String.
|
259
|
-
* The string is copied into the result, and does not need to outlive this call
|
260
|
-
*/
|
261
|
-
DDOG_CHECK_RETURN
|
262
|
-
struct ddog_prof_StringWrapperResult ddog_demangle(ddog_CharSlice name,
|
263
|
-
enum ddog_prof_DemangleOptions options);
|
264
|
-
|
265
19
|
DDOG_CHECK_RETURN struct ddog_prof_Exporter_Slice_File ddog_prof_Exporter_Slice_File_empty(void);
|
266
20
|
|
267
21
|
/**
|
@@ -312,6 +66,15 @@ struct ddog_prof_Exporter_NewResult ddog_prof_Exporter_new(ddog_CharSlice profil
|
|
312
66
|
const struct ddog_Vec_Tag *tags,
|
313
67
|
struct ddog_prof_Endpoint endpoint);
|
314
68
|
|
69
|
+
/**
|
70
|
+
* Sets the value for the exporter's timeout.
|
71
|
+
* # Arguments
|
72
|
+
* * `exporter` - ProfileExporter instance.
|
73
|
+
* * `timeout_ms` - timeout in milliseconds.
|
74
|
+
*/
|
75
|
+
ddog_prof_MaybeError ddog_prof_Exporter_set_timeout(struct ddog_prof_Exporter *exporter,
|
76
|
+
uint64_t timeout_ms);
|
77
|
+
|
315
78
|
/**
|
316
79
|
* # Safety
|
317
80
|
* The `exporter` may be null, but if non-null the pointer must point to a
|
@@ -347,8 +110,7 @@ struct ddog_prof_Exporter_Request_BuildResult ddog_prof_Exporter_Request_build(s
|
|
347
110
|
const struct ddog_Vec_Tag *optional_additional_tags,
|
348
111
|
const struct ddog_prof_ProfiledEndpointsStats *optional_endpoints_stats,
|
349
112
|
const ddog_CharSlice *optional_internal_metadata_json,
|
350
|
-
const ddog_CharSlice *optional_info_json
|
351
|
-
uint64_t timeout_ms);
|
113
|
+
const ddog_CharSlice *optional_info_json);
|
352
114
|
|
353
115
|
/**
|
354
116
|
* # Safety
|