libdatadog 7.0.0.1.0-aarch64-linux → 9.0.0.1.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/lib/libdatadog.rb +8 -0
  4. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE-3rdparty.yml +843 -183
  5. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  6. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/common.h +257 -45
  7. data/vendor/{libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-9.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/profiling.h +245 -8
  8. data/vendor/libdatadog-9.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +288 -0
  9. data/vendor/libdatadog-9.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  10. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE-3rdparty.yml +843 -183
  11. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  12. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/common.h +257 -45
  13. data/vendor/{libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-9.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/profiling.h +245 -8
  14. data/vendor/libdatadog-9.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +288 -0
  15. data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  16. metadata +22 -22
  17. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +0 -290
  18. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  19. data/vendor/libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +0 -290
  20. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
  21. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
  22. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +0 -0
  23. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
  24. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
  25. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
  26. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +0 -0
  27. /data/vendor/{libdatadog-7.0.0 → libdatadog-9.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
@@ -83,6 +83,32 @@ typedef struct ddog_Slice_CChar {
83
83
  */
84
84
  typedef struct ddog_Slice_CChar ddog_CharSlice;
85
85
 
86
+ typedef enum ddog_Option_Error_Tag {
87
+ DDOG_OPTION_ERROR_SOME_ERROR,
88
+ DDOG_OPTION_ERROR_NONE_ERROR,
89
+ } ddog_Option_Error_Tag;
90
+
91
+ typedef struct ddog_Option_Error {
92
+ ddog_Option_Error_Tag tag;
93
+ union {
94
+ struct {
95
+ struct ddog_Error some;
96
+ };
97
+ };
98
+ } ddog_Option_Error;
99
+
100
+ typedef struct ddog_Option_Error ddog_MaybeError;
101
+
102
+ /**
103
+ * A wrapper for returning owned strings from FFI
104
+ */
105
+ typedef struct ddog_StringWrapper {
106
+ /**
107
+ * This is a String stuffed into the vec.
108
+ */
109
+ struct ddog_Vec_U8 message;
110
+ } ddog_StringWrapper;
111
+
86
112
  /**
87
113
  * Holds the raw parts of a Rust Vec; it should only be created from Rust,
88
114
  * never from C.
@@ -112,14 +138,10 @@ typedef struct ddog_Vec_Tag_ParseResult {
112
138
  struct ddog_Error *error_message;
113
139
  } ddog_Vec_Tag_ParseResult;
114
140
 
115
- typedef enum ddog_prof_CrashtrackerResolveFrames {
116
- DDOG_PROF_CRASHTRACKER_RESOLVE_FRAMES_NEVER,
117
- /**
118
- * Resolving frames in process is experimental, and can fail/crash
119
- */
120
- DDOG_PROF_CRASHTRACKER_RESOLVE_FRAMES_EXPERIMENTAL_IN_PROCESS,
121
- DDOG_PROF_CRASHTRACKER_RESOLVE_FRAMES_IN_RECEIVER,
122
- } ddog_prof_CrashtrackerResolveFrames;
141
+ typedef enum ddog_prof_DemangleOptions {
142
+ DDOG_PROF_DEMANGLE_OPTIONS_COMPLETE,
143
+ DDOG_PROF_DEMANGLE_OPTIONS_NAME_ONLY,
144
+ } ddog_prof_DemangleOptions;
123
145
 
124
146
  /**
125
147
  * This enum represents operations a profiler might be engaged in.
@@ -143,6 +165,22 @@ typedef enum ddog_prof_ProfilingOpTypes {
143
165
  DDOG_PROF_PROFILING_OP_TYPES_SIZE,
144
166
  } ddog_prof_ProfilingOpTypes;
145
167
 
168
+ /**
169
+ * Stacktrace collection occurs in the context of a crashing process.
170
+ * If the stack is sufficiently corruputed, it is possible (but unlikely),
171
+ * for stack trace collection itself to crash.
172
+ * We recommend fully enabling stacktrace collection, but having an environment
173
+ * variable to allow downgrading the collector.
174
+ */
175
+ typedef enum ddog_prof_StacktraceCollection {
176
+ /**
177
+ * Stacktrace collection occurs in the
178
+ */
179
+ DDOG_PROF_STACKTRACE_COLLECTION_DISABLED,
180
+ DDOG_PROF_STACKTRACE_COLLECTION_WITHOUT_SYMBOLS,
181
+ DDOG_PROF_STACKTRACE_COLLECTION_ENABLED,
182
+ } ddog_prof_StacktraceCollection;
183
+
146
184
  typedef struct ddog_CancellationToken ddog_CancellationToken;
147
185
 
148
186
  typedef struct ddog_prof_Exporter ddog_prof_Exporter;
@@ -152,16 +190,16 @@ typedef struct ddog_prof_ProfiledEndpointsStats ddog_prof_ProfiledEndpointsStats
152
190
  typedef struct ddog_prof_Exporter_Request ddog_prof_Exporter_Request;
153
191
 
154
192
  /**
155
- * A generic result type for when a profiling operation may fail, but there's
156
- * nothing to return in the case of success.
193
+ * A generic result type for when a crashtracking operation may fail,
194
+ * but there's nothing to return in the case of success.
157
195
  */
158
- typedef enum ddog_prof_Profile_Result_Tag {
159
- DDOG_PROF_PROFILE_RESULT_OK,
160
- DDOG_PROF_PROFILE_RESULT_ERR,
161
- } ddog_prof_Profile_Result_Tag;
196
+ typedef enum ddog_prof_CrashtrackerResult_Tag {
197
+ DDOG_PROF_CRASHTRACKER_RESULT_OK,
198
+ DDOG_PROF_CRASHTRACKER_RESULT_ERR,
199
+ } ddog_prof_CrashtrackerResult_Tag;
162
200
 
163
- typedef struct ddog_prof_Profile_Result {
164
- ddog_prof_Profile_Result_Tag tag;
201
+ typedef struct ddog_prof_CrashtrackerResult {
202
+ ddog_prof_CrashtrackerResult_Tag tag;
165
203
  union {
166
204
  struct {
167
205
  /**
@@ -174,11 +212,24 @@ typedef struct ddog_prof_Profile_Result {
174
212
  struct ddog_Error err;
175
213
  };
176
214
  };
177
- } ddog_prof_Profile_Result;
215
+ } ddog_prof_CrashtrackerResult;
216
+
217
+ typedef struct ddog_prof_Slice_CharSlice {
218
+ /**
219
+ * Must be non-null and suitably aligned for the underlying type.
220
+ */
221
+ const ddog_CharSlice *ptr;
222
+ /**
223
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
224
+ * than or equal to [isize::MAX].
225
+ */
226
+ uintptr_t len;
227
+ } ddog_prof_Slice_CharSlice;
178
228
 
179
229
  typedef enum ddog_prof_Endpoint_Tag {
180
230
  DDOG_PROF_ENDPOINT_AGENT,
181
231
  DDOG_PROF_ENDPOINT_AGENTLESS,
232
+ DDOG_PROF_ENDPOINT_FILE,
182
233
  } ddog_prof_Endpoint_Tag;
183
234
 
184
235
  typedef struct ddog_prof_Endpoint_ddog_prof_Agentless_Body {
@@ -193,19 +244,44 @@ typedef struct ddog_prof_Endpoint {
193
244
  ddog_CharSlice agent;
194
245
  };
195
246
  ddog_prof_Endpoint_ddog_prof_Agentless_Body AGENTLESS;
247
+ struct {
248
+ ddog_CharSlice file;
249
+ };
196
250
  };
197
251
  } ddog_prof_Endpoint;
198
252
 
199
253
  typedef struct ddog_prof_CrashtrackerConfiguration {
200
- /**
201
- * Should the crashtracker attempt to collect a stacktrace for the crash
202
- */
203
- bool collect_stacktrace;
254
+ struct ddog_prof_Slice_CharSlice additional_files;
204
255
  bool create_alt_stack;
205
256
  /**
206
- * The endpoint to send the crash repor to (can be a file://)
257
+ * The endpoint to send the crash report to (can be a file://)
207
258
  */
208
259
  struct ddog_prof_Endpoint endpoint;
260
+ enum ddog_prof_StacktraceCollection resolve_frames;
261
+ uint64_t timeout_secs;
262
+ } ddog_prof_CrashtrackerConfiguration;
263
+
264
+ typedef struct ddog_prof_EnvVar {
265
+ ddog_CharSlice key;
266
+ ddog_CharSlice val;
267
+ } ddog_prof_EnvVar;
268
+
269
+ typedef struct ddog_prof_Slice_EnvVar {
270
+ /**
271
+ * Must be non-null and suitably aligned for the underlying type.
272
+ */
273
+ const struct ddog_prof_EnvVar *ptr;
274
+ /**
275
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
276
+ * than or equal to [isize::MAX].
277
+ */
278
+ uintptr_t len;
279
+ } ddog_prof_Slice_EnvVar;
280
+
281
+ typedef struct ddog_prof_CrashtrackerReceiverConfig {
282
+ struct ddog_prof_Slice_CharSlice args;
283
+ struct ddog_prof_Slice_EnvVar env;
284
+ ddog_CharSlice path_to_receiver_binary;
209
285
  /**
210
286
  * Optional filename to forward stderr to (useful for logging/debugging)
211
287
  */
@@ -214,12 +290,7 @@ typedef struct ddog_prof_CrashtrackerConfiguration {
214
290
  * Optional filename to forward stdout to (useful for logging/debugging)
215
291
  */
216
292
  ddog_CharSlice optional_stdout_filename;
217
- ddog_CharSlice path_to_receiver_binary;
218
- /**
219
- * Whether/when we should attempt to resolve frames
220
- */
221
- enum ddog_prof_CrashtrackerResolveFrames resolve_frames;
222
- } ddog_prof_CrashtrackerConfiguration;
293
+ } ddog_prof_CrashtrackerReceiverConfig;
223
294
 
224
295
  typedef struct ddog_prof_CrashtrackerMetadata {
225
296
  ddog_CharSlice profiling_library_name;
@@ -231,6 +302,122 @@ typedef struct ddog_prof_CrashtrackerMetadata {
231
302
  const struct ddog_Vec_Tag *tags;
232
303
  } ddog_prof_CrashtrackerMetadata;
233
304
 
305
+ /**
306
+ * Represents a CrashInfo. Do not access its member for any reason, only use
307
+ * the C API functions on this struct.
308
+ */
309
+ typedef struct ddog_prof_CrashInfo {
310
+ struct ddog_prof_CrashInfo *inner;
311
+ } ddog_prof_CrashInfo;
312
+
313
+ /**
314
+ * Returned by [ddog_prof_Profile_new].
315
+ */
316
+ typedef enum ddog_prof_CrashInfoNewResult_Tag {
317
+ DDOG_PROF_CRASH_INFO_NEW_RESULT_OK,
318
+ DDOG_PROF_CRASH_INFO_NEW_RESULT_ERR,
319
+ } ddog_prof_CrashInfoNewResult_Tag;
320
+
321
+ typedef struct ddog_prof_CrashInfoNewResult {
322
+ ddog_prof_CrashInfoNewResult_Tag tag;
323
+ union {
324
+ struct {
325
+ struct ddog_prof_CrashInfo ok;
326
+ };
327
+ struct {
328
+ struct ddog_Error err;
329
+ };
330
+ };
331
+ } ddog_prof_CrashInfoNewResult;
332
+
333
+ typedef struct ddog_prof_SigInfo {
334
+ uint64_t signum;
335
+ ddog_CharSlice signame;
336
+ } ddog_prof_SigInfo;
337
+
338
+ typedef enum ddog_prof_Option_U32_Tag {
339
+ DDOG_PROF_OPTION_U32_SOME_U32,
340
+ DDOG_PROF_OPTION_U32_NONE_U32,
341
+ } ddog_prof_Option_U32_Tag;
342
+
343
+ typedef struct ddog_prof_Option_U32 {
344
+ ddog_prof_Option_U32_Tag tag;
345
+ union {
346
+ struct {
347
+ uint32_t some;
348
+ };
349
+ };
350
+ } ddog_prof_Option_U32;
351
+
352
+ typedef struct ddog_prof_StackFrameNames {
353
+ struct ddog_prof_Option_U32 colno;
354
+ ddog_CharSlice filename;
355
+ struct ddog_prof_Option_U32 lineno;
356
+ ddog_CharSlice name;
357
+ } ddog_prof_StackFrameNames;
358
+
359
+ typedef struct ddog_prof_Slice_StackFrameNames {
360
+ /**
361
+ * Must be non-null and suitably aligned for the underlying type.
362
+ */
363
+ const struct ddog_prof_StackFrameNames *ptr;
364
+ /**
365
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
366
+ * than or equal to [isize::MAX].
367
+ */
368
+ uintptr_t len;
369
+ } ddog_prof_Slice_StackFrameNames;
370
+
371
+ typedef struct ddog_prof_StackFrame {
372
+ uintptr_t ip;
373
+ uintptr_t module_base_address;
374
+ struct ddog_prof_Slice_StackFrameNames names;
375
+ uintptr_t sp;
376
+ uintptr_t symbol_address;
377
+ } ddog_prof_StackFrame;
378
+
379
+ typedef struct ddog_prof_Slice_StackFrame {
380
+ /**
381
+ * Must be non-null and suitably aligned for the underlying type.
382
+ */
383
+ const struct ddog_prof_StackFrame *ptr;
384
+ /**
385
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
386
+ * than or equal to [isize::MAX].
387
+ */
388
+ uintptr_t len;
389
+ } ddog_prof_Slice_StackFrame;
390
+
391
+ /**
392
+ * A wrapper for returning owned strings from FFI
393
+ */
394
+ typedef struct ddog_prof_StringWrapper {
395
+ /**
396
+ * This is a String stuffed into the vec.
397
+ */
398
+ struct ddog_Vec_U8 message;
399
+ } ddog_prof_StringWrapper;
400
+
401
+ /**
402
+ * Returned by [ddog_prof_Profile_new].
403
+ */
404
+ typedef enum ddog_prof_StringWrapperResult_Tag {
405
+ DDOG_PROF_STRING_WRAPPER_RESULT_OK,
406
+ DDOG_PROF_STRING_WRAPPER_RESULT_ERR,
407
+ } ddog_prof_StringWrapperResult_Tag;
408
+
409
+ typedef struct ddog_prof_StringWrapperResult {
410
+ ddog_prof_StringWrapperResult_Tag tag;
411
+ union {
412
+ struct {
413
+ struct ddog_prof_StringWrapper ok;
414
+ };
415
+ struct {
416
+ struct ddog_Error err;
417
+ };
418
+ };
419
+ } ddog_prof_StringWrapperResult;
420
+
234
421
  typedef struct ddog_Slice_U8 {
235
422
  /**
236
423
  * Must be non-null and suitably aligned for the underlying type.
@@ -378,6 +565,31 @@ typedef struct ddog_prof_Period {
378
565
  int64_t value;
379
566
  } ddog_prof_Period;
380
567
 
568
+ /**
569
+ * A generic result type for when a profiling operation may fail, but there's
570
+ * nothing to return in the case of success.
571
+ */
572
+ typedef enum ddog_prof_Profile_Result_Tag {
573
+ DDOG_PROF_PROFILE_RESULT_OK,
574
+ DDOG_PROF_PROFILE_RESULT_ERR,
575
+ } ddog_prof_Profile_Result_Tag;
576
+
577
+ typedef struct ddog_prof_Profile_Result {
578
+ ddog_prof_Profile_Result_Tag tag;
579
+ union {
580
+ struct {
581
+ /**
582
+ * Do not use the value of Ok. This value only exists to overcome
583
+ * Rust -> C code generation.
584
+ */
585
+ bool ok;
586
+ };
587
+ struct {
588
+ struct ddog_Error err;
589
+ };
590
+ };
591
+ } ddog_prof_Profile_Result;
592
+
381
593
  typedef struct ddog_prof_Mapping {
382
594
  /**
383
595
  * Address at which the binary (or DLL) is loaded into memory.
@@ -618,27 +830,11 @@ typedef struct ddog_TelemetryWorkerBuilder ddog_TelemetryWorkerBuilder;
618
830
  *
619
831
  * The worker won't send data to the agent until you call `TelemetryWorkerHandle::send_start`
620
832
  *
621
- * To stop the worker, call `TelemetryWorkerHandle::send_stop` which trigger flush aynchronously
833
+ * To stop the worker, call `TelemetryWorkerHandle::send_stop` which trigger flush asynchronously
622
834
  * then `TelemetryWorkerHandle::wait_for_shutdown`
623
835
  */
624
836
  typedef struct ddog_TelemetryWorkerHandle ddog_TelemetryWorkerHandle;
625
837
 
626
- typedef enum ddog_Option_VecU8_Tag {
627
- DDOG_OPTION_VEC_U8_SOME_VEC_U8,
628
- DDOG_OPTION_VEC_U8_NONE_VEC_U8,
629
- } ddog_Option_VecU8_Tag;
630
-
631
- typedef struct ddog_Option_VecU8 {
632
- ddog_Option_VecU8_Tag tag;
633
- union {
634
- struct {
635
- struct ddog_Vec_U8 some;
636
- };
637
- };
638
- } ddog_Option_VecU8;
639
-
640
- typedef struct ddog_Option_VecU8 ddog_MaybeError;
641
-
642
838
  typedef enum ddog_Option_Bool_Tag {
643
839
  DDOG_OPTION_BOOL_SOME_BOOL,
644
840
  DDOG_OPTION_BOOL_NONE_BOOL,
@@ -676,6 +872,8 @@ void ddog_Error_drop(struct ddog_Error *error);
676
872
  */
677
873
  ddog_CharSlice ddog_Error_message(const struct ddog_Error *error);
678
874
 
875
+ void ddog_MaybeError_drop(ddog_MaybeError);
876
+
679
877
  DDOG_CHECK_RETURN struct ddog_Endpoint *ddog_endpoint_from_url(ddog_CharSlice url);
680
878
 
681
879
  DDOG_CHECK_RETURN struct ddog_Endpoint *ddog_endpoint_from_api_key(ddog_CharSlice api_key);
@@ -687,6 +885,20 @@ struct ddog_Error *ddog_endpoint_from_api_key_and_site(ddog_CharSlice api_key,
687
885
 
688
886
  void ddog_endpoint_drop(struct ddog_Endpoint*);
689
887
 
888
+ /**
889
+ * # Safety
890
+ * Only pass null or a valid reference to a `ddog_StringWrapper`.
891
+ */
892
+ void ddog_StringWrapper_drop(struct ddog_StringWrapper *s);
893
+
894
+ /**
895
+ * Returns a CharSlice of the message that is valid until the StringWrapper
896
+ * is dropped.
897
+ * # Safety
898
+ * Only pass null or a valid reference to a `ddog_StringWrapper`.
899
+ */
900
+ ddog_CharSlice ddog_StringWrapper_message(const struct ddog_StringWrapper *s);
901
+
690
902
  DDOG_CHECK_RETURN struct ddog_Vec_Tag ddog_Vec_Tag_new(void);
691
903
 
692
904
  void ddog_Vec_Tag_drop(struct ddog_Vec_Tag);
@@ -16,23 +16,251 @@
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
+ */
19
152
  DDOG_CHECK_RETURN
20
- struct ddog_prof_Profile_Result ddog_prof_Crashtracker_begin_profiling_op(enum ddog_prof_ProfilingOpTypes op);
153
+ struct ddog_prof_CrashtrackerResult ddog_crashinfo_add_counter(struct ddog_prof_CrashInfo *crashinfo,
154
+ ddog_CharSlice name,
155
+ int64_t val);
21
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
+ */
22
166
  DDOG_CHECK_RETURN
23
- struct ddog_prof_Profile_Result ddog_prof_Crashtracker_end_profiling_op(enum ddog_prof_ProfilingOpTypes op);
167
+ struct ddog_prof_CrashtrackerResult ddog_crashinfo_add_file(struct ddog_prof_CrashInfo *crashinfo,
168
+ ddog_CharSlice name);
24
169
 
25
- DDOG_CHECK_RETURN struct ddog_prof_Profile_Result ddog_prof_Crashtracker_shutdown(void);
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);
26
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
+ */
27
193
  DDOG_CHECK_RETURN
28
- struct ddog_prof_Profile_Result ddog_prof_Crashtracker_update_on_fork(struct ddog_prof_CrashtrackerConfiguration config,
29
- struct ddog_prof_CrashtrackerMetadata metadata);
194
+ struct ddog_prof_CrashtrackerResult ddog_crashinfo_set_metadata(struct ddog_prof_CrashInfo *crashinfo,
195
+ struct ddog_prof_CrashtrackerMetadata metadata);
30
196
 
31
- DDOG_CHECK_RETURN struct ddog_prof_Profile_Result ddog_prof_Crashtracker_receiver_entry_point(void);
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);
32
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
+ */
33
218
  DDOG_CHECK_RETURN
34
- struct ddog_prof_Profile_Result ddog_prof_Crashtracker_init(struct ddog_prof_CrashtrackerConfiguration config,
35
- struct ddog_prof_CrashtrackerMetadata metadata);
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);
36
264
 
37
265
  DDOG_CHECK_RETURN struct ddog_prof_Exporter_Slice_File ddog_prof_Exporter_Slice_File_empty(void);
38
266
 
@@ -51,6 +279,15 @@ struct ddog_prof_Endpoint ddog_prof_Endpoint_agent(ddog_CharSlice base_url);
51
279
  */
52
280
  struct ddog_prof_Endpoint ddog_prof_Endpoint_agentless(ddog_CharSlice site, ddog_CharSlice api_key);
53
281
 
282
+ /**
283
+ * Creates an endpoint that writes to a file.
284
+ * Useful for local debugging.
285
+ * Currently only supported by the crashtracker.
286
+ * # Arguments
287
+ * * `filename` - Path to the output file "/tmp/file.txt".
288
+ */
289
+ struct ddog_prof_Endpoint ddog_Endpoint_file(ddog_CharSlice filename);
290
+
54
291
  /**
55
292
  * Creates a new exporter to be used to report profiling data.
56
293
  * # Arguments