libdatadog 11.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.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +247 -2
  4. data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  5. data/vendor/{libdatadog-11.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/common.h +495 -285
  6. data/vendor/libdatadog-12.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +419 -0
  7. data/vendor/{libdatadog-11.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 -275
  8. data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  9. data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +247 -2
  10. data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  11. data/vendor/{libdatadog-11.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/common.h +495 -285
  12. data/vendor/libdatadog-12.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/crashtracker.h +419 -0
  13. data/vendor/{libdatadog-11.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 -275
  14. data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  15. metadata +24 -22
  16. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
  17. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
  18. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +0 -0
  19. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
  20. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  21. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
  22. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
  23. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +0 -0
  24. /data/vendor/{libdatadog-11.0.0 → libdatadog-12.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
  25. /data/vendor/{libdatadog-11.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 */