libdatadog 25.0.0.1.0 → 26.0.0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/lib/libdatadog.rb +6 -0
  4. data/vendor/{libdatadog-25.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/LICENSE-3rdparty.yml +11292 -5944
  5. data/vendor/{libdatadog-25.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/common.h +156 -179
  6. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/profiling.h +32 -62
  7. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  8. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  9. data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/LICENSE-3rdparty.yml +11292 -5944
  10. data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/common.h +156 -179
  11. data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/profiling.h +32 -62
  12. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  13. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  14. data/vendor/{libdatadog-25.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/LICENSE-3rdparty.yml +11292 -5944
  15. data/vendor/libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin/bin/libdatadog-crashtracking-receiver +0 -0
  16. data/vendor/{libdatadog-25.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/common.h +156 -179
  17. data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/profiling.h +32 -62
  18. data/vendor/libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin/lib/libdatadog_profiling.dylib +0 -0
  19. data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  20. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +202 -0
  21. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +55070 -0
  22. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +4 -0
  23. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +1497 -0
  24. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/common.h +2651 -0
  25. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +953 -0
  26. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/data-pipeline.h +183 -0
  27. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/ddsketch.h +89 -0
  28. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/ffe.h +175 -0
  29. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/library-config.h +113 -0
  30. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/log.h +63 -0
  31. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/profiling.h +941 -0
  32. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +286 -0
  33. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  34. data/vendor/libdatadog-26.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +15 -0
  35. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +11292 -5944
  36. data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/common.h +156 -179
  37. data/vendor/{libdatadog-25.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +32 -62
  38. data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  39. data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/lib/pkgconfig/datadog_profiling_with_rpath.pc +1 -1
  40. metadata +81 -65
  41. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
  42. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
  43. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  44. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +0 -0
  45. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/crashtracker.h +0 -0
  46. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/data-pipeline.h +0 -0
  47. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/ddsketch.h +0 -0
  48. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/ffe.h +0 -0
  49. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/library-config.h +0 -0
  50. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/log.h +0 -0
  51. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +0 -0
  52. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
  53. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
  54. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  55. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +0 -0
  56. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/crashtracker.h +0 -0
  57. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/data-pipeline.h +0 -0
  58. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/ddsketch.h +0 -0
  59. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/ffe.h +0 -0
  60. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/library-config.h +0 -0
  61. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/log.h +0 -0
  62. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +0 -0
  63. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/LICENSE +0 -0
  64. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/NOTICE +0 -0
  65. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/blazesym.h +0 -0
  66. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/crashtracker.h +0 -0
  67. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/data-pipeline.h +0 -0
  68. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/ddsketch.h +0 -0
  69. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/ffe.h +0 -0
  70. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/library-config.h +0 -0
  71. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/log.h +0 -0
  72. /data/vendor/{libdatadog-25.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-26.0.0/arm64-darwin/libdatadog-aarch64-apple-darwin}/include/datadog/telemetry.h +0 -0
  73. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  74. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/LICENSE +0 -0
  75. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/NOTICE +0 -0
  76. /data/vendor/{libdatadog-25.0.0 → libdatadog-26.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  77. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/blazesym.h +0 -0
  78. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/crashtracker.h +0 -0
  79. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/data-pipeline.h +0 -0
  80. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/ddsketch.h +0 -0
  81. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/ffe.h +0 -0
  82. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/library-config.h +0 -0
  83. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/log.h +0 -0
  84. /data/vendor/{libdatadog-25.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-26.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/telemetry.h +0 -0
@@ -0,0 +1,2651 @@
1
+ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_COMMON_H
6
+ #define DDOG_COMMON_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #define DDOG_CHARSLICE_C(string) \
15
+ /* NOTE: Compilation fails if you pass in a char* instead of a literal */ ((ddog_CharSlice){ .ptr = "" string, .len = sizeof(string) - 1 })
16
+
17
+ #define DDOG_CHARSLICE_C_BARE(string) \
18
+ /* NOTE: Compilation fails if you pass in a char* instead of a literal */ { .ptr = "" string, .len = sizeof(string) - 1 }
19
+
20
+ #if defined __GNUC__
21
+ # define DDOG_GNUC_VERSION(major) __GNUC__ >= major
22
+ #else
23
+ # define DDOG_GNUC_VERSION(major) (0)
24
+ #endif
25
+
26
+ #if defined __has_attribute
27
+ # define DDOG_HAS_ATTRIBUTE(attribute, major) __has_attribute(attribute)
28
+ #else
29
+ # define DDOG_HAS_ATTRIBUTE(attribute, major) DDOG_GNUC_VERSION(major)
30
+ #endif
31
+
32
+ #if defined(__cplusplus) && (__cplusplus >= 201703L)
33
+ # define DDOG_CHECK_RETURN [[nodiscard]]
34
+ #elif defined(_Check_return_) /* SAL */
35
+ # define DDOG_CHECK_RETURN _Check_return_
36
+ #elif DDOG_HAS_ATTRIBUTE(warn_unused_result, 4)
37
+ # define DDOG_CHECK_RETURN __attribute__((__warn_unused_result__))
38
+ #else
39
+ # define DDOG_CHECK_RETURN
40
+ #endif
41
+
42
+ /**
43
+ * Default value for the timeout field in milliseconds.
44
+ */
45
+ #define ddog_Endpoint_DEFAULT_TIMEOUT 3000
46
+
47
+ typedef struct ddog_Endpoint ddog_Endpoint;
48
+
49
+ typedef struct ddog_Tag ddog_Tag;
50
+
51
+ /**
52
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
53
+ * never from C.
54
+ */
55
+ typedef struct ddog_Vec_U8 {
56
+ const uint8_t *ptr;
57
+ uintptr_t len;
58
+ uintptr_t capacity;
59
+ } ddog_Vec_U8;
60
+
61
+ /**
62
+ * Please treat this as opaque; do not reach into it, and especially don't
63
+ * write into it! The most relevant APIs are:
64
+ * * `ddog_Error_message`, to get the message as a slice.
65
+ * * `ddog_Error_drop`.
66
+ */
67
+ typedef struct ddog_Error {
68
+ /**
69
+ * This is a String stuffed into the vec.
70
+ */
71
+ struct ddog_Vec_U8 message;
72
+ } ddog_Error;
73
+
74
+ typedef struct ddog_Slice_CChar {
75
+ /**
76
+ * Should be non-null and suitably aligned for the underlying type. It is
77
+ * allowed but not recommended for the pointer to be null when the len is
78
+ * zero.
79
+ */
80
+ const char *ptr;
81
+ /**
82
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
83
+ * than or equal to [isize::MAX].
84
+ */
85
+ uintptr_t len;
86
+ } ddog_Slice_CChar;
87
+
88
+ /**
89
+ * Use to represent strings -- should be valid UTF-8.
90
+ */
91
+ typedef struct ddog_Slice_CChar ddog_CharSlice;
92
+
93
+ typedef enum ddog_Option_Error_Tag {
94
+ DDOG_OPTION_ERROR_SOME_ERROR,
95
+ DDOG_OPTION_ERROR_NONE_ERROR,
96
+ } ddog_Option_Error_Tag;
97
+
98
+ typedef struct ddog_Option_Error {
99
+ ddog_Option_Error_Tag tag;
100
+ union {
101
+ struct {
102
+ struct ddog_Error some;
103
+ };
104
+ };
105
+ } ddog_Option_Error;
106
+
107
+ typedef struct ddog_Option_Error ddog_MaybeError;
108
+
109
+ typedef struct ddog_ArrayQueue {
110
+ struct ddog_ArrayQueue *inner;
111
+ void (*item_delete_fn)(void*);
112
+ } ddog_ArrayQueue;
113
+
114
+ typedef enum ddog_ArrayQueue_NewResult_Tag {
115
+ DDOG_ARRAY_QUEUE_NEW_RESULT_OK,
116
+ DDOG_ARRAY_QUEUE_NEW_RESULT_ERR,
117
+ } ddog_ArrayQueue_NewResult_Tag;
118
+
119
+ typedef struct ddog_ArrayQueue_NewResult {
120
+ ddog_ArrayQueue_NewResult_Tag tag;
121
+ union {
122
+ struct {
123
+ struct ddog_ArrayQueue *ok;
124
+ };
125
+ struct {
126
+ struct ddog_Error err;
127
+ };
128
+ };
129
+ } ddog_ArrayQueue_NewResult;
130
+
131
+ /**
132
+ * Data structure for the result of the push() and force_push() functions.
133
+ * force_push() replaces the oldest element if the queue is full, while push() returns the given
134
+ * value if the queue is full. For push(), it's redundant to return the value since the caller
135
+ * already has it, but it's returned for consistency with crossbeam API and with force_push().
136
+ */
137
+ typedef enum ddog_ArrayQueue_PushResult_Tag {
138
+ DDOG_ARRAY_QUEUE_PUSH_RESULT_OK,
139
+ DDOG_ARRAY_QUEUE_PUSH_RESULT_FULL,
140
+ DDOG_ARRAY_QUEUE_PUSH_RESULT_ERR,
141
+ } ddog_ArrayQueue_PushResult_Tag;
142
+
143
+ typedef struct ddog_ArrayQueue_PushResult {
144
+ ddog_ArrayQueue_PushResult_Tag tag;
145
+ union {
146
+ struct {
147
+ void *full;
148
+ };
149
+ struct {
150
+ struct ddog_Error err;
151
+ };
152
+ };
153
+ } ddog_ArrayQueue_PushResult;
154
+
155
+ typedef enum ddog_ArrayQueue_PopResult_Tag {
156
+ DDOG_ARRAY_QUEUE_POP_RESULT_OK,
157
+ DDOG_ARRAY_QUEUE_POP_RESULT_EMPTY,
158
+ DDOG_ARRAY_QUEUE_POP_RESULT_ERR,
159
+ } ddog_ArrayQueue_PopResult_Tag;
160
+
161
+ typedef struct ddog_ArrayQueue_PopResult {
162
+ ddog_ArrayQueue_PopResult_Tag tag;
163
+ union {
164
+ struct {
165
+ void *ok;
166
+ };
167
+ struct {
168
+ struct ddog_Error err;
169
+ };
170
+ };
171
+ } ddog_ArrayQueue_PopResult;
172
+
173
+ typedef enum ddog_ArrayQueue_BoolResult_Tag {
174
+ DDOG_ARRAY_QUEUE_BOOL_RESULT_OK,
175
+ DDOG_ARRAY_QUEUE_BOOL_RESULT_ERR,
176
+ } ddog_ArrayQueue_BoolResult_Tag;
177
+
178
+ typedef struct ddog_ArrayQueue_BoolResult {
179
+ ddog_ArrayQueue_BoolResult_Tag tag;
180
+ union {
181
+ struct {
182
+ bool ok;
183
+ };
184
+ struct {
185
+ struct ddog_Error err;
186
+ };
187
+ };
188
+ } ddog_ArrayQueue_BoolResult;
189
+
190
+ typedef enum ddog_ArrayQueue_UsizeResult_Tag {
191
+ DDOG_ARRAY_QUEUE_USIZE_RESULT_OK,
192
+ DDOG_ARRAY_QUEUE_USIZE_RESULT_ERR,
193
+ } ddog_ArrayQueue_UsizeResult_Tag;
194
+
195
+ typedef struct ddog_ArrayQueue_UsizeResult {
196
+ ddog_ArrayQueue_UsizeResult_Tag tag;
197
+ union {
198
+ struct {
199
+ uintptr_t ok;
200
+ };
201
+ struct {
202
+ struct ddog_Error err;
203
+ };
204
+ };
205
+ } ddog_ArrayQueue_UsizeResult;
206
+
207
+ typedef enum ddog_Option_U32_Tag {
208
+ DDOG_OPTION_U32_SOME_U32,
209
+ DDOG_OPTION_U32_NONE_U32,
210
+ } ddog_Option_U32_Tag;
211
+
212
+ typedef struct ddog_Option_U32 {
213
+ ddog_Option_U32_Tag tag;
214
+ union {
215
+ struct {
216
+ uint32_t some;
217
+ };
218
+ };
219
+ } ddog_Option_U32;
220
+
221
+ /**
222
+ * A wrapper for returning owned strings from FFI
223
+ */
224
+ typedef struct ddog_StringWrapper {
225
+ /**
226
+ * This is a String stuffed into the vec.
227
+ */
228
+ struct ddog_Vec_U8 message;
229
+ } ddog_StringWrapper;
230
+
231
+ /**
232
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
233
+ * never from C.
234
+ */
235
+ typedef struct ddog_Vec_Tag {
236
+ const struct ddog_Tag *ptr;
237
+ uintptr_t len;
238
+ uintptr_t capacity;
239
+ } ddog_Vec_Tag;
240
+
241
+ typedef enum ddog_Vec_Tag_PushResult_Tag {
242
+ DDOG_VEC_TAG_PUSH_RESULT_OK,
243
+ DDOG_VEC_TAG_PUSH_RESULT_ERR,
244
+ } ddog_Vec_Tag_PushResult_Tag;
245
+
246
+ typedef struct ddog_Vec_Tag_PushResult {
247
+ ddog_Vec_Tag_PushResult_Tag tag;
248
+ union {
249
+ struct {
250
+ struct ddog_Error err;
251
+ };
252
+ };
253
+ } ddog_Vec_Tag_PushResult;
254
+
255
+ typedef struct ddog_Vec_Tag_ParseResult {
256
+ struct ddog_Vec_Tag tags;
257
+ struct ddog_Error *error_message;
258
+ } ddog_Vec_Tag_ParseResult;
259
+
260
+ typedef struct ddog_prof_StringHeader *ddog_prof_StringId2;
261
+ typedef struct ddog_prof_Mapping2 *ddog_prof_MappingId2;
262
+ typedef struct ddog_prof_Function2 *ddog_prof_FunctionId2;
263
+
264
+ #define ddog_prof_Set_SIZE_HINT (1024 * 1024)
265
+
266
+ typedef enum ddog_prof_Utf8Option {
267
+ /**
268
+ * The string is assumed to be valid UTF-8. If it's not, the behavior
269
+ * is undefined.
270
+ */
271
+ DDOG_PROF_UTF8_OPTION_ASSUME,
272
+ /**
273
+ * The string is converted to UTF-8 using lossy conversion.
274
+ */
275
+ DDOG_PROF_UTF8_OPTION_CONVERT_LOSSY,
276
+ /**
277
+ * The string is validated to be UTF-8. If it's not, an error is
278
+ * returned.
279
+ */
280
+ DDOG_PROF_UTF8_OPTION_VALIDATE,
281
+ } ddog_prof_Utf8Option;
282
+
283
+ typedef struct ddog_OpaqueCancellationToken ddog_OpaqueCancellationToken;
284
+
285
+ typedef struct ddog_prof_EncodedProfile ddog_prof_EncodedProfile;
286
+
287
+ typedef struct ddog_prof_Exporter ddog_prof_Exporter;
288
+
289
+ /**
290
+ * `ProfilesDictionary` contains data which are common to multiple profiles,
291
+ * whether that's multiple profiles simultaneously or multiple profiles
292
+ * through time.
293
+ *
294
+ * The current implementation is thread-safe, though there has been some
295
+ * discussion about making that optional, as some libraries will call these
296
+ * APIs in places where a mutex is already employed.
297
+ */
298
+ typedef struct ddog_prof_ProfilesDictionary ddog_prof_ProfilesDictionary;
299
+
300
+ typedef struct ddog_Slice_U8 {
301
+ /**
302
+ * Should be non-null and suitably aligned for the underlying type. It is
303
+ * allowed but not recommended for the pointer to be null when the len is
304
+ * zero.
305
+ */
306
+ const uint8_t *ptr;
307
+ /**
308
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
309
+ * than or equal to [isize::MAX].
310
+ */
311
+ uintptr_t len;
312
+ } ddog_Slice_U8;
313
+
314
+ /**
315
+ * Use to represent bytes -- does not need to be valid UTF-8.
316
+ */
317
+ typedef struct ddog_Slice_U8 ddog_ByteSlice;
318
+
319
+ typedef struct ddog_prof_Exporter_File {
320
+ ddog_CharSlice name;
321
+ ddog_ByteSlice file;
322
+ } ddog_prof_Exporter_File;
323
+
324
+ typedef struct ddog_prof_Exporter_Slice_File {
325
+ /**
326
+ * Should be non-null and suitably aligned for the underlying type. It is
327
+ * allowed but not recommended for the pointer to be null when the len is
328
+ * zero.
329
+ */
330
+ const struct ddog_prof_Exporter_File *ptr;
331
+ /**
332
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
333
+ * than or equal to [isize::MAX].
334
+ */
335
+ uintptr_t len;
336
+ } ddog_prof_Exporter_Slice_File;
337
+
338
+ typedef enum ddog_prof_Endpoint_Tag {
339
+ DDOG_PROF_ENDPOINT_AGENT,
340
+ DDOG_PROF_ENDPOINT_AGENTLESS,
341
+ DDOG_PROF_ENDPOINT_FILE,
342
+ } ddog_prof_Endpoint_Tag;
343
+
344
+ typedef struct ddog_prof_Endpoint_ddog_prof_Agent_Body {
345
+ ddog_CharSlice _0;
346
+ uint64_t _1;
347
+ } ddog_prof_Endpoint_ddog_prof_Agent_Body;
348
+
349
+ typedef struct ddog_prof_Endpoint_ddog_prof_Agentless_Body {
350
+ ddog_CharSlice _0;
351
+ ddog_CharSlice _1;
352
+ uint64_t _2;
353
+ } ddog_prof_Endpoint_ddog_prof_Agentless_Body;
354
+
355
+ typedef struct ddog_prof_Endpoint {
356
+ ddog_prof_Endpoint_Tag tag;
357
+ union {
358
+ ddog_prof_Endpoint_ddog_prof_Agent_Body AGENT;
359
+ ddog_prof_Endpoint_ddog_prof_Agentless_Body AGENTLESS;
360
+ struct {
361
+ ddog_CharSlice file;
362
+ };
363
+ };
364
+ } ddog_prof_Endpoint;
365
+
366
+ /**
367
+ * Represents an object that should only be referred to by its handle.
368
+ * Do not access its member for any reason, only use the C API functions on this struct.
369
+ */
370
+ typedef struct ddog_prof_ProfileExporter {
371
+ struct ddog_prof_Exporter *inner;
372
+ } ddog_prof_ProfileExporter;
373
+
374
+ /**
375
+ * A generic result type for when an operation may fail,
376
+ * or may return <T> in case of success.
377
+ */
378
+ typedef enum ddog_prof_ProfileExporter_Result_Tag {
379
+ DDOG_PROF_PROFILE_EXPORTER_RESULT_OK_HANDLE_PROFILE_EXPORTER,
380
+ DDOG_PROF_PROFILE_EXPORTER_RESULT_ERR_HANDLE_PROFILE_EXPORTER,
381
+ } ddog_prof_ProfileExporter_Result_Tag;
382
+
383
+ typedef struct ddog_prof_ProfileExporter_Result {
384
+ ddog_prof_ProfileExporter_Result_Tag tag;
385
+ union {
386
+ struct {
387
+ struct ddog_prof_ProfileExporter ok;
388
+ };
389
+ struct {
390
+ struct ddog_Error err;
391
+ };
392
+ };
393
+ } ddog_prof_ProfileExporter_Result;
394
+
395
+ typedef struct ddog_HttpStatus {
396
+ uint16_t code;
397
+ } ddog_HttpStatus;
398
+
399
+ /**
400
+ * A generic result type for when an operation may fail,
401
+ * or may return <T> in case of success.
402
+ */
403
+ typedef enum ddog_prof_Result_HttpStatus_Tag {
404
+ DDOG_PROF_RESULT_HTTP_STATUS_OK_HTTP_STATUS,
405
+ DDOG_PROF_RESULT_HTTP_STATUS_ERR_HTTP_STATUS,
406
+ } ddog_prof_Result_HttpStatus_Tag;
407
+
408
+ typedef struct ddog_prof_Result_HttpStatus {
409
+ ddog_prof_Result_HttpStatus_Tag tag;
410
+ union {
411
+ struct {
412
+ struct ddog_HttpStatus ok;
413
+ };
414
+ struct {
415
+ struct ddog_Error err;
416
+ };
417
+ };
418
+ } ddog_prof_Result_HttpStatus;
419
+
420
+ /**
421
+ * Represents an object that should only be referred to by its handle.
422
+ * Do not access its member for any reason, only use the C API functions on this struct.
423
+ */
424
+ typedef struct ddog_prof_EncodedProfile {
425
+ struct ddog_prof_EncodedProfile *inner;
426
+ } ddog_prof_EncodedProfile;
427
+
428
+ typedef struct ddog_OpaqueCancellationToken ddog_prof_TokioCancellationToken;
429
+
430
+ /**
431
+ * Represents an object that should only be referred to by its handle.
432
+ * Do not access its member for any reason, only use the C API functions on this struct.
433
+ */
434
+ typedef struct ddog_CancellationToken {
435
+ ddog_prof_TokioCancellationToken *inner;
436
+ } ddog_CancellationToken;
437
+
438
+ /**
439
+ * Represents the result of an operation that either succeeds with no value, or fails with an
440
+ * error message. This is like `Result<(), Cow<'static, CStr>` except its representation is
441
+ * smaller, and is FFI-stable.
442
+ *
443
+ * The OK status is guaranteed to have a representation of `{ 0, null }`.
444
+ *
445
+ * # Ownership
446
+ *
447
+ * A `ProfileStatus` owns its error message data. When a `ProfileStatus` with an error is
448
+ * created, it takes ownership of the error string (either as a static reference or heap
449
+ * allocation). The caller is responsible for eventually calling [`ddog_prof_Status_drop`] to
450
+ * free any heap-allocated memory. This is safe to call on OK as well.
451
+ *
452
+ * # FFI Safety
453
+ *
454
+ * This type is `#[repr(C)]` and safe to pass across FFI boundaries. The C side must treat the
455
+ * `.flags` as opaque and use API functions; the `.err` field is guaranteed to be null when the
456
+ * `ProfileStatus` is OK, and on Err it will be non-null pointer to a UTF8 encoded string which
457
+ * has a null terminator.
458
+ */
459
+ typedef struct ddog_prof_Status {
460
+ /**
461
+ * Bitflags indicating the storage type of the error message.
462
+ * This is only meaningful when `err` is non-null. When `err` is
463
+ * null (indicating OK), this field SHOULD be zero. Currently, only one
464
+ * bit is used `IS_ALLOCATED_MASK`, which determines whether the error
465
+ * message is owned or statically borrowed.
466
+ * In the future, we may store error codes in here as well.
467
+ */
468
+ size_t flags;
469
+ /**
470
+ * Pointer to a null-terminated UTF-8 error message string.
471
+ * - If null this indicates OK (success). This is an FFI guarantee.
472
+ * - If non-null and allocated bit is clear: points to static data with `'static` lifetime.
473
+ * - If non-null and allocated bit is set: points to owned heap-allocated data.
474
+ *
475
+ * # Safety Invariant
476
+ *
477
+ * When non-null, `err` must point to a valid, null-terminated C string in UTF-8 encoding.
478
+ * The pointer remains valid for the lifetime of this `ProfileStatus` or until
479
+ * [`ddog_prof_Status_drop`] is called.
480
+ */
481
+ const char *err;
482
+ } ddog_prof_Status;
483
+ #define ddog_prof_Status_OK (ddog_prof_Status){ .flags = 0, .err = (ddog_prof_null){ } }
484
+
485
+ /**
486
+ * Represents a profile. Do not access its member for any reason, only use
487
+ * the C API functions on this struct.
488
+ */
489
+ typedef struct ddog_prof_Profile {
490
+ struct ddog_prof_Profile *inner;
491
+ } ddog_prof_Profile;
492
+ /**
493
+ * When testing on some profiles that can't be shared publicly,
494
+ * level 1 provided better compressed files while taking less or equal
495
+ * time compared to lz4.
496
+ */
497
+ #define ddog_prof_Profile_COMPRESSION_LEVEL 1
498
+
499
+ /**
500
+ * Returned by [ddog_prof_Profile_new].
501
+ */
502
+ typedef enum ddog_prof_Profile_NewResult_Tag {
503
+ DDOG_PROF_PROFILE_NEW_RESULT_OK,
504
+ DDOG_PROF_PROFILE_NEW_RESULT_ERR,
505
+ } ddog_prof_Profile_NewResult_Tag;
506
+
507
+ typedef struct ddog_prof_Profile_NewResult {
508
+ ddog_prof_Profile_NewResult_Tag tag;
509
+ union {
510
+ struct {
511
+ struct ddog_prof_Profile ok;
512
+ };
513
+ struct {
514
+ struct ddog_Error err;
515
+ };
516
+ };
517
+ } ddog_prof_Profile_NewResult;
518
+
519
+ typedef struct ddog_prof_ValueType {
520
+ ddog_CharSlice type_;
521
+ ddog_CharSlice unit;
522
+ } ddog_prof_ValueType;
523
+
524
+ typedef struct ddog_prof_Slice_ValueType {
525
+ /**
526
+ * Should be non-null and suitably aligned for the underlying type. It is
527
+ * allowed but not recommended for the pointer to be null when the len is
528
+ * zero.
529
+ */
530
+ const struct ddog_prof_ValueType *ptr;
531
+ /**
532
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
533
+ * than or equal to [isize::MAX].
534
+ */
535
+ uintptr_t len;
536
+ } ddog_prof_Slice_ValueType;
537
+
538
+ typedef struct ddog_prof_Period {
539
+ struct ddog_prof_ValueType type_;
540
+ int64_t value;
541
+ } ddog_prof_Period;
542
+
543
+ /**
544
+ * Opaque FFI handle to an `Arc<T>`'s inner `T`.
545
+ *
546
+ * Safety rules for implementors/callers:
547
+ * - Do not create multiple owning `Arc<T>`s from the same raw pointer.
548
+ * - Always restore the original `Arc` with `into_raw` after any `from_raw`.
549
+ * - Use `as_inner()` to validate non-null before performing raw round-trips.
550
+ *
551
+ * From Rust, use [`ArcHandle::try_clone`] to make a reference-counted copy.
552
+ * From the C FFI, the handle should probably be renamed to avoid generics
553
+ * bloat garbage, and a *_try_clone API should be provided.
554
+ *
555
+ * Use [`ArcHandle::drop_resource`] to drop the resource and move this handle
556
+ * into the empty handle state, which is the default state.
557
+ */
558
+ typedef struct ddog_prof_ProfilesDictionary *ddog_prof_ProfilesDictionaryHandle;
559
+
560
+ typedef struct ddog_prof_ManagedStringStorage {
561
+ const void *inner;
562
+ } ddog_prof_ManagedStringStorage;
563
+
564
+ /**
565
+ * A generic result type for when a profiling operation may fail, but there's
566
+ * nothing to return in the case of success.
567
+ */
568
+ typedef enum ddog_prof_Profile_Result_Tag {
569
+ DDOG_PROF_PROFILE_RESULT_OK,
570
+ DDOG_PROF_PROFILE_RESULT_ERR,
571
+ } ddog_prof_Profile_Result_Tag;
572
+
573
+ typedef struct ddog_prof_Profile_Result {
574
+ ddog_prof_Profile_Result_Tag tag;
575
+ union {
576
+ struct {
577
+ /**
578
+ * Do not use the value of Ok. This value only exists to overcome
579
+ * Rust -> C code generation.
580
+ */
581
+ bool ok;
582
+ };
583
+ struct {
584
+ struct ddog_Error err;
585
+ };
586
+ };
587
+ } ddog_prof_Profile_Result;
588
+
589
+ typedef struct ddog_prof_ManagedStringId {
590
+ uint32_t value;
591
+ } ddog_prof_ManagedStringId;
592
+
593
+ typedef struct ddog_prof_Mapping {
594
+ /**
595
+ * Address at which the binary (or DLL) is loaded into memory.
596
+ */
597
+ uint64_t memory_start;
598
+ /**
599
+ * The limit of the address range occupied by this mapping.
600
+ */
601
+ uint64_t memory_limit;
602
+ /**
603
+ * Offset in the binary that corresponds to the first mapped address.
604
+ */
605
+ uint64_t file_offset;
606
+ /**
607
+ * The object this entry is loaded from. This can be a filename on
608
+ * disk for the main binary and shared libraries, or virtual
609
+ * abstractions like "[vdso]".
610
+ */
611
+ ddog_CharSlice filename;
612
+ struct ddog_prof_ManagedStringId filename_id;
613
+ /**
614
+ * A string that uniquely identifies a particular program version
615
+ * with high probability. E.g., for binaries generated by GNU tools,
616
+ * it could be the contents of the .note.gnu.build-id field.
617
+ */
618
+ ddog_CharSlice build_id;
619
+ struct ddog_prof_ManagedStringId build_id_id;
620
+ } ddog_prof_Mapping;
621
+
622
+ typedef struct ddog_prof_Function {
623
+ /**
624
+ * Name of the function, in human-readable form if available.
625
+ */
626
+ ddog_CharSlice name;
627
+ struct ddog_prof_ManagedStringId name_id;
628
+ /**
629
+ * Name of the function, as identified by the system.
630
+ * For instance, it can be a C++ mangled name.
631
+ */
632
+ ddog_CharSlice system_name;
633
+ struct ddog_prof_ManagedStringId system_name_id;
634
+ /**
635
+ * Source file containing the function.
636
+ */
637
+ ddog_CharSlice filename;
638
+ struct ddog_prof_ManagedStringId filename_id;
639
+ } ddog_prof_Function;
640
+
641
+ typedef struct ddog_prof_Location {
642
+ /**
643
+ * todo: how to handle unknown mapping?
644
+ */
645
+ struct ddog_prof_Mapping mapping;
646
+ struct ddog_prof_Function function;
647
+ /**
648
+ * The instruction address for this location, if available. It
649
+ * should be within [Mapping.memory_start...Mapping.memory_limit]
650
+ * for the corresponding mapping. A non-leaf address may be in the
651
+ * middle of a call instruction. It is up to display tools to find
652
+ * the beginning of the instruction if necessary.
653
+ */
654
+ uint64_t address;
655
+ int64_t line;
656
+ } ddog_prof_Location;
657
+
658
+ typedef struct ddog_prof_Slice_Location {
659
+ /**
660
+ * Should be non-null and suitably aligned for the underlying type. It is
661
+ * allowed but not recommended for the pointer to be null when the len is
662
+ * zero.
663
+ */
664
+ const struct ddog_prof_Location *ptr;
665
+ /**
666
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
667
+ * than or equal to [isize::MAX].
668
+ */
669
+ uintptr_t len;
670
+ } ddog_prof_Slice_Location;
671
+
672
+ typedef struct ddog_Slice_I64 {
673
+ /**
674
+ * Should be non-null and suitably aligned for the underlying type. It is
675
+ * allowed but not recommended for the pointer to be null when the len is
676
+ * zero.
677
+ */
678
+ const int64_t *ptr;
679
+ /**
680
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
681
+ * than or equal to [isize::MAX].
682
+ */
683
+ uintptr_t len;
684
+ } ddog_Slice_I64;
685
+
686
+ typedef struct ddog_prof_Label {
687
+ ddog_CharSlice key;
688
+ struct ddog_prof_ManagedStringId key_id;
689
+ /**
690
+ * At most one of the following must be present
691
+ */
692
+ ddog_CharSlice str;
693
+ struct ddog_prof_ManagedStringId str_id;
694
+ int64_t num;
695
+ /**
696
+ * Should only be present when num is present.
697
+ * Specifies the units of num.
698
+ * Use arbitrary string (for example, "requests") as a custom count unit.
699
+ * If no unit is specified, consumer may apply heuristic to deduce the unit.
700
+ * Consumers may also interpret units like "bytes" and "kilobytes" as memory
701
+ * units and units like "seconds" and "nanoseconds" as time units,
702
+ * and apply appropriate unit conversions to these.
703
+ */
704
+ ddog_CharSlice num_unit;
705
+ struct ddog_prof_ManagedStringId num_unit_id;
706
+ } ddog_prof_Label;
707
+
708
+ typedef struct ddog_prof_Slice_Label {
709
+ /**
710
+ * Should be non-null and suitably aligned for the underlying type. It is
711
+ * allowed but not recommended for the pointer to be null when the len is
712
+ * zero.
713
+ */
714
+ const struct ddog_prof_Label *ptr;
715
+ /**
716
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
717
+ * than or equal to [isize::MAX].
718
+ */
719
+ uintptr_t len;
720
+ } ddog_prof_Slice_Label;
721
+
722
+ typedef struct ddog_prof_Sample {
723
+ /**
724
+ * The leaf is at locations[0].
725
+ */
726
+ struct ddog_prof_Slice_Location locations;
727
+ /**
728
+ * The type and unit of each value is defined by the corresponding
729
+ * entry in Profile.sample_type. All samples must have the same
730
+ * number of values, the same as the length of Profile.sample_type.
731
+ * When aggregating multiple samples into a single sample, the
732
+ * result has a list of values that is the element-wise sum of the
733
+ * lists of the originals.
734
+ */
735
+ struct ddog_Slice_I64 values;
736
+ /**
737
+ * label includes additional context for this sample. It can include
738
+ * things like a thread id, allocation size, etc
739
+ */
740
+ struct ddog_prof_Slice_Label labels;
741
+ } ddog_prof_Sample;
742
+
743
+ /**
744
+ * Represents what StringIds point to. Its definition is intentionally
745
+ * obscured; the actual layout is being hidden. This is here so that
746
+ * cbindgen will generate a unique type as opposed to relying on `void *` or
747
+ * similar. We want StringId2, FunctionId2, and MappingId2 to all point to
748
+ * unique so that compilers will distinguish between them and provide some
749
+ * type safety.
750
+ */
751
+ typedef struct ddog_prof_StringHeader {
752
+ uint8_t _0;
753
+ } ddog_prof_StringHeader;
754
+
755
+ /**
756
+ * An FFI-safe string ID where a null StringId2 maps to `StringRef::EMPTY`.
757
+ * The representation is ensured to be a pointer for ABI stability, but
758
+ * callers should not generally dereference this pointer. When using the id,
759
+ * the caller needs to be sure that the `ProfilesDictionary` or string set it
760
+ * refers to is the same one that the operations are performed on; it is not
761
+ * generally guaranteed that ids from one dictionary/set can be used in
762
+ * another, even if it happens to work by implementation detail. There is an
763
+ * exception is for well-known strings, which are considered present in every
764
+ * string set.
765
+ */
766
+ typedef struct ddog_prof_StringHeader *ddog_prof_StringId2;
767
+
768
+ /**
769
+ * An FFI-safe version of the Mapping which allows null. Be sure to maintain
770
+ * layout-compatibility with it, except that StringId2 may be null.
771
+ */
772
+ typedef struct ddog_prof_Mapping2 {
773
+ uint64_t memory_start;
774
+ uint64_t memory_limit;
775
+ uint64_t file_offset;
776
+ ddog_prof_StringId2 filename;
777
+ ddog_prof_StringId2 build_id;
778
+ } ddog_prof_Mapping2;
779
+
780
+ /**
781
+ * An FFI-safe representation of a "handle" to a mapping which has been
782
+ * stored in the `ProfilesDictionary`. The representation is ensured to be a
783
+ * pointer for ABI stability, but callers should not generally dereference
784
+ * this pointer. When using the id, the caller needs to be sure that the
785
+ * `ProfilesDictionary` it refers to is the same one that the operations are
786
+ * performed on; it is not generally guaranteed that ids from one dictionary
787
+ * can be used in another dictionary, even if it happens to work by
788
+ * implementation detail.
789
+ */
790
+ typedef struct ddog_prof_Mapping2 *ddog_prof_MappingId2;
791
+
792
+ /**
793
+ * An FFI-safe version of the Function which allows null. Be sure to maintain
794
+ * layout-compatibility with it, except that StringId2 may be null.
795
+ */
796
+ typedef struct ddog_prof_Function2 {
797
+ ddog_prof_StringId2 name;
798
+ ddog_prof_StringId2 system_name;
799
+ ddog_prof_StringId2 file_name;
800
+ } ddog_prof_Function2;
801
+
802
+ /**
803
+ * An FFI-safe representation of a "handle" to a function which has been
804
+ * stored in the `ProfilesDictionary`. The representation is ensured to be a
805
+ * pointer for ABI stability, but callers should not generally dereference
806
+ * this pointer. When using the id, the caller needs to be sure that the
807
+ * `ProfilesDictionary` it refers to is the same one that the operations are
808
+ * performed on; it is not generally guaranteed that ids from one dictionary
809
+ * can be used in another dictionary, even if it happens to work by
810
+ * implementation detail.
811
+ */
812
+ typedef struct ddog_prof_Function2 *ddog_prof_FunctionId2;
813
+
814
+ typedef struct ddog_prof_Location2 {
815
+ ddog_prof_MappingId2 mapping;
816
+ ddog_prof_FunctionId2 function;
817
+ /**
818
+ * The instruction address for this location, if available. It
819
+ * should be within [Mapping.memory_start...Mapping.memory_limit]
820
+ * for the corresponding mapping. A non-leaf address may be in the
821
+ * middle of a call instruction. It is up to display tools to find
822
+ * the beginning of the instruction if necessary.
823
+ */
824
+ uint64_t address;
825
+ int64_t line;
826
+ } ddog_prof_Location2;
827
+
828
+ typedef struct ddog_prof_Slice_Location2 {
829
+ /**
830
+ * Should be non-null and suitably aligned for the underlying type. It is
831
+ * allowed but not recommended for the pointer to be null when the len is
832
+ * zero.
833
+ */
834
+ const struct ddog_prof_Location2 *ptr;
835
+ /**
836
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
837
+ * than or equal to [isize::MAX].
838
+ */
839
+ uintptr_t len;
840
+ } ddog_prof_Slice_Location2;
841
+
842
+ typedef struct ddog_prof_Label2 {
843
+ ddog_prof_StringId2 key;
844
+ /**
845
+ * At most one of `.str` and `.num` should not be empty.
846
+ */
847
+ ddog_CharSlice str;
848
+ int64_t num;
849
+ /**
850
+ * Should only be present when num is present.
851
+ * Specifies the units of num.
852
+ * Use arbitrary string (for example, "requests") as a custom count unit.
853
+ * If no unit is specified, consumer may apply heuristic to deduce the unit.
854
+ * Consumers may also interpret units like "bytes" and "kilobytes" as memory
855
+ * units and units like "seconds" and "nanoseconds" as time units,
856
+ * and apply appropriate unit conversions to these.
857
+ */
858
+ ddog_CharSlice num_unit;
859
+ } ddog_prof_Label2;
860
+
861
+ typedef struct ddog_prof_Slice_Label2 {
862
+ /**
863
+ * Should be non-null and suitably aligned for the underlying type. It is
864
+ * allowed but not recommended for the pointer to be null when the len is
865
+ * zero.
866
+ */
867
+ const struct ddog_prof_Label2 *ptr;
868
+ /**
869
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
870
+ * than or equal to [isize::MAX].
871
+ */
872
+ uintptr_t len;
873
+ } ddog_prof_Slice_Label2;
874
+
875
+ typedef struct ddog_prof_Sample2 {
876
+ /**
877
+ * The leaf is at locations[0].
878
+ */
879
+ struct ddog_prof_Slice_Location2 locations;
880
+ /**
881
+ * The type and unit of each value is defined by the corresponding
882
+ * entry in Profile.sample_type. All samples must have the same
883
+ * number of values, the same as the length of Profile.sample_type.
884
+ * When aggregating multiple samples into a single sample, the
885
+ * result has a list of values that is the element-wise sum of the
886
+ * lists of the originals.
887
+ */
888
+ struct ddog_Slice_I64 values;
889
+ /**
890
+ * label includes additional context for this sample. It can include
891
+ * things like a thread id, allocation size, etc
892
+ */
893
+ struct ddog_prof_Slice_Label2 labels;
894
+ } ddog_prof_Sample2;
895
+
896
+ typedef struct ddog_prof_Slice_Usize {
897
+ /**
898
+ * Should be non-null and suitably aligned for the underlying type. It is
899
+ * allowed but not recommended for the pointer to be null when the len is
900
+ * zero.
901
+ */
902
+ const uintptr_t *ptr;
903
+ /**
904
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
905
+ * than or equal to [isize::MAX].
906
+ */
907
+ uintptr_t len;
908
+ } ddog_prof_Slice_Usize;
909
+
910
+ /**
911
+ * A generic result type for when an operation may fail,
912
+ * or may return <T> in case of success.
913
+ */
914
+ typedef enum ddog_prof_Result_ByteSlice_Tag {
915
+ DDOG_PROF_RESULT_BYTE_SLICE_OK_BYTE_SLICE,
916
+ DDOG_PROF_RESULT_BYTE_SLICE_ERR_BYTE_SLICE,
917
+ } ddog_prof_Result_ByteSlice_Tag;
918
+
919
+ typedef struct ddog_prof_Result_ByteSlice {
920
+ ddog_prof_Result_ByteSlice_Tag tag;
921
+ union {
922
+ struct {
923
+ ddog_ByteSlice ok;
924
+ };
925
+ struct {
926
+ struct ddog_Error err;
927
+ };
928
+ };
929
+ } ddog_prof_Result_ByteSlice;
930
+
931
+ typedef enum ddog_prof_Profile_SerializeResult_Tag {
932
+ DDOG_PROF_PROFILE_SERIALIZE_RESULT_OK,
933
+ DDOG_PROF_PROFILE_SERIALIZE_RESULT_ERR,
934
+ } ddog_prof_Profile_SerializeResult_Tag;
935
+
936
+ typedef struct ddog_prof_Profile_SerializeResult {
937
+ ddog_prof_Profile_SerializeResult_Tag tag;
938
+ union {
939
+ struct {
940
+ struct ddog_prof_EncodedProfile ok;
941
+ };
942
+ struct {
943
+ struct ddog_Error err;
944
+ };
945
+ };
946
+ } ddog_prof_Profile_SerializeResult;
947
+
948
+ /**
949
+ * Represents time since the Unix Epoch in seconds plus nanoseconds.
950
+ */
951
+ typedef struct ddog_Timespec {
952
+ int64_t seconds;
953
+ uint32_t nanoseconds;
954
+ } ddog_Timespec;
955
+
956
+ /**
957
+ * Opaque identifier for the profiler generation
958
+ */
959
+ typedef struct ddog_prof_Generation {
960
+ uint64_t id;
961
+ } ddog_prof_Generation;
962
+
963
+ typedef struct OpaqueFunctionId {
964
+ uint32_t _0;
965
+ } OpaqueFunctionId;
966
+
967
+ typedef struct ddog_prof_FunctionId {
968
+ struct ddog_prof_Generation generation;
969
+ struct OpaqueFunctionId id;
970
+ } ddog_prof_FunctionId;
971
+
972
+ /**
973
+ * A generic result type for when an operation may fail,
974
+ * or may return <T> in case of success.
975
+ */
976
+ typedef enum ddog_prof_FunctionId_Result_Tag {
977
+ DDOG_PROF_FUNCTION_ID_RESULT_OK_GENERATIONAL_ID_FUNCTION_ID,
978
+ DDOG_PROF_FUNCTION_ID_RESULT_ERR_GENERATIONAL_ID_FUNCTION_ID,
979
+ } ddog_prof_FunctionId_Result_Tag;
980
+
981
+ typedef struct ddog_prof_FunctionId_Result {
982
+ ddog_prof_FunctionId_Result_Tag tag;
983
+ union {
984
+ struct {
985
+ struct ddog_prof_FunctionId ok;
986
+ };
987
+ struct {
988
+ struct ddog_Error err;
989
+ };
990
+ };
991
+ } ddog_prof_FunctionId_Result;
992
+
993
+ /**
994
+ * Represents an offset into the Profile's string table. Note that it cannot
995
+ * exceed u32 because an entire protobuf message must not be larger than or
996
+ * equal to 2 GiB. By the time you encode the tag and length prefix for each
997
+ * string, there's no way to get this many unique-ish strings without first
998
+ * exceeding the protobuf 2 GiB limit.
999
+ *
1000
+ * A value of 0 means "no string" or "empty string" (they are synonymous).
1001
+ */
1002
+ typedef struct OpaqueStringId {
1003
+ uint32_t offset;
1004
+ } OpaqueStringId;
1005
+ #define OpaqueStringId_ZERO (OpaqueStringId){ }
1006
+
1007
+ typedef struct OpaqueStringId OpaqueStringId;
1008
+
1009
+ typedef struct ddog_prof_StringId {
1010
+ struct ddog_prof_Generation generation;
1011
+ OpaqueStringId id;
1012
+ } ddog_prof_StringId;
1013
+
1014
+ typedef struct OpaqueLabelId {
1015
+ uint32_t _0;
1016
+ } OpaqueLabelId;
1017
+
1018
+ typedef struct ddog_prof_LabelId {
1019
+ struct ddog_prof_Generation generation;
1020
+ struct OpaqueLabelId id;
1021
+ } ddog_prof_LabelId;
1022
+
1023
+ /**
1024
+ * A generic result type for when an operation may fail,
1025
+ * or may return <T> in case of success.
1026
+ */
1027
+ typedef enum ddog_prof_LabelId_Result_Tag {
1028
+ DDOG_PROF_LABEL_ID_RESULT_OK_GENERATIONAL_ID_LABEL_ID,
1029
+ DDOG_PROF_LABEL_ID_RESULT_ERR_GENERATIONAL_ID_LABEL_ID,
1030
+ } ddog_prof_LabelId_Result_Tag;
1031
+
1032
+ typedef struct ddog_prof_LabelId_Result {
1033
+ ddog_prof_LabelId_Result_Tag tag;
1034
+ union {
1035
+ struct {
1036
+ struct ddog_prof_LabelId ok;
1037
+ };
1038
+ struct {
1039
+ struct ddog_Error err;
1040
+ };
1041
+ };
1042
+ } ddog_prof_LabelId_Result;
1043
+
1044
+ typedef struct OpaqueLabelSetId {
1045
+ uint32_t _0;
1046
+ } OpaqueLabelSetId;
1047
+
1048
+ typedef struct ddog_prof_LabelSetId {
1049
+ struct ddog_prof_Generation generation;
1050
+ struct OpaqueLabelSetId id;
1051
+ } ddog_prof_LabelSetId;
1052
+
1053
+ /**
1054
+ * A generic result type for when an operation may fail,
1055
+ * or may return <T> in case of success.
1056
+ */
1057
+ typedef enum ddog_prof_LabelSetId_Result_Tag {
1058
+ DDOG_PROF_LABEL_SET_ID_RESULT_OK_GENERATIONAL_ID_LABEL_SET_ID,
1059
+ DDOG_PROF_LABEL_SET_ID_RESULT_ERR_GENERATIONAL_ID_LABEL_SET_ID,
1060
+ } ddog_prof_LabelSetId_Result_Tag;
1061
+
1062
+ typedef struct ddog_prof_LabelSetId_Result {
1063
+ ddog_prof_LabelSetId_Result_Tag tag;
1064
+ union {
1065
+ struct {
1066
+ struct ddog_prof_LabelSetId ok;
1067
+ };
1068
+ struct {
1069
+ struct ddog_Error err;
1070
+ };
1071
+ };
1072
+ } ddog_prof_LabelSetId_Result;
1073
+
1074
+ typedef struct ddog_prof_Slice_LabelId {
1075
+ /**
1076
+ * Should be non-null and suitably aligned for the underlying type. It is
1077
+ * allowed but not recommended for the pointer to be null when the len is
1078
+ * zero.
1079
+ */
1080
+ const struct ddog_prof_LabelId *ptr;
1081
+ /**
1082
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
1083
+ * than or equal to [isize::MAX].
1084
+ */
1085
+ uintptr_t len;
1086
+ } ddog_prof_Slice_LabelId;
1087
+
1088
+ typedef struct OpaqueLocationId {
1089
+ uint32_t _0;
1090
+ } OpaqueLocationId;
1091
+
1092
+ typedef struct ddog_prof_LocationId {
1093
+ struct ddog_prof_Generation generation;
1094
+ struct OpaqueLocationId id;
1095
+ } ddog_prof_LocationId;
1096
+
1097
+ /**
1098
+ * A generic result type for when an operation may fail,
1099
+ * or may return <T> in case of success.
1100
+ */
1101
+ typedef enum ddog_prof_LocationId_Result_Tag {
1102
+ DDOG_PROF_LOCATION_ID_RESULT_OK_GENERATIONAL_ID_LOCATION_ID,
1103
+ DDOG_PROF_LOCATION_ID_RESULT_ERR_GENERATIONAL_ID_LOCATION_ID,
1104
+ } ddog_prof_LocationId_Result_Tag;
1105
+
1106
+ typedef struct ddog_prof_LocationId_Result {
1107
+ ddog_prof_LocationId_Result_Tag tag;
1108
+ union {
1109
+ struct {
1110
+ struct ddog_prof_LocationId ok;
1111
+ };
1112
+ struct {
1113
+ struct ddog_Error err;
1114
+ };
1115
+ };
1116
+ } ddog_prof_LocationId_Result;
1117
+
1118
+ typedef struct OpaqueMappingId {
1119
+ uint32_t _0;
1120
+ } OpaqueMappingId;
1121
+
1122
+ typedef struct ddog_prof_MappingId {
1123
+ struct ddog_prof_Generation generation;
1124
+ struct OpaqueMappingId id;
1125
+ } ddog_prof_MappingId;
1126
+
1127
+ /**
1128
+ * A generic result type for when an operation may fail,
1129
+ * or may return <T> in case of success.
1130
+ */
1131
+ typedef enum ddog_prof_StringId_Result_Tag {
1132
+ DDOG_PROF_STRING_ID_RESULT_OK_GENERATIONAL_ID_STRING_ID,
1133
+ DDOG_PROF_STRING_ID_RESULT_ERR_GENERATIONAL_ID_STRING_ID,
1134
+ } ddog_prof_StringId_Result_Tag;
1135
+
1136
+ typedef struct ddog_prof_StringId_Result {
1137
+ ddog_prof_StringId_Result_Tag tag;
1138
+ union {
1139
+ struct {
1140
+ struct ddog_prof_StringId ok;
1141
+ };
1142
+ struct {
1143
+ struct ddog_Error err;
1144
+ };
1145
+ };
1146
+ } ddog_prof_StringId_Result;
1147
+
1148
+ /**
1149
+ * A generic result type for when an operation may fail,
1150
+ * but there's nothing to return in the case of success.
1151
+ */
1152
+ typedef enum ddog_VoidResult_Tag {
1153
+ DDOG_VOID_RESULT_OK,
1154
+ DDOG_VOID_RESULT_ERR,
1155
+ } ddog_VoidResult_Tag;
1156
+
1157
+ typedef struct ddog_VoidResult {
1158
+ ddog_VoidResult_Tag tag;
1159
+ union {
1160
+ struct {
1161
+ struct ddog_Error err;
1162
+ };
1163
+ };
1164
+ } ddog_VoidResult;
1165
+
1166
+ typedef struct ddog_prof_Slice_ManagedStringId {
1167
+ /**
1168
+ * Should be non-null and suitably aligned for the underlying type. It is
1169
+ * allowed but not recommended for the pointer to be null when the len is
1170
+ * zero.
1171
+ */
1172
+ const struct ddog_prof_ManagedStringId *ptr;
1173
+ /**
1174
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
1175
+ * than or equal to [isize::MAX].
1176
+ */
1177
+ uintptr_t len;
1178
+ } ddog_prof_Slice_ManagedStringId;
1179
+
1180
+ typedef struct ddog_prof_MutSlice_GenerationalIdStringId {
1181
+ /**
1182
+ * Should be non-null and suitably aligned for the underlying type. It is
1183
+ * allowed but not recommended for the pointer to be null when the len is
1184
+ * zero.
1185
+ */
1186
+ struct ddog_prof_StringId *ptr;
1187
+ /**
1188
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
1189
+ * than or equal to [isize::MAX].
1190
+ */
1191
+ uintptr_t len;
1192
+ } ddog_prof_MutSlice_GenerationalIdStringId;
1193
+
1194
+ /**
1195
+ * A generic result type for when an operation may fail,
1196
+ * or may return <T> in case of success.
1197
+ */
1198
+ typedef enum ddog_prof_MappingId_Result_Tag {
1199
+ DDOG_PROF_MAPPING_ID_RESULT_OK_GENERATIONAL_ID_MAPPING_ID,
1200
+ DDOG_PROF_MAPPING_ID_RESULT_ERR_GENERATIONAL_ID_MAPPING_ID,
1201
+ } ddog_prof_MappingId_Result_Tag;
1202
+
1203
+ typedef struct ddog_prof_MappingId_Result {
1204
+ ddog_prof_MappingId_Result_Tag tag;
1205
+ union {
1206
+ struct {
1207
+ struct ddog_prof_MappingId ok;
1208
+ };
1209
+ struct {
1210
+ struct ddog_Error err;
1211
+ };
1212
+ };
1213
+ } ddog_prof_MappingId_Result;
1214
+
1215
+ typedef struct OpaqueStackTraceId {
1216
+ uint32_t _0;
1217
+ } OpaqueStackTraceId;
1218
+
1219
+ typedef struct ddog_prof_StackTraceId {
1220
+ struct ddog_prof_Generation generation;
1221
+ struct OpaqueStackTraceId id;
1222
+ } ddog_prof_StackTraceId;
1223
+
1224
+ /**
1225
+ * A generic result type for when an operation may fail,
1226
+ * or may return <T> in case of success.
1227
+ */
1228
+ typedef enum ddog_prof_StackTraceId_Result_Tag {
1229
+ DDOG_PROF_STACK_TRACE_ID_RESULT_OK_GENERATIONAL_ID_STACK_TRACE_ID,
1230
+ DDOG_PROF_STACK_TRACE_ID_RESULT_ERR_GENERATIONAL_ID_STACK_TRACE_ID,
1231
+ } ddog_prof_StackTraceId_Result_Tag;
1232
+
1233
+ typedef struct ddog_prof_StackTraceId_Result {
1234
+ ddog_prof_StackTraceId_Result_Tag tag;
1235
+ union {
1236
+ struct {
1237
+ struct ddog_prof_StackTraceId ok;
1238
+ };
1239
+ struct {
1240
+ struct ddog_Error err;
1241
+ };
1242
+ };
1243
+ } ddog_prof_StackTraceId_Result;
1244
+
1245
+ typedef struct ddog_prof_Slice_LocationId {
1246
+ /**
1247
+ * Should be non-null and suitably aligned for the underlying type. It is
1248
+ * allowed but not recommended for the pointer to be null when the len is
1249
+ * zero.
1250
+ */
1251
+ const struct ddog_prof_LocationId *ptr;
1252
+ /**
1253
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
1254
+ * than or equal to [isize::MAX].
1255
+ */
1256
+ uintptr_t len;
1257
+ } ddog_prof_Slice_LocationId;
1258
+
1259
+ typedef struct ddog_prof_Slice_CharSlice {
1260
+ /**
1261
+ * Should be non-null and suitably aligned for the underlying type. It is
1262
+ * allowed but not recommended for the pointer to be null when the len is
1263
+ * zero.
1264
+ */
1265
+ const ddog_CharSlice *ptr;
1266
+ /**
1267
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
1268
+ * than or equal to [isize::MAX].
1269
+ */
1270
+ uintptr_t len;
1271
+ } ddog_prof_Slice_CharSlice;
1272
+
1273
+ /**
1274
+ * A generic result type for when an operation may fail,
1275
+ * or may return <T> in case of success.
1276
+ */
1277
+ typedef enum ddog_prof_Result_Generation_Tag {
1278
+ DDOG_PROF_RESULT_GENERATION_OK_GENERATION,
1279
+ DDOG_PROF_RESULT_GENERATION_ERR_GENERATION,
1280
+ } ddog_prof_Result_Generation_Tag;
1281
+
1282
+ typedef struct ddog_prof_Result_Generation {
1283
+ ddog_prof_Result_Generation_Tag tag;
1284
+ union {
1285
+ struct {
1286
+ struct ddog_prof_Generation ok;
1287
+ };
1288
+ struct {
1289
+ struct ddog_Error err;
1290
+ };
1291
+ };
1292
+ } ddog_prof_Result_Generation;
1293
+
1294
+ typedef enum ddog_prof_ManagedStringStorageNewResult_Tag {
1295
+ DDOG_PROF_MANAGED_STRING_STORAGE_NEW_RESULT_OK,
1296
+ DDOG_PROF_MANAGED_STRING_STORAGE_NEW_RESULT_ERR,
1297
+ } ddog_prof_ManagedStringStorageNewResult_Tag;
1298
+
1299
+ typedef struct ddog_prof_ManagedStringStorageNewResult {
1300
+ ddog_prof_ManagedStringStorageNewResult_Tag tag;
1301
+ union {
1302
+ struct {
1303
+ struct ddog_prof_ManagedStringStorage ok;
1304
+ };
1305
+ struct {
1306
+ struct ddog_Error err;
1307
+ };
1308
+ };
1309
+ } ddog_prof_ManagedStringStorageNewResult;
1310
+
1311
+ typedef enum ddog_prof_ManagedStringStorageInternResult_Tag {
1312
+ DDOG_PROF_MANAGED_STRING_STORAGE_INTERN_RESULT_OK,
1313
+ DDOG_PROF_MANAGED_STRING_STORAGE_INTERN_RESULT_ERR,
1314
+ } ddog_prof_ManagedStringStorageInternResult_Tag;
1315
+
1316
+ typedef struct ddog_prof_ManagedStringStorageInternResult {
1317
+ ddog_prof_ManagedStringStorageInternResult_Tag tag;
1318
+ union {
1319
+ struct {
1320
+ struct ddog_prof_ManagedStringId ok;
1321
+ };
1322
+ struct {
1323
+ struct ddog_Error err;
1324
+ };
1325
+ };
1326
+ } ddog_prof_ManagedStringStorageInternResult;
1327
+
1328
+ typedef enum ddog_prof_Option_Error_Tag {
1329
+ DDOG_PROF_OPTION_ERROR_SOME_ERROR,
1330
+ DDOG_PROF_OPTION_ERROR_NONE_ERROR,
1331
+ } ddog_prof_Option_Error_Tag;
1332
+
1333
+ typedef struct ddog_prof_Option_Error {
1334
+ ddog_prof_Option_Error_Tag tag;
1335
+ union {
1336
+ struct {
1337
+ struct ddog_Error some;
1338
+ };
1339
+ };
1340
+ } ddog_prof_Option_Error;
1341
+
1342
+ typedef struct ddog_prof_Option_Error ddog_prof_MaybeError;
1343
+
1344
+ typedef enum ddog_StringWrapperResult_Tag {
1345
+ DDOG_STRING_WRAPPER_RESULT_OK,
1346
+ DDOG_STRING_WRAPPER_RESULT_ERR,
1347
+ } ddog_StringWrapperResult_Tag;
1348
+
1349
+ typedef struct ddog_StringWrapperResult {
1350
+ ddog_StringWrapperResult_Tag tag;
1351
+ union {
1352
+ struct {
1353
+ struct ddog_StringWrapper ok;
1354
+ };
1355
+ struct {
1356
+ struct ddog_Error err;
1357
+ };
1358
+ };
1359
+ } ddog_StringWrapperResult;
1360
+
1361
+ typedef struct ddog_prof_StringId ddog_prof_StringId;
1362
+
1363
+ typedef enum ddog_ConfigurationOrigin {
1364
+ DDOG_CONFIGURATION_ORIGIN_ENV_VAR,
1365
+ DDOG_CONFIGURATION_ORIGIN_CODE,
1366
+ DDOG_CONFIGURATION_ORIGIN_DD_CONFIG,
1367
+ DDOG_CONFIGURATION_ORIGIN_REMOTE_CONFIG,
1368
+ DDOG_CONFIGURATION_ORIGIN_DEFAULT,
1369
+ DDOG_CONFIGURATION_ORIGIN_LOCAL_STABLE_CONFIG,
1370
+ DDOG_CONFIGURATION_ORIGIN_FLEET_STABLE_CONFIG,
1371
+ DDOG_CONFIGURATION_ORIGIN_CALCULATED,
1372
+ } ddog_ConfigurationOrigin;
1373
+
1374
+ typedef enum ddog_LogLevel {
1375
+ DDOG_LOG_LEVEL_ERROR,
1376
+ DDOG_LOG_LEVEL_WARN,
1377
+ DDOG_LOG_LEVEL_DEBUG,
1378
+ } ddog_LogLevel;
1379
+
1380
+ typedef enum ddog_MetricNamespace {
1381
+ DDOG_METRIC_NAMESPACE_TRACERS,
1382
+ DDOG_METRIC_NAMESPACE_PROFILERS,
1383
+ DDOG_METRIC_NAMESPACE_RUM,
1384
+ DDOG_METRIC_NAMESPACE_APPSEC,
1385
+ DDOG_METRIC_NAMESPACE_IDE_PLUGINS,
1386
+ DDOG_METRIC_NAMESPACE_LIVE_DEBUGGER,
1387
+ DDOG_METRIC_NAMESPACE_IAST,
1388
+ DDOG_METRIC_NAMESPACE_GENERAL,
1389
+ DDOG_METRIC_NAMESPACE_TELEMETRY,
1390
+ DDOG_METRIC_NAMESPACE_APM,
1391
+ DDOG_METRIC_NAMESPACE_SIDECAR,
1392
+ } ddog_MetricNamespace;
1393
+
1394
+ typedef enum ddog_MetricType {
1395
+ DDOG_METRIC_TYPE_GAUGE,
1396
+ DDOG_METRIC_TYPE_COUNT,
1397
+ DDOG_METRIC_TYPE_DISTRIBUTION,
1398
+ } ddog_MetricType;
1399
+
1400
+ typedef enum ddog_TelemetryWorkerBuilderBoolProperty {
1401
+ DDOG_TELEMETRY_WORKER_BUILDER_BOOL_PROPERTY_CONFIG_TELEMETRY_DEBUG_LOGGING_ENABLED,
1402
+ } ddog_TelemetryWorkerBuilderBoolProperty;
1403
+
1404
+ typedef enum ddog_TelemetryWorkerBuilderEndpointProperty {
1405
+ DDOG_TELEMETRY_WORKER_BUILDER_ENDPOINT_PROPERTY_CONFIG_ENDPOINT,
1406
+ } ddog_TelemetryWorkerBuilderEndpointProperty;
1407
+
1408
+ typedef enum ddog_TelemetryWorkerBuilderStrProperty {
1409
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_APPLICATION_SERVICE_VERSION,
1410
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_APPLICATION_ENV,
1411
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_APPLICATION_RUNTIME_NAME,
1412
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_APPLICATION_RUNTIME_VERSION,
1413
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_APPLICATION_RUNTIME_PATCHES,
1414
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_HOST_CONTAINER_ID,
1415
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_HOST_OS,
1416
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_HOST_KERNEL_NAME,
1417
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_HOST_KERNEL_RELEASE,
1418
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_HOST_KERNEL_VERSION,
1419
+ DDOG_TELEMETRY_WORKER_BUILDER_STR_PROPERTY_RUNTIME_ID,
1420
+ } ddog_TelemetryWorkerBuilderStrProperty;
1421
+
1422
+ typedef struct ddog_TelemetryWorkerBuilder ddog_TelemetryWorkerBuilder;
1423
+
1424
+ /**
1425
+ * TelemetryWorkerHandle is a handle which allows interactions with the telemetry worker.
1426
+ * The handle is safe to use across threads.
1427
+ *
1428
+ * The worker won't send data to the agent until you call `TelemetryWorkerHandle::send_start`
1429
+ *
1430
+ * To stop the worker, call `TelemetryWorkerHandle::send_stop` which trigger flush asynchronously
1431
+ * then `TelemetryWorkerHandle::wait_for_shutdown`
1432
+ */
1433
+ typedef struct ddog_TelemetryWorkerHandle ddog_TelemetryWorkerHandle;
1434
+
1435
+ typedef enum ddog_Option_U64_Tag {
1436
+ DDOG_OPTION_U64_SOME_U64,
1437
+ DDOG_OPTION_U64_NONE_U64,
1438
+ } ddog_Option_U64_Tag;
1439
+
1440
+ typedef struct ddog_Option_U64 {
1441
+ ddog_Option_U64_Tag tag;
1442
+ union {
1443
+ struct {
1444
+ uint64_t some;
1445
+ };
1446
+ };
1447
+ } ddog_Option_U64;
1448
+
1449
+ typedef enum ddog_Option_Bool_Tag {
1450
+ DDOG_OPTION_BOOL_SOME_BOOL,
1451
+ DDOG_OPTION_BOOL_NONE_BOOL,
1452
+ } ddog_Option_Bool_Tag;
1453
+
1454
+ typedef struct ddog_Option_Bool {
1455
+ ddog_Option_Bool_Tag tag;
1456
+ union {
1457
+ struct {
1458
+ bool some;
1459
+ };
1460
+ };
1461
+ } ddog_Option_Bool;
1462
+
1463
+ typedef struct ddog_ContextKey {
1464
+ uint32_t _0;
1465
+ enum ddog_MetricType _1;
1466
+ } ddog_ContextKey;
1467
+
1468
+ /**
1469
+ * Represent error codes that `Error` struct can hold
1470
+ */
1471
+ typedef enum ddog_TraceExporterErrorCode {
1472
+ DDOG_TRACE_EXPORTER_ERROR_CODE_ADDRESS_IN_USE,
1473
+ DDOG_TRACE_EXPORTER_ERROR_CODE_CONNECTION_ABORTED,
1474
+ DDOG_TRACE_EXPORTER_ERROR_CODE_CONNECTION_REFUSED,
1475
+ DDOG_TRACE_EXPORTER_ERROR_CODE_CONNECTION_RESET,
1476
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_BODY_FORMAT,
1477
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_BODY_TOO_LONG,
1478
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_CLIENT,
1479
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_EMPTY_BODY,
1480
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_PARSE,
1481
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_SERVER,
1482
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_UNKNOWN,
1483
+ DDOG_TRACE_EXPORTER_ERROR_CODE_HTTP_WRONG_STATUS,
1484
+ DDOG_TRACE_EXPORTER_ERROR_CODE_INVALID_ARGUMENT,
1485
+ DDOG_TRACE_EXPORTER_ERROR_CODE_INVALID_DATA,
1486
+ DDOG_TRACE_EXPORTER_ERROR_CODE_INVALID_INPUT,
1487
+ DDOG_TRACE_EXPORTER_ERROR_CODE_INVALID_URL,
1488
+ DDOG_TRACE_EXPORTER_ERROR_CODE_IO_ERROR,
1489
+ DDOG_TRACE_EXPORTER_ERROR_CODE_NETWORK_UNKNOWN,
1490
+ DDOG_TRACE_EXPORTER_ERROR_CODE_SERDE,
1491
+ DDOG_TRACE_EXPORTER_ERROR_CODE_SHUTDOWN,
1492
+ DDOG_TRACE_EXPORTER_ERROR_CODE_TIMED_OUT,
1493
+ DDOG_TRACE_EXPORTER_ERROR_CODE_TELEMETRY,
1494
+ DDOG_TRACE_EXPORTER_ERROR_CODE_INTERNAL,
1495
+ DDOG_TRACE_EXPORTER_ERROR_CODE_PANIC,
1496
+ } ddog_TraceExporterErrorCode;
1497
+
1498
+ /**
1499
+ * Structure containing the agent response to a trace payload
1500
+ * MUST be freed with `ddog_trace_exporter_response_free`
1501
+ *
1502
+ * If the agent payload version is enabled on the trace exporter, and
1503
+ * the agent response indicates that the payload version hasn't changed,
1504
+ * the body will be empty.
1505
+ */
1506
+ typedef struct ddog_TraceExporterResponse ddog_TraceExporterResponse;
1507
+
1508
+ typedef struct ddog_TraceExporter ddog_TraceExporter;
1509
+
1510
+ /**
1511
+ * The TraceExporterConfig object will hold the configuration properties for the TraceExporter.
1512
+ * Once the configuration is passed to the TraceExporter constructor the config is no longer
1513
+ * needed by the handle and it can be freed.
1514
+ */
1515
+ typedef struct ddog_TraceExporterConfig ddog_TraceExporterConfig;
1516
+
1517
+ /**
1518
+ * Structure that contains error information that `TraceExporter` API can return.
1519
+ */
1520
+ typedef struct ddog_TraceExporterError {
1521
+ enum ddog_TraceExporterErrorCode code;
1522
+ char *msg;
1523
+ } ddog_TraceExporterError;
1524
+
1525
+ /**
1526
+ * FFI compatible configuration for the TelemetryClient.
1527
+ */
1528
+ typedef struct ddog_TelemetryClientConfig {
1529
+ /**
1530
+ * How often telemetry should be sent, in milliseconds.
1531
+ */
1532
+ uint64_t interval;
1533
+ /**
1534
+ * A V4 UUID that represents a tracer session. This ID should:
1535
+ * - Be generated when the tracer starts
1536
+ * - Be identical within the context of a host (i.e. multiple threads/processes that belong to
1537
+ * a single instrumented app should share the same runtime_id)
1538
+ * - Be associated with traces to allow correlation between traces and telemetry data
1539
+ */
1540
+ ddog_CharSlice runtime_id;
1541
+ /**
1542
+ * Whether to enable debug mode for telemetry.
1543
+ * When enabled, sets the DD-Telemetry-Debug-Enabled header to true.
1544
+ * Defaults to false.
1545
+ */
1546
+ bool debug_enabled;
1547
+ } ddog_TelemetryClientConfig;
1548
+
1549
+ typedef enum ddog_LibraryConfigSource {
1550
+ DDOG_LIBRARY_CONFIG_SOURCE_LOCAL_STABLE_CONFIG = 0,
1551
+ DDOG_LIBRARY_CONFIG_SOURCE_FLEET_STABLE_CONFIG = 1,
1552
+ } ddog_LibraryConfigSource;
1553
+
1554
+ /**
1555
+ * Represents the types of metadata that can be set on a `TracerMetadata` object.
1556
+ */
1557
+ typedef enum ddog_MetadataKind {
1558
+ DDOG_METADATA_KIND_RUNTIME_ID = 0,
1559
+ DDOG_METADATA_KIND_TRACER_LANGUAGE = 1,
1560
+ DDOG_METADATA_KIND_TRACER_VERSION = 2,
1561
+ DDOG_METADATA_KIND_HOSTNAME = 3,
1562
+ DDOG_METADATA_KIND_SERVICE_NAME = 4,
1563
+ DDOG_METADATA_KIND_SERVICE_ENV = 5,
1564
+ DDOG_METADATA_KIND_SERVICE_VERSION = 6,
1565
+ DDOG_METADATA_KIND_PROCESS_TAGS = 7,
1566
+ DDOG_METADATA_KIND_CONTAINER_ID = 8,
1567
+ } ddog_MetadataKind;
1568
+
1569
+ typedef struct ddog_Configurator ddog_Configurator;
1570
+
1571
+ /**
1572
+ * This struct MUST be backward compatible.
1573
+ */
1574
+ typedef struct ddog_TracerMetadata ddog_TracerMetadata;
1575
+
1576
+ /**
1577
+ * Ffi safe type representing a borrowed null-terminated C array
1578
+ * Equivalent to a std::ffi::CStr
1579
+ */
1580
+ typedef struct ddog_CStr {
1581
+ /**
1582
+ * Null terminated char array
1583
+ */
1584
+ char *ptr;
1585
+ /**
1586
+ * Length of the array, not counting the null-terminator
1587
+ */
1588
+ uintptr_t length;
1589
+ } ddog_CStr;
1590
+
1591
+ typedef struct ddog_Slice_CharSlice {
1592
+ /**
1593
+ * Should be non-null and suitably aligned for the underlying type. It is
1594
+ * allowed but not recommended for the pointer to be null when the len is
1595
+ * zero.
1596
+ */
1597
+ const ddog_CharSlice *ptr;
1598
+ /**
1599
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
1600
+ * than or equal to [isize::MAX].
1601
+ */
1602
+ uintptr_t len;
1603
+ } ddog_Slice_CharSlice;
1604
+
1605
+ typedef struct ddog_ProcessInfo {
1606
+ struct ddog_Slice_CharSlice args;
1607
+ struct ddog_Slice_CharSlice envp;
1608
+ ddog_CharSlice language;
1609
+ } ddog_ProcessInfo;
1610
+
1611
+ /**
1612
+ * Ffi safe type representing an owned null-terminated C array
1613
+ * Equivalent to a std::ffi::CString
1614
+ */
1615
+ typedef struct ddog_CString {
1616
+ /**
1617
+ * Null terminated char array
1618
+ */
1619
+ char *ptr;
1620
+ /**
1621
+ * Length of the array, not counting the null-terminator
1622
+ */
1623
+ uintptr_t length;
1624
+ } ddog_CString;
1625
+
1626
+ typedef struct ddog_LibraryConfig {
1627
+ struct ddog_CString name;
1628
+ struct ddog_CString value;
1629
+ enum ddog_LibraryConfigSource source;
1630
+ struct ddog_CString config_id;
1631
+ } ddog_LibraryConfig;
1632
+
1633
+ /**
1634
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
1635
+ * never from C.
1636
+ */
1637
+ typedef struct ddog_Vec_LibraryConfig {
1638
+ const struct ddog_LibraryConfig *ptr;
1639
+ uintptr_t len;
1640
+ uintptr_t capacity;
1641
+ } ddog_Vec_LibraryConfig;
1642
+
1643
+ /**
1644
+ * A result type that includes debug/log messages along with the data
1645
+ */
1646
+ typedef struct ddog_OkResult {
1647
+ struct ddog_Vec_LibraryConfig value;
1648
+ struct ddog_CString logs;
1649
+ } ddog_OkResult;
1650
+
1651
+ typedef enum ddog_LibraryConfigLoggedResult_Tag {
1652
+ DDOG_LIBRARY_CONFIG_LOGGED_RESULT_OK,
1653
+ DDOG_LIBRARY_CONFIG_LOGGED_RESULT_ERR,
1654
+ } ddog_LibraryConfigLoggedResult_Tag;
1655
+
1656
+ typedef struct ddog_LibraryConfigLoggedResult {
1657
+ ddog_LibraryConfigLoggedResult_Tag tag;
1658
+ union {
1659
+ struct {
1660
+ struct ddog_OkResult ok;
1661
+ };
1662
+ struct {
1663
+ struct ddog_Error err;
1664
+ };
1665
+ };
1666
+ } ddog_LibraryConfigLoggedResult;
1667
+
1668
+ /**
1669
+ * C-compatible representation of an anonymous file handle
1670
+ */
1671
+ typedef struct ddog_TracerMemfdHandle {
1672
+ /**
1673
+ * File descriptor (relevant only on Linux)
1674
+ */
1675
+ int fd;
1676
+ } ddog_TracerMemfdHandle;
1677
+
1678
+ /**
1679
+ * A generic result type for when an operation may fail,
1680
+ * or may return <T> in case of success.
1681
+ */
1682
+ typedef enum ddog_Result_TracerMemfdHandle_Tag {
1683
+ DDOG_RESULT_TRACER_MEMFD_HANDLE_OK_TRACER_MEMFD_HANDLE,
1684
+ DDOG_RESULT_TRACER_MEMFD_HANDLE_ERR_TRACER_MEMFD_HANDLE,
1685
+ } ddog_Result_TracerMemfdHandle_Tag;
1686
+
1687
+ typedef struct ddog_Result_TracerMemfdHandle {
1688
+ ddog_Result_TracerMemfdHandle_Tag tag;
1689
+ union {
1690
+ struct {
1691
+ struct ddog_TracerMemfdHandle ok;
1692
+ };
1693
+ struct {
1694
+ struct ddog_Error err;
1695
+ };
1696
+ };
1697
+ } ddog_Result_TracerMemfdHandle;
1698
+
1699
+ /**
1700
+ * Log level for filtering log events.
1701
+ */
1702
+ typedef enum ddog_LogEventLevel {
1703
+ /**
1704
+ * The "trace" level.
1705
+ *
1706
+ * Designates very low priority, often extremely verbose, information.
1707
+ */
1708
+ DDOG_LOG_EVENT_LEVEL_TRACE = 0,
1709
+ /**
1710
+ * The "debug" level.
1711
+ *
1712
+ * Designates lower priority information.
1713
+ */
1714
+ DDOG_LOG_EVENT_LEVEL_DEBUG = 1,
1715
+ /**
1716
+ * The "info" level.
1717
+ *
1718
+ * Designates useful information.
1719
+ */
1720
+ DDOG_LOG_EVENT_LEVEL_INFO = 2,
1721
+ /**
1722
+ * The "warn" level.
1723
+ *
1724
+ * Designates hazardous situations.
1725
+ */
1726
+ DDOG_LOG_EVENT_LEVEL_WARN = 3,
1727
+ /**
1728
+ * The "error" level.
1729
+ *
1730
+ * Designates very serious errors.
1731
+ */
1732
+ DDOG_LOG_EVENT_LEVEL_ERROR = 4,
1733
+ } ddog_LogEventLevel;
1734
+
1735
+ /**
1736
+ * Target for standard stream output.
1737
+ */
1738
+ typedef enum ddog_StdTarget {
1739
+ /**
1740
+ * Write to standard output (stdout).
1741
+ */
1742
+ DDOG_STD_TARGET_OUT,
1743
+ /**
1744
+ * Write to standard error (stderr).
1745
+ */
1746
+ DDOG_STD_TARGET_ERR,
1747
+ } ddog_StdTarget;
1748
+
1749
+ /**
1750
+ * Configuration for standard stream output.
1751
+ */
1752
+ typedef struct ddog_StdConfig {
1753
+ /**
1754
+ * Target stream (stdout or stderr)
1755
+ */
1756
+ enum ddog_StdTarget target;
1757
+ } ddog_StdConfig;
1758
+
1759
+ /**
1760
+ * Configuration for file output.
1761
+ */
1762
+ typedef struct ddog_FileConfig {
1763
+ /**
1764
+ * Path to the log file
1765
+ */
1766
+ ddog_CharSlice path;
1767
+ /**
1768
+ * Maximum total number of files (current + rotated) to keep on disk.
1769
+ * When this limit is exceeded, the oldest rotated files are deleted.
1770
+ * Set to 0 to disable file cleanup.
1771
+ */
1772
+ uint64_t max_files;
1773
+ /**
1774
+ * Maximum size in bytes for each log file.
1775
+ * Set to 0 to disable size-based rotation.
1776
+ */
1777
+ uint64_t max_size_bytes;
1778
+ } ddog_FileConfig;
1779
+
1780
+ /**
1781
+ * This is a minimal DDSketch implementation
1782
+ *
1783
+ * This implementation only supports a part of the standard (which is also only the parts dd
1784
+ * backend supports :shrug:)
1785
+ * - max length contiguous bin store, with lower bin collapse behavior.
1786
+ * - Positive or zero values
1787
+ *
1788
+ * The default sketch has a 1% relative accuracy, and only accepts positive points
1789
+ *
1790
+ * See <https://github.com/DataDog/sketches-go> for the reference implementation
1791
+ */
1792
+ typedef struct ddsketch_DDSketch ddsketch_DDSketch;
1793
+
1794
+ /**
1795
+ * Represents an object that should only be referred to by its handle.
1796
+ * Do not access its member for any reason, only use the C API functions on this struct.
1797
+ */
1798
+ typedef struct ddsketch_Handle_DDSketch {
1799
+ struct ddsketch_DDSketch *inner;
1800
+ } ddsketch_Handle_DDSketch;
1801
+
1802
+ typedef enum ddog_ffe_ErrorCode {
1803
+ DDOG_FFE_ERROR_CODE_OK,
1804
+ DDOG_FFE_ERROR_CODE_TYPE_MISMATCH,
1805
+ DDOG_FFE_ERROR_CODE_PARSE_ERROR,
1806
+ DDOG_FFE_ERROR_CODE_FLAG_NOT_FOUND,
1807
+ DDOG_FFE_ERROR_CODE_TARGETING_KEY_MISSING,
1808
+ DDOG_FFE_ERROR_CODE_INVALID_CONTEXT,
1809
+ DDOG_FFE_ERROR_CODE_PROVIDER_NOT_READY,
1810
+ DDOG_FFE_ERROR_CODE_GENERAL,
1811
+ } ddog_ffe_ErrorCode;
1812
+
1813
+ typedef enum ddog_ffe_ExpectedFlagType {
1814
+ DDOG_FFE_EXPECTED_FLAG_TYPE_STRING,
1815
+ DDOG_FFE_EXPECTED_FLAG_TYPE_INTEGER,
1816
+ DDOG_FFE_EXPECTED_FLAG_TYPE_FLOAT,
1817
+ DDOG_FFE_EXPECTED_FLAG_TYPE_BOOLEAN,
1818
+ DDOG_FFE_EXPECTED_FLAG_TYPE_OBJECT,
1819
+ DDOG_FFE_EXPECTED_FLAG_TYPE_NUMBER,
1820
+ DDOG_FFE_EXPECTED_FLAG_TYPE_ANY,
1821
+ } ddog_ffe_ExpectedFlagType;
1822
+
1823
+ typedef enum ddog_ffe_Reason {
1824
+ DDOG_FFE_REASON_STATIC,
1825
+ DDOG_FFE_REASON_DEFAULT,
1826
+ DDOG_FFE_REASON_TARGETING_MATCH,
1827
+ DDOG_FFE_REASON_SPLIT,
1828
+ DDOG_FFE_REASON_DISABLED,
1829
+ DDOG_FFE_REASON_ERROR,
1830
+ } ddog_ffe_Reason;
1831
+
1832
+ /**
1833
+ * Remote configuration for the feature flagging client. It's a central piece that defines client
1834
+ * behavior.
1835
+ */
1836
+ typedef struct ddog_ffe_Configuration ddog_ffe_Configuration;
1837
+
1838
+ /**
1839
+ * `Subject` is a bundle of subject attributes and a key.
1840
+ */
1841
+ typedef struct ddog_ffe_EvaluationContext ddog_ffe_EvaluationContext;
1842
+
1843
+ /**
1844
+ * Opaque type representing a result of evaluation.
1845
+ */
1846
+ typedef struct ddog_ffe_ResolutionDetails ddog_ffe_ResolutionDetails;
1847
+
1848
+ /**
1849
+ * An opaque handle for a resource. The inner fields must not be dereferenced.
1850
+ *
1851
+ * This is similar to `libdd_common_ffi::Handle` but only allows shared access to internal
1852
+ * resource, so it's safe to share between thread or access concurrently (if the underlying type
1853
+ * is).
1854
+ *
1855
+ * # Ownership
1856
+ *
1857
+ * `Handle::free()` must be called exactly once on any created Handle. Failure to do that will
1858
+ * result in a memory leak.
1859
+ */
1860
+ typedef struct ddog_ffe_ResolutionDetails *ddog_ffe_Handle_ResolutionDetails;
1861
+
1862
+ /**
1863
+ * An opaque handle for a resource. The inner fields must not be dereferenced.
1864
+ *
1865
+ * This is similar to `libdd_common_ffi::Handle` but only allows shared access to internal
1866
+ * resource, so it's safe to share between thread or access concurrently (if the underlying type
1867
+ * is).
1868
+ *
1869
+ * # Ownership
1870
+ *
1871
+ * `Handle::free()` must be called exactly once on any created Handle. Failure to do that will
1872
+ * result in a memory leak.
1873
+ */
1874
+ typedef struct ddog_ffe_Configuration *ddog_ffe_Handle_Configuration;
1875
+
1876
+ /**
1877
+ * An opaque handle for a resource. The inner fields must not be dereferenced.
1878
+ *
1879
+ * This is similar to `libdd_common_ffi::Handle` but only allows shared access to internal
1880
+ * resource, so it's safe to share between thread or access concurrently (if the underlying type
1881
+ * is).
1882
+ *
1883
+ * # Ownership
1884
+ *
1885
+ * `Handle::free()` must be called exactly once on any created Handle. Failure to do that will
1886
+ * result in a memory leak.
1887
+ */
1888
+ typedef struct ddog_ffe_EvaluationContext *ddog_ffe_Handle_EvaluationContext;
1889
+
1890
+ /**
1891
+ * A string that has been borrowed. Beware that it is NOT nul-terminated!
1892
+ *
1893
+ * # Ownership
1894
+ *
1895
+ * This string is non-owning. You must not free `ptr`.
1896
+ *
1897
+ * # Safety
1898
+ *
1899
+ * - The string is not NUL-terminated, it can only be used with API that accept the len as an
1900
+ * additional parameter.
1901
+ * - The value must not be used after the value it borrowed from has been moved, modified, or
1902
+ * freed.
1903
+ */
1904
+ typedef struct ddog_ffe_BorrowedStr {
1905
+ /**
1906
+ * May be NULL if `len` is `0`.
1907
+ */
1908
+ const uint8_t *ptr;
1909
+ uintptr_t len;
1910
+ } ddog_ffe_BorrowedStr;
1911
+
1912
+ typedef enum ddog_ffe_VariantValue_Tag {
1913
+ /**
1914
+ * Evaluation did not produce any value.
1915
+ */
1916
+ DDOG_FFE_VARIANT_VALUE_NONE,
1917
+ DDOG_FFE_VARIANT_VALUE_STRING,
1918
+ DDOG_FFE_VARIANT_VALUE_INTEGER,
1919
+ DDOG_FFE_VARIANT_VALUE_FLOAT,
1920
+ DDOG_FFE_VARIANT_VALUE_BOOLEAN,
1921
+ DDOG_FFE_VARIANT_VALUE_OBJECT,
1922
+ } ddog_ffe_VariantValue_Tag;
1923
+
1924
+ typedef struct ddog_ffe_VariantValue {
1925
+ ddog_ffe_VariantValue_Tag tag;
1926
+ union {
1927
+ struct {
1928
+ struct ddog_ffe_BorrowedStr string;
1929
+ };
1930
+ struct {
1931
+ int64_t integer;
1932
+ };
1933
+ struct {
1934
+ double float_;
1935
+ };
1936
+ struct {
1937
+ bool boolean;
1938
+ };
1939
+ struct {
1940
+ struct ddog_ffe_BorrowedStr object;
1941
+ };
1942
+ };
1943
+ } ddog_ffe_VariantValue;
1944
+
1945
+ typedef struct ddog_ffe_KeyValue_BorrowedStr {
1946
+ struct ddog_ffe_BorrowedStr key;
1947
+ struct ddog_ffe_BorrowedStr value;
1948
+ } ddog_ffe_KeyValue_BorrowedStr;
1949
+
1950
+ typedef struct ddog_ffe_ArrayMap_BorrowedStr {
1951
+ const struct ddog_ffe_KeyValue_BorrowedStr *elements;
1952
+ uintptr_t count;
1953
+ } ddog_ffe_ArrayMap_BorrowedStr;
1954
+
1955
+ /**
1956
+ * A generic result type for when an operation may fail,
1957
+ * or may return <T> in case of success.
1958
+ */
1959
+ typedef enum ddog_ffe_Result_HandleConfiguration_Tag {
1960
+ DDOG_FFE_RESULT_HANDLE_CONFIGURATION_OK_HANDLE_CONFIGURATION,
1961
+ DDOG_FFE_RESULT_HANDLE_CONFIGURATION_ERR_HANDLE_CONFIGURATION,
1962
+ } ddog_ffe_Result_HandleConfiguration_Tag;
1963
+
1964
+ typedef struct ddog_ffe_Result_HandleConfiguration {
1965
+ ddog_ffe_Result_HandleConfiguration_Tag tag;
1966
+ union {
1967
+ struct {
1968
+ ddog_ffe_Handle_Configuration ok;
1969
+ };
1970
+ struct {
1971
+ struct ddog_Error err;
1972
+ };
1973
+ };
1974
+ } ddog_ffe_Result_HandleConfiguration;
1975
+
1976
+ /**
1977
+ * # Safety
1978
+ * - `string` must be a valid C string.
1979
+ */
1980
+ typedef enum ddog_ffe_AttributeValue_Tag {
1981
+ DDOG_FFE_ATTRIBUTE_VALUE_STRING,
1982
+ DDOG_FFE_ATTRIBUTE_VALUE_NUMBER,
1983
+ DDOG_FFE_ATTRIBUTE_VALUE_BOOLEAN,
1984
+ } ddog_ffe_AttributeValue_Tag;
1985
+
1986
+ typedef struct ddog_ffe_AttributeValue {
1987
+ ddog_ffe_AttributeValue_Tag tag;
1988
+ union {
1989
+ struct {
1990
+ const char *string;
1991
+ };
1992
+ struct {
1993
+ double number;
1994
+ };
1995
+ struct {
1996
+ bool boolean;
1997
+ };
1998
+ };
1999
+ } ddog_ffe_AttributeValue;
2000
+
2001
+ /**
2002
+ * Represents a key-value pair for attributes.
2003
+ *
2004
+ * # Safety
2005
+ * - `name` must be a valid C string.
2006
+ */
2007
+ typedef struct ddog_ffe_AttributePair {
2008
+ const char *name;
2009
+ struct ddog_ffe_AttributeValue value;
2010
+ } ddog_ffe_AttributePair;
2011
+
2012
+ typedef enum ddog_crasht_BuildIdType {
2013
+ DDOG_CRASHT_BUILD_ID_TYPE_GNU,
2014
+ DDOG_CRASHT_BUILD_ID_TYPE_GO,
2015
+ DDOG_CRASHT_BUILD_ID_TYPE_PDB,
2016
+ DDOG_CRASHT_BUILD_ID_TYPE_SHA1,
2017
+ } ddog_crasht_BuildIdType;
2018
+
2019
+ /**
2020
+ * Result type for runtime callback registration
2021
+ */
2022
+ typedef enum ddog_crasht_CallbackResult {
2023
+ DDOG_CRASHT_CALLBACK_RESULT_OK,
2024
+ DDOG_CRASHT_CALLBACK_RESULT_ERROR,
2025
+ } ddog_crasht_CallbackResult;
2026
+
2027
+ typedef enum ddog_crasht_DemangleOptions {
2028
+ DDOG_CRASHT_DEMANGLE_OPTIONS_COMPLETE,
2029
+ DDOG_CRASHT_DEMANGLE_OPTIONS_NAME_ONLY,
2030
+ } ddog_crasht_DemangleOptions;
2031
+
2032
+ typedef enum ddog_crasht_ErrorKind {
2033
+ DDOG_CRASHT_ERROR_KIND_PANIC,
2034
+ DDOG_CRASHT_ERROR_KIND_UNHANDLED_EXCEPTION,
2035
+ DDOG_CRASHT_ERROR_KIND_UNIX_SIGNAL,
2036
+ } ddog_crasht_ErrorKind;
2037
+
2038
+ typedef enum ddog_crasht_FileType {
2039
+ DDOG_CRASHT_FILE_TYPE_APK,
2040
+ DDOG_CRASHT_FILE_TYPE_ELF,
2041
+ DDOG_CRASHT_FILE_TYPE_PE,
2042
+ } ddog_crasht_FileType;
2043
+
2044
+ /**
2045
+ * This enum represents operations a the tracked library might be engaged in.
2046
+ * Currently only implemented for profiling.
2047
+ * The idea is that if a crash consistently occurs while a particular operation
2048
+ * is ongoing, its likely related.
2049
+ *
2050
+ * In the future, we might also track wall-clock time of operations
2051
+ * (or some statistical sampling thereof) using the same enum.
2052
+ *
2053
+ * NOTE: This enum is known to be non-exhaustive. Feel free to add new types
2054
+ * as needed.
2055
+ */
2056
+ typedef enum ddog_crasht_OpTypes {
2057
+ DDOG_CRASHT_OP_TYPES_PROFILER_INACTIVE = 0,
2058
+ DDOG_CRASHT_OP_TYPES_PROFILER_COLLECTING_SAMPLE,
2059
+ DDOG_CRASHT_OP_TYPES_PROFILER_UNWINDING,
2060
+ DDOG_CRASHT_OP_TYPES_PROFILER_SERIALIZING,
2061
+ /**
2062
+ * Dummy value to allow easier iteration
2063
+ */
2064
+ DDOG_CRASHT_OP_TYPES_SIZE,
2065
+ } ddog_crasht_OpTypes;
2066
+
2067
+ /**
2068
+ * See https://man7.org/linux/man-pages/man2/sigaction.2.html
2069
+ * MUST REMAIN IN SYNC WITH THE ENUM IN emit_sigcodes.c
2070
+ */
2071
+ typedef enum ddog_crasht_SiCodes {
2072
+ DDOG_CRASHT_SI_CODES_BUS_ADRALN,
2073
+ DDOG_CRASHT_SI_CODES_BUS_ADRERR,
2074
+ DDOG_CRASHT_SI_CODES_BUS_MCEERR_AO,
2075
+ DDOG_CRASHT_SI_CODES_BUS_MCEERR_AR,
2076
+ DDOG_CRASHT_SI_CODES_BUS_OBJERR,
2077
+ DDOG_CRASHT_SI_CODES_ILL_BADSTK,
2078
+ DDOG_CRASHT_SI_CODES_ILL_COPROC,
2079
+ DDOG_CRASHT_SI_CODES_ILL_ILLADR,
2080
+ DDOG_CRASHT_SI_CODES_ILL_ILLOPC,
2081
+ DDOG_CRASHT_SI_CODES_ILL_ILLOPN,
2082
+ DDOG_CRASHT_SI_CODES_ILL_ILLTRP,
2083
+ DDOG_CRASHT_SI_CODES_ILL_PRVOPC,
2084
+ DDOG_CRASHT_SI_CODES_ILL_PRVREG,
2085
+ DDOG_CRASHT_SI_CODES_SEGV_ACCERR,
2086
+ DDOG_CRASHT_SI_CODES_SEGV_BNDERR,
2087
+ DDOG_CRASHT_SI_CODES_SEGV_MAPERR,
2088
+ DDOG_CRASHT_SI_CODES_SEGV_PKUERR,
2089
+ DDOG_CRASHT_SI_CODES_SI_ASYNCIO,
2090
+ DDOG_CRASHT_SI_CODES_SI_KERNEL,
2091
+ DDOG_CRASHT_SI_CODES_SI_MESGQ,
2092
+ DDOG_CRASHT_SI_CODES_SI_QUEUE,
2093
+ DDOG_CRASHT_SI_CODES_SI_SIGIO,
2094
+ DDOG_CRASHT_SI_CODES_SI_TIMER,
2095
+ DDOG_CRASHT_SI_CODES_SI_TKILL,
2096
+ DDOG_CRASHT_SI_CODES_SI_USER,
2097
+ DDOG_CRASHT_SI_CODES_SYS_SECCOMP,
2098
+ DDOG_CRASHT_SI_CODES_UNKNOWN,
2099
+ } ddog_crasht_SiCodes;
2100
+
2101
+ /**
2102
+ * See https://man7.org/linux/man-pages/man7/signal.7.html
2103
+ */
2104
+ typedef enum ddog_crasht_SignalNames {
2105
+ DDOG_CRASHT_SIGNAL_NAMES_SIGHUP,
2106
+ DDOG_CRASHT_SIGNAL_NAMES_SIGINT,
2107
+ DDOG_CRASHT_SIGNAL_NAMES_SIGQUIT,
2108
+ DDOG_CRASHT_SIGNAL_NAMES_SIGILL,
2109
+ DDOG_CRASHT_SIGNAL_NAMES_SIGTRAP,
2110
+ DDOG_CRASHT_SIGNAL_NAMES_SIGABRT,
2111
+ DDOG_CRASHT_SIGNAL_NAMES_SIGBUS,
2112
+ DDOG_CRASHT_SIGNAL_NAMES_SIGFPE,
2113
+ DDOG_CRASHT_SIGNAL_NAMES_SIGKILL,
2114
+ DDOG_CRASHT_SIGNAL_NAMES_SIGUSR1,
2115
+ DDOG_CRASHT_SIGNAL_NAMES_SIGSEGV,
2116
+ DDOG_CRASHT_SIGNAL_NAMES_SIGUSR2,
2117
+ DDOG_CRASHT_SIGNAL_NAMES_SIGPIPE,
2118
+ DDOG_CRASHT_SIGNAL_NAMES_SIGALRM,
2119
+ DDOG_CRASHT_SIGNAL_NAMES_SIGTERM,
2120
+ DDOG_CRASHT_SIGNAL_NAMES_SIGCHLD,
2121
+ DDOG_CRASHT_SIGNAL_NAMES_SIGCONT,
2122
+ DDOG_CRASHT_SIGNAL_NAMES_SIGSTOP,
2123
+ DDOG_CRASHT_SIGNAL_NAMES_SIGTSTP,
2124
+ DDOG_CRASHT_SIGNAL_NAMES_SIGTTIN,
2125
+ DDOG_CRASHT_SIGNAL_NAMES_SIGTTOU,
2126
+ DDOG_CRASHT_SIGNAL_NAMES_SIGURG,
2127
+ DDOG_CRASHT_SIGNAL_NAMES_SIGXCPU,
2128
+ DDOG_CRASHT_SIGNAL_NAMES_SIGXFSZ,
2129
+ DDOG_CRASHT_SIGNAL_NAMES_SIGVTALRM,
2130
+ DDOG_CRASHT_SIGNAL_NAMES_SIGPROF,
2131
+ DDOG_CRASHT_SIGNAL_NAMES_SIGWINCH,
2132
+ DDOG_CRASHT_SIGNAL_NAMES_SIGIO,
2133
+ DDOG_CRASHT_SIGNAL_NAMES_SIGSYS,
2134
+ DDOG_CRASHT_SIGNAL_NAMES_SIGEMT,
2135
+ DDOG_CRASHT_SIGNAL_NAMES_SIGINFO,
2136
+ DDOG_CRASHT_SIGNAL_NAMES_UNKNOWN,
2137
+ } ddog_crasht_SignalNames;
2138
+
2139
+ /**
2140
+ * Stacktrace collection occurs in the context of a crashing process.
2141
+ * If the stack is sufficiently corruputed, it is possible (but unlikely),
2142
+ * for stack trace collection itself to crash.
2143
+ * We recommend fully enabling stacktrace collection, but having an environment
2144
+ * variable to allow downgrading the collector.
2145
+ */
2146
+ typedef enum ddog_crasht_StacktraceCollection {
2147
+ /**
2148
+ * Stacktrace collection occurs in the
2149
+ */
2150
+ DDOG_CRASHT_STACKTRACE_COLLECTION_DISABLED,
2151
+ DDOG_CRASHT_STACKTRACE_COLLECTION_WITHOUT_SYMBOLS,
2152
+ /**
2153
+ * This option uses `backtrace::resolve_frame_unsynchronized()` to gather symbol information
2154
+ * and also unwind inlined functions. Enabling this feature will not only provide symbolic
2155
+ * details, but may also yield additional or less stack frames compared to other
2156
+ * configurations.
2157
+ */
2158
+ DDOG_CRASHT_STACKTRACE_COLLECTION_ENABLED_WITH_INPROCESS_SYMBOLS,
2159
+ DDOG_CRASHT_STACKTRACE_COLLECTION_ENABLED_WITH_SYMBOLS_IN_RECEIVER,
2160
+ } ddog_crasht_StacktraceCollection;
2161
+
2162
+ typedef struct ddog_crasht_CrashInfo ddog_crasht_CrashInfo;
2163
+
2164
+ typedef struct ddog_crasht_CrashInfoBuilder ddog_crasht_CrashInfoBuilder;
2165
+
2166
+ typedef struct ddog_crasht_StackFrame ddog_crasht_StackFrame;
2167
+
2168
+ typedef struct ddog_crasht_StackTrace ddog_crasht_StackTrace;
2169
+
2170
+ typedef struct ddog_crasht_Slice_CharSlice {
2171
+ /**
2172
+ * Should be non-null and suitably aligned for the underlying type. It is
2173
+ * allowed but not recommended for the pointer to be null when the len is
2174
+ * zero.
2175
+ */
2176
+ const ddog_CharSlice *ptr;
2177
+ /**
2178
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
2179
+ * than or equal to [isize::MAX].
2180
+ */
2181
+ uintptr_t len;
2182
+ } ddog_crasht_Slice_CharSlice;
2183
+
2184
+ typedef struct ddog_crasht_Slice_I32 {
2185
+ /**
2186
+ * Should be non-null and suitably aligned for the underlying type. It is
2187
+ * allowed but not recommended for the pointer to be null when the len is
2188
+ * zero.
2189
+ */
2190
+ const int32_t *ptr;
2191
+ /**
2192
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
2193
+ * than or equal to [isize::MAX].
2194
+ */
2195
+ uintptr_t len;
2196
+ } ddog_crasht_Slice_I32;
2197
+
2198
+ typedef struct ddog_crasht_Config {
2199
+ struct ddog_crasht_Slice_CharSlice additional_files;
2200
+ bool create_alt_stack;
2201
+ bool demangle_names;
2202
+ /**
2203
+ * The endpoint to send the crash report to (can be a file://).
2204
+ * If None, the crashtracker will infer the agent host from env variables.
2205
+ */
2206
+ const struct ddog_Endpoint *endpoint;
2207
+ /**
2208
+ * Optional filename for a unix domain socket if the receiver is used asynchonously
2209
+ */
2210
+ ddog_CharSlice optional_unix_socket_filename;
2211
+ enum ddog_crasht_StacktraceCollection resolve_frames;
2212
+ /**
2213
+ * The set of signals we should be registered for.
2214
+ * If empty, use the default set.
2215
+ */
2216
+ struct ddog_crasht_Slice_I32 signals;
2217
+ /**
2218
+ * Timeout in milliseconds before the signal handler starts tearing things down to return.
2219
+ * If 0, uses the default timeout as specified in
2220
+ * `libdd_crashtracker::shared::constants::DD_CRASHTRACK_DEFAULT_TIMEOUT`. Otherwise, uses
2221
+ * the specified timeout value.
2222
+ * This is given as a uint32_t, but the actual timeout needs to fit inside of an i32 (max
2223
+ * 2^31-1). This is a limitation of the various interfaces used to guarantee the timeout.
2224
+ */
2225
+ uint32_t timeout_ms;
2226
+ bool use_alt_stack;
2227
+ } ddog_crasht_Config;
2228
+
2229
+ typedef struct ddog_crasht_EnvVar {
2230
+ ddog_CharSlice key;
2231
+ ddog_CharSlice val;
2232
+ } ddog_crasht_EnvVar;
2233
+
2234
+ typedef struct ddog_crasht_Slice_EnvVar {
2235
+ /**
2236
+ * Should be non-null and suitably aligned for the underlying type. It is
2237
+ * allowed but not recommended for the pointer to be null when the len is
2238
+ * zero.
2239
+ */
2240
+ const struct ddog_crasht_EnvVar *ptr;
2241
+ /**
2242
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
2243
+ * than or equal to [isize::MAX].
2244
+ */
2245
+ uintptr_t len;
2246
+ } ddog_crasht_Slice_EnvVar;
2247
+
2248
+ typedef struct ddog_crasht_ReceiverConfig {
2249
+ struct ddog_crasht_Slice_CharSlice args;
2250
+ struct ddog_crasht_Slice_EnvVar env;
2251
+ ddog_CharSlice path_to_receiver_binary;
2252
+ /**
2253
+ * Optional filename to forward stderr to (useful for logging/debugging)
2254
+ */
2255
+ ddog_CharSlice optional_stderr_filename;
2256
+ /**
2257
+ * Optional filename to forward stdout to (useful for logging/debugging)
2258
+ */
2259
+ ddog_CharSlice optional_stdout_filename;
2260
+ } ddog_crasht_ReceiverConfig;
2261
+
2262
+ typedef struct ddog_crasht_Metadata {
2263
+ ddog_CharSlice library_name;
2264
+ ddog_CharSlice library_version;
2265
+ ddog_CharSlice family;
2266
+ /**
2267
+ * Should include "service", "environment", etc
2268
+ */
2269
+ const struct ddog_Vec_Tag *tags;
2270
+ } ddog_crasht_Metadata;
2271
+
2272
+ typedef struct ddog_crasht_Slice_CInt {
2273
+ /**
2274
+ * Should be non-null and suitably aligned for the underlying type. It is
2275
+ * allowed but not recommended for the pointer to be null when the len is
2276
+ * zero.
2277
+ */
2278
+ const int *ptr;
2279
+ /**
2280
+ * The number of elements (not bytes) that `.ptr` points to. Must be less
2281
+ * than or equal to [isize::MAX].
2282
+ */
2283
+ uintptr_t len;
2284
+ } ddog_crasht_Slice_CInt;
2285
+
2286
+ /**
2287
+ * A generic result type for when an operation may fail,
2288
+ * or may return <T> in case of success.
2289
+ */
2290
+ typedef enum ddog_crasht_Result_Usize_Tag {
2291
+ DDOG_CRASHT_RESULT_USIZE_OK_USIZE,
2292
+ DDOG_CRASHT_RESULT_USIZE_ERR_USIZE,
2293
+ } ddog_crasht_Result_Usize_Tag;
2294
+
2295
+ typedef struct ddog_crasht_Result_Usize {
2296
+ ddog_crasht_Result_Usize_Tag tag;
2297
+ union {
2298
+ struct {
2299
+ uintptr_t ok;
2300
+ };
2301
+ struct {
2302
+ struct ddog_Error err;
2303
+ };
2304
+ };
2305
+ } ddog_crasht_Result_Usize;
2306
+
2307
+ /**
2308
+ * Represents an object that should only be referred to by its handle.
2309
+ * Do not access its member for any reason, only use the C API functions on this struct.
2310
+ */
2311
+ typedef struct ddog_crasht_Handle_CrashInfo {
2312
+ struct ddog_crasht_CrashInfo *inner;
2313
+ } ddog_crasht_Handle_CrashInfo;
2314
+
2315
+ /**
2316
+ * Represents an object that should only be referred to by its handle.
2317
+ * Do not access its member for any reason, only use the C API functions on this struct.
2318
+ */
2319
+ typedef struct ddog_crasht_Handle_CrashInfoBuilder {
2320
+ struct ddog_crasht_CrashInfoBuilder *inner;
2321
+ } ddog_crasht_Handle_CrashInfoBuilder;
2322
+
2323
+ typedef enum ddog_crasht_CrashInfoBuilder_NewResult_Tag {
2324
+ DDOG_CRASHT_CRASH_INFO_BUILDER_NEW_RESULT_OK,
2325
+ DDOG_CRASHT_CRASH_INFO_BUILDER_NEW_RESULT_ERR,
2326
+ } ddog_crasht_CrashInfoBuilder_NewResult_Tag;
2327
+
2328
+ typedef struct ddog_crasht_CrashInfoBuilder_NewResult {
2329
+ ddog_crasht_CrashInfoBuilder_NewResult_Tag tag;
2330
+ union {
2331
+ struct {
2332
+ struct ddog_crasht_Handle_CrashInfoBuilder ok;
2333
+ };
2334
+ struct {
2335
+ struct ddog_Error err;
2336
+ };
2337
+ };
2338
+ } ddog_crasht_CrashInfoBuilder_NewResult;
2339
+
2340
+ /**
2341
+ * A generic result type for when an operation may fail,
2342
+ * or may return <T> in case of success.
2343
+ */
2344
+ typedef enum ddog_crasht_Result_HandleCrashInfo_Tag {
2345
+ DDOG_CRASHT_RESULT_HANDLE_CRASH_INFO_OK_HANDLE_CRASH_INFO,
2346
+ DDOG_CRASHT_RESULT_HANDLE_CRASH_INFO_ERR_HANDLE_CRASH_INFO,
2347
+ } ddog_crasht_Result_HandleCrashInfo_Tag;
2348
+
2349
+ typedef struct ddog_crasht_Result_HandleCrashInfo {
2350
+ ddog_crasht_Result_HandleCrashInfo_Tag tag;
2351
+ union {
2352
+ struct {
2353
+ struct ddog_crasht_Handle_CrashInfo ok;
2354
+ };
2355
+ struct {
2356
+ struct ddog_Error err;
2357
+ };
2358
+ };
2359
+ } ddog_crasht_Result_HandleCrashInfo;
2360
+
2361
+ typedef struct ddog_crasht_Result_HandleCrashInfo ddog_crasht_CrashInfo_NewResult;
2362
+
2363
+ typedef struct ddog_crasht_OsInfo {
2364
+ ddog_CharSlice architecture;
2365
+ ddog_CharSlice bitness;
2366
+ ddog_CharSlice os_type;
2367
+ ddog_CharSlice version;
2368
+ } ddog_crasht_OsInfo;
2369
+
2370
+ typedef struct ddog_crasht_ProcInfo {
2371
+ uint32_t pid;
2372
+ } ddog_crasht_ProcInfo;
2373
+
2374
+ typedef struct ddog_crasht_SigInfo {
2375
+ ddog_CharSlice addr;
2376
+ int code;
2377
+ enum ddog_crasht_SiCodes code_human_readable;
2378
+ int signo;
2379
+ enum ddog_crasht_SignalNames signo_human_readable;
2380
+ } ddog_crasht_SigInfo;
2381
+
2382
+ typedef struct ddog_crasht_Span {
2383
+ ddog_CharSlice id;
2384
+ ddog_CharSlice thread_name;
2385
+ } ddog_crasht_Span;
2386
+
2387
+ /**
2388
+ * Represents an object that should only be referred to by its handle.
2389
+ * Do not access its member for any reason, only use the C API functions on this struct.
2390
+ */
2391
+ typedef struct ddog_crasht_Handle_StackTrace {
2392
+ struct ddog_crasht_StackTrace *inner;
2393
+ } ddog_crasht_Handle_StackTrace;
2394
+
2395
+ typedef struct ddog_crasht_ThreadData {
2396
+ bool crashed;
2397
+ ddog_CharSlice name;
2398
+ struct ddog_crasht_Handle_StackTrace stack;
2399
+ ddog_CharSlice state;
2400
+ } ddog_crasht_ThreadData;
2401
+
2402
+ /**
2403
+ * Represents an object that should only be referred to by its handle.
2404
+ * Do not access its member for any reason, only use the C API functions on this struct.
2405
+ */
2406
+ typedef struct ddog_crasht_Handle_StackFrame {
2407
+ struct ddog_crasht_StackFrame *inner;
2408
+ } ddog_crasht_Handle_StackFrame;
2409
+
2410
+ typedef enum ddog_crasht_StackFrame_NewResult_Tag {
2411
+ DDOG_CRASHT_STACK_FRAME_NEW_RESULT_OK,
2412
+ DDOG_CRASHT_STACK_FRAME_NEW_RESULT_ERR,
2413
+ } ddog_crasht_StackFrame_NewResult_Tag;
2414
+
2415
+ typedef struct ddog_crasht_StackFrame_NewResult {
2416
+ ddog_crasht_StackFrame_NewResult_Tag tag;
2417
+ union {
2418
+ struct {
2419
+ struct ddog_crasht_Handle_StackFrame ok;
2420
+ };
2421
+ struct {
2422
+ struct ddog_Error err;
2423
+ };
2424
+ };
2425
+ } ddog_crasht_StackFrame_NewResult;
2426
+
2427
+ typedef enum ddog_crasht_StackTrace_NewResult_Tag {
2428
+ DDOG_CRASHT_STACK_TRACE_NEW_RESULT_OK,
2429
+ DDOG_CRASHT_STACK_TRACE_NEW_RESULT_ERR,
2430
+ } ddog_crasht_StackTrace_NewResult_Tag;
2431
+
2432
+ typedef struct ddog_crasht_StackTrace_NewResult {
2433
+ ddog_crasht_StackTrace_NewResult_Tag tag;
2434
+ union {
2435
+ struct {
2436
+ struct ddog_crasht_Handle_StackTrace ok;
2437
+ };
2438
+ struct {
2439
+ struct ddog_Error err;
2440
+ };
2441
+ };
2442
+ } ddog_crasht_StackTrace_NewResult;
2443
+
2444
+ typedef struct ddog_crasht_RuntimeStackFrame {
2445
+ /**
2446
+ * Line number in source file (0 if unknown)
2447
+ */
2448
+ uint32_t line;
2449
+ /**
2450
+ * Column number in source file (0 if unknown)
2451
+ */
2452
+ uint32_t column;
2453
+ /**
2454
+ * Function name (fully qualified if possible)
2455
+ */
2456
+ ddog_CharSlice function;
2457
+ /**
2458
+ * Source file name
2459
+ */
2460
+ ddog_CharSlice file;
2461
+ /**
2462
+ * Type name (class/module/namespace/etc.)
2463
+ */
2464
+ ddog_CharSlice type_name;
2465
+ } ddog_crasht_RuntimeStackFrame;
2466
+
2467
+ typedef void (*ddog_crasht_RuntimeStackFrameCallback)(void (*emit_frame)(const struct ddog_crasht_RuntimeStackFrame*));
2468
+
2469
+ /**
2470
+ * Function signature for runtime stacktrace string collection callbacks
2471
+ *
2472
+ * This callback is invoked during crash handling in a signal context, so it must be signal-safe:
2473
+ *
2474
+ * # Parameters
2475
+ * - `emit_stacktrace_string`: Function to call for complete stacktrace string (takes C string)
2476
+ *
2477
+ * # Safety
2478
+ * The callback function is marked unsafe because:
2479
+ * - It receives function pointers that take raw pointers as parameters
2480
+ * - All C strings passed must be null-terminated and remain valid for the call duration
2481
+ */
2482
+ typedef void (*ddog_crasht_RuntimeStacktraceStringCallback)(void (*emit_stacktrace_string)(const char*));
2483
+
2484
+ #ifdef __cplusplus
2485
+ extern "C" {
2486
+ #endif // __cplusplus
2487
+
2488
+ /**
2489
+ * Drops the error. It should not be used after this, though the
2490
+ * implementation tries to limit the damage in the case of use-after-free and
2491
+ * double-free scenarios.
2492
+ *
2493
+ * # Safety
2494
+ *
2495
+ * Only pass null or a pointer to a valid, mutable `ddog_Error`.
2496
+ */
2497
+ void ddog_Error_drop(struct ddog_Error *error);
2498
+
2499
+ /**
2500
+ * Returns a CharSlice of the error's message that is valid until the error
2501
+ * is dropped.
2502
+ * # Safety
2503
+ * Only pass null or a valid reference to a `ddog_Error`.
2504
+ */
2505
+ ddog_CharSlice ddog_Error_message(const struct ddog_Error *error);
2506
+
2507
+ void ddog_MaybeError_drop(ddog_MaybeError);
2508
+
2509
+ /**
2510
+ * Creates a new ArrayQueue with the given capacity and item_delete_fn.
2511
+ * The item_delete_fn is called when an item is dropped from the queue.
2512
+ */
2513
+ DDOG_CHECK_RETURN
2514
+ struct ddog_ArrayQueue_NewResult ddog_ArrayQueue_new(uintptr_t capacity,
2515
+ void (*item_delete_fn)(void*));
2516
+
2517
+ /**
2518
+ * Drops the ArrayQueue.
2519
+ * # Safety
2520
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new.
2521
+ */
2522
+ void ddog_ArrayQueue_drop(struct ddog_ArrayQueue *queue);
2523
+
2524
+ /**
2525
+ * Pushes an item into the ArrayQueue. It returns the given value if the queue is full.
2526
+ * # Safety
2527
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new. The value
2528
+ * is null or points to a valid memory location that can be deallocated by the item_delete_fn.
2529
+ */
2530
+ struct ddog_ArrayQueue_PushResult ddog_ArrayQueue_push(const struct ddog_ArrayQueue *queue_ptr,
2531
+ void *value);
2532
+
2533
+ /**
2534
+ * Pushes an element into the queue, replacing the oldest element if necessary.
2535
+ * # Safety
2536
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new. The value
2537
+ * is null or points to a valid memory location that can be deallocated by the item_delete_fn.
2538
+ */
2539
+ DDOG_CHECK_RETURN
2540
+ struct ddog_ArrayQueue_PushResult ddog_ArrayQueue_force_push(const struct ddog_ArrayQueue *queue_ptr,
2541
+ void *value);
2542
+
2543
+ /**
2544
+ * Pops an item from the ArrayQueue.
2545
+ * # Safety
2546
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new.
2547
+ */
2548
+ DDOG_CHECK_RETURN
2549
+ struct ddog_ArrayQueue_PopResult ddog_ArrayQueue_pop(const struct ddog_ArrayQueue *queue_ptr);
2550
+
2551
+ /**
2552
+ * Checks if the ArrayQueue is empty.
2553
+ * # Safety
2554
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new.
2555
+ */
2556
+ struct ddog_ArrayQueue_BoolResult ddog_ArrayQueue_is_empty(const struct ddog_ArrayQueue *queue_ptr);
2557
+
2558
+ /**
2559
+ * Returns the length of the ArrayQueue.
2560
+ * # Safety
2561
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new.
2562
+ */
2563
+ struct ddog_ArrayQueue_UsizeResult ddog_ArrayQueue_len(const struct ddog_ArrayQueue *queue_ptr);
2564
+
2565
+ /**
2566
+ * Returns true if the underlying queue is full.
2567
+ * # Safety
2568
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new.
2569
+ */
2570
+ struct ddog_ArrayQueue_BoolResult ddog_ArrayQueue_is_full(const struct ddog_ArrayQueue *queue_ptr);
2571
+
2572
+ /**
2573
+ * Returns the capacity of the ArrayQueue.
2574
+ * # Safety
2575
+ * The pointer is null or points to a valid memory location allocated by ArrayQueue_new.
2576
+ */
2577
+ struct ddog_ArrayQueue_UsizeResult ddog_ArrayQueue_capacity(const struct ddog_ArrayQueue *queue_ptr);
2578
+
2579
+ DDOG_CHECK_RETURN struct ddog_Endpoint *ddog_endpoint_from_url(ddog_CharSlice url);
2580
+
2581
+ DDOG_CHECK_RETURN struct ddog_Endpoint *ddog_endpoint_from_filename(ddog_CharSlice filename);
2582
+
2583
+ DDOG_CHECK_RETURN struct ddog_Endpoint *ddog_endpoint_from_api_key(ddog_CharSlice api_key);
2584
+
2585
+ DDOG_CHECK_RETURN
2586
+ struct ddog_Error *ddog_endpoint_from_api_key_and_site(ddog_CharSlice api_key,
2587
+ ddog_CharSlice site,
2588
+ struct ddog_Endpoint **endpoint);
2589
+
2590
+ void ddog_endpoint_set_timeout(struct ddog_Endpoint *endpoint, uint64_t millis);
2591
+
2592
+ void ddog_endpoint_set_test_token(struct ddog_Endpoint *endpoint, ddog_CharSlice token);
2593
+
2594
+ void ddog_endpoint_drop(struct ddog_Endpoint*);
2595
+
2596
+ struct ddog_Option_U32 ddog_Option_U32_some(uint32_t v);
2597
+
2598
+ struct ddog_Option_U32 ddog_Option_U32_none(void);
2599
+
2600
+ /**
2601
+ * Drops a `ddog_StringWrapper`. It should not be used after this, though the
2602
+ * implementation tries to limit the damage in the case of use-after-free and
2603
+ * double-free scenarios.
2604
+ *
2605
+ * # Safety
2606
+ *
2607
+ * Only pass null or a pointer to a valid, mutable `ddog_StringWrapper`.
2608
+ */
2609
+ void ddog_StringWrapper_drop(struct ddog_StringWrapper *s);
2610
+
2611
+ /**
2612
+ * Returns a CharSlice of the message.
2613
+ *
2614
+ * # Safety
2615
+ *
2616
+ * Only pass null or a valid reference to a `ddog_StringWrapper`.
2617
+ * The string should not be mutated nor dropped while the CharSlice is alive.
2618
+ */
2619
+ ddog_CharSlice ddog_StringWrapper_message(const struct ddog_StringWrapper *s);
2620
+
2621
+ DDOG_CHECK_RETURN struct ddog_Vec_Tag ddog_Vec_Tag_new(void);
2622
+
2623
+ void ddog_Vec_Tag_drop(struct ddog_Vec_Tag);
2624
+
2625
+ /**
2626
+ * Creates a new Tag from the provided `key` and `value` by doing a utf8
2627
+ * lossy conversion, and pushes into the `vec`. The strings `key` and `value`
2628
+ * are cloned to avoid FFI lifetime issues.
2629
+ *
2630
+ * # Safety
2631
+ * The `vec` must be a valid reference.
2632
+ * The CharSlices `key` and `value` must point to at least many bytes as their
2633
+ * `.len` properties claim.
2634
+ */
2635
+ DDOG_CHECK_RETURN
2636
+ struct ddog_Vec_Tag_PushResult ddog_Vec_Tag_push(struct ddog_Vec_Tag *vec,
2637
+ ddog_CharSlice key,
2638
+ ddog_CharSlice value);
2639
+
2640
+ /**
2641
+ * # Safety
2642
+ * The `string`'s .ptr must point to a valid object at least as large as its
2643
+ * .len property.
2644
+ */
2645
+ DDOG_CHECK_RETURN struct ddog_Vec_Tag_ParseResult ddog_Vec_Tag_parse(ddog_CharSlice string);
2646
+
2647
+ #ifdef __cplusplus
2648
+ } // extern "C"
2649
+ #endif // __cplusplus
2650
+
2651
+ #endif /* DDOG_COMMON_H */