libdatadog 0.7.0.1.1-aarch64-linux → 0.9.0.1.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +2 -2
  3. data/lib/libdatadog.rb +1 -1
  4. data/vendor/{libdatadog-0.7.0 → libdatadog-0.9.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
  5. data/vendor/{libdatadog-0.7.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-0.9.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/LICENSE-3rdparty.yml +32 -140
  6. data/vendor/{libdatadog-0.7.0 → libdatadog-0.9.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
  7. data/vendor/libdatadog-0.9.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/common.h +481 -0
  8. data/vendor/libdatadog-0.9.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/profiling.h +214 -0
  9. data/vendor/libdatadog-0.9.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +78 -0
  10. data/vendor/libdatadog-0.9.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  11. data/vendor/{libdatadog-0.7.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/ddprof_ffi_with_rpath.pc → libdatadog-0.9.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc} +3 -3
  12. data/vendor/{libdatadog-0.7.0 → libdatadog-0.9.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
  13. data/vendor/{libdatadog-0.7.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-0.9.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/LICENSE-3rdparty.yml +32 -140
  14. data/vendor/{libdatadog-0.7.0 → libdatadog-0.9.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
  15. data/vendor/libdatadog-0.9.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/common.h +481 -0
  16. data/vendor/libdatadog-0.9.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/profiling.h +214 -0
  17. data/vendor/libdatadog-0.9.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +78 -0
  18. data/vendor/libdatadog-0.9.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  19. data/vendor/{libdatadog-0.7.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/ddprof_ffi_with_rpath.pc → libdatadog-0.9.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc} +3 -3
  20. metadata +18 -14
  21. data/vendor/libdatadog-0.7.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/ddprof/ffi.h +0 -591
  22. data/vendor/libdatadog-0.7.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libddprof_ffi.so +0 -0
  23. data/vendor/libdatadog-0.7.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/ddprof/ffi.h +0 -591
  24. data/vendor/libdatadog-0.7.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libddprof_ffi.so +0 -0
@@ -0,0 +1,481 @@
1
+ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
2
+ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.
3
+
4
+
5
+ #ifndef DDOG_COMMON_H
6
+ #define DDOG_COMMON_H
7
+
8
+ #include <stdbool.h>
9
+ #include <stddef.h>
10
+ #include <stdint.h>
11
+
12
+ #if defined(_MSC_VER)
13
+ #define DDOG_CHARSLICE_C(string) \
14
+ /* NOTE: Compilation fails if you pass in a char* instead of a literal */ {.ptr = "" string, .len = sizeof(string) - 1}
15
+ #else
16
+ #define DDOG_CHARSLICE_C(string) \
17
+ /* NOTE: Compilation fails if you pass in a char* instead of a literal */ ((ddog_CharSlice){ .ptr = "" string, .len = sizeof(string) - 1 })
18
+ #endif
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
+ typedef struct ddog_Tag ddog_Tag;
43
+
44
+ /**
45
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
46
+ * never from C.
47
+ * The names ptr and len were chosen to minimize conversion from a previous
48
+ * Buffer type which this has replaced to become more general.
49
+ */
50
+ typedef struct ddog_Vec_tag {
51
+ const struct ddog_Tag *ptr;
52
+ uintptr_t len;
53
+ uintptr_t capacity;
54
+ } ddog_Vec_tag;
55
+
56
+ /**
57
+ * Holds the raw parts of a Rust Vec; it should only be created from Rust,
58
+ * never from C.
59
+ * The names ptr and len were chosen to minimize conversion from a previous
60
+ * Buffer type which this has replaced to become more general.
61
+ */
62
+ typedef struct ddog_Vec_u8 {
63
+ const uint8_t *ptr;
64
+ uintptr_t len;
65
+ uintptr_t capacity;
66
+ } ddog_Vec_u8;
67
+
68
+ typedef enum ddog_PushTagResult_Tag {
69
+ DDOG_PUSH_TAG_RESULT_OK,
70
+ DDOG_PUSH_TAG_RESULT_ERR,
71
+ } ddog_PushTagResult_Tag;
72
+
73
+ typedef struct ddog_PushTagResult {
74
+ ddog_PushTagResult_Tag tag;
75
+ union {
76
+ struct {
77
+ struct ddog_Vec_u8 err;
78
+ };
79
+ };
80
+ } ddog_PushTagResult;
81
+
82
+ /**
83
+ * Remember, the data inside of each member is potentially coming from FFI,
84
+ * so every operation on it is unsafe!
85
+ */
86
+ typedef struct ddog_Slice_c_char {
87
+ const char *ptr;
88
+ uintptr_t len;
89
+ } ddog_Slice_c_char;
90
+
91
+ typedef struct ddog_Slice_c_char ddog_CharSlice;
92
+
93
+ typedef struct ddog_ParseTagsResult {
94
+ struct ddog_Vec_tag tags;
95
+ struct ddog_Vec_u8 *error_message;
96
+ } ddog_ParseTagsResult;
97
+
98
+ typedef enum ddog_LogLevel {
99
+ DDOG_LOG_LEVEL_ERROR,
100
+ DDOG_LOG_LEVEL_WARN,
101
+ DDOG_LOG_LEVEL_DEBUG,
102
+ } ddog_LogLevel;
103
+
104
+ typedef struct ddog_TelemetryWorkerBuilder ddog_TelemetryWorkerBuilder;
105
+
106
+ typedef struct ddog_TelemetryWorkerHandle ddog_TelemetryWorkerHandle;
107
+
108
+ typedef enum ddog_Option_vec_u8_Tag {
109
+ DDOG_OPTION_VEC_U8_SOME_VEC_U8,
110
+ DDOG_OPTION_VEC_U8_NONE_VEC_U8,
111
+ } ddog_Option_vec_u8_Tag;
112
+
113
+ typedef struct ddog_Option_vec_u8 {
114
+ ddog_Option_vec_u8_Tag tag;
115
+ union {
116
+ struct {
117
+ struct ddog_Vec_u8 some;
118
+ };
119
+ };
120
+ } ddog_Option_vec_u8;
121
+
122
+ typedef struct ddog_Option_vec_u8 ddog_MaybeError;
123
+
124
+ typedef enum ddog_Option_bool_Tag {
125
+ DDOG_OPTION_BOOL_SOME_BOOL,
126
+ DDOG_OPTION_BOOL_NONE_BOOL,
127
+ } ddog_Option_bool_Tag;
128
+
129
+ typedef struct ddog_Option_bool {
130
+ ddog_Option_bool_Tag tag;
131
+ union {
132
+ struct {
133
+ bool some;
134
+ };
135
+ };
136
+ } ddog_Option_bool;
137
+
138
+ typedef struct ddog_CancellationToken ddog_CancellationToken;
139
+
140
+ typedef struct ddog_Profile ddog_Profile;
141
+
142
+ typedef struct ddog_ProfileExporter ddog_ProfileExporter;
143
+
144
+ /**
145
+ * This type only exists to workaround a bug in cbindgen; may be removed in the
146
+ * future.
147
+ */
148
+ typedef struct ddog_Request ddog_Request;
149
+
150
+ typedef enum ddog_NewProfileExporterResult_Tag {
151
+ DDOG_NEW_PROFILE_EXPORTER_RESULT_OK,
152
+ DDOG_NEW_PROFILE_EXPORTER_RESULT_ERR,
153
+ } ddog_NewProfileExporterResult_Tag;
154
+
155
+ typedef struct ddog_NewProfileExporterResult {
156
+ ddog_NewProfileExporterResult_Tag tag;
157
+ union {
158
+ struct {
159
+ struct ddog_ProfileExporter *ok;
160
+ };
161
+ struct {
162
+ struct ddog_Vec_u8 err;
163
+ };
164
+ };
165
+ } ddog_NewProfileExporterResult;
166
+
167
+ typedef enum ddog_Endpoint_Tag {
168
+ DDOG_ENDPOINT_AGENT,
169
+ DDOG_ENDPOINT_AGENTLESS,
170
+ } ddog_Endpoint_Tag;
171
+
172
+ typedef struct ddog_Endpoint_ddog_Agentless_Body {
173
+ ddog_CharSlice _0;
174
+ ddog_CharSlice _1;
175
+ } ddog_Endpoint_ddog_Agentless_Body;
176
+
177
+ typedef struct ddog_Endpoint {
178
+ ddog_Endpoint_Tag tag;
179
+ union {
180
+ struct {
181
+ ddog_CharSlice agent;
182
+ };
183
+ ddog_Endpoint_ddog_Agentless_Body AGENTLESS;
184
+ };
185
+ } ddog_Endpoint;
186
+
187
+ /**
188
+ * Represents time since the Unix Epoch in seconds plus nanoseconds.
189
+ */
190
+ typedef struct ddog_Timespec {
191
+ int64_t seconds;
192
+ uint32_t nanoseconds;
193
+ } ddog_Timespec;
194
+
195
+ /**
196
+ * Remember, the data inside of each member is potentially coming from FFI,
197
+ * so every operation on it is unsafe!
198
+ */
199
+ typedef struct ddog_Slice_u8 {
200
+ const uint8_t *ptr;
201
+ uintptr_t len;
202
+ } ddog_Slice_u8;
203
+
204
+ /**
205
+ * Use to represent bytes -- does not need to be valid UTF-8.
206
+ */
207
+ typedef struct ddog_Slice_u8 ddog_ByteSlice;
208
+
209
+ typedef struct ddog_File {
210
+ ddog_CharSlice name;
211
+ ddog_ByteSlice file;
212
+ } ddog_File;
213
+
214
+ /**
215
+ * Remember, the data inside of each member is potentially coming from FFI,
216
+ * so every operation on it is unsafe!
217
+ */
218
+ typedef struct ddog_Slice_file {
219
+ const struct ddog_File *ptr;
220
+ uintptr_t len;
221
+ } ddog_Slice_file;
222
+
223
+ typedef struct ddog_HttpStatus {
224
+ uint16_t code;
225
+ } ddog_HttpStatus;
226
+
227
+ typedef enum ddog_SendResult_Tag {
228
+ DDOG_SEND_RESULT_HTTP_RESPONSE,
229
+ DDOG_SEND_RESULT_ERR,
230
+ } ddog_SendResult_Tag;
231
+
232
+ typedef struct ddog_SendResult {
233
+ ddog_SendResult_Tag tag;
234
+ union {
235
+ struct {
236
+ struct ddog_HttpStatus http_response;
237
+ };
238
+ struct {
239
+ struct ddog_Vec_u8 err;
240
+ };
241
+ };
242
+ } ddog_SendResult;
243
+
244
+ typedef struct ddog_ValueType {
245
+ ddog_CharSlice type_;
246
+ ddog_CharSlice unit;
247
+ } ddog_ValueType;
248
+
249
+ /**
250
+ * Remember, the data inside of each member is potentially coming from FFI,
251
+ * so every operation on it is unsafe!
252
+ */
253
+ typedef struct ddog_Slice_value_type {
254
+ const struct ddog_ValueType *ptr;
255
+ uintptr_t len;
256
+ } ddog_Slice_value_type;
257
+
258
+ typedef struct ddog_Period {
259
+ struct ddog_ValueType type_;
260
+ int64_t value;
261
+ } ddog_Period;
262
+
263
+ typedef struct ddog_Mapping {
264
+ /**
265
+ * Address at which the binary (or DLL) is loaded into memory.
266
+ */
267
+ uint64_t memory_start;
268
+ /**
269
+ * The limit of the address range occupied by this mapping.
270
+ */
271
+ uint64_t memory_limit;
272
+ /**
273
+ * Offset in the binary that corresponds to the first mapped address.
274
+ */
275
+ uint64_t file_offset;
276
+ /**
277
+ * The object this entry is loaded from. This can be a filename on
278
+ * disk for the main binary and shared libraries, or virtual
279
+ * abstractions like "[vdso]".
280
+ */
281
+ ddog_CharSlice filename;
282
+ /**
283
+ * A string that uniquely identifies a particular program version
284
+ * with high probability. E.g., for binaries generated by GNU tools,
285
+ * it could be the contents of the .note.gnu.build-id field.
286
+ */
287
+ ddog_CharSlice build_id;
288
+ } ddog_Mapping;
289
+
290
+ typedef struct ddog_Function {
291
+ /**
292
+ * Name of the function, in human-readable form if available.
293
+ */
294
+ ddog_CharSlice name;
295
+ /**
296
+ * Name of the function, as identified by the system.
297
+ * For instance, it can be a C++ mangled name.
298
+ */
299
+ ddog_CharSlice system_name;
300
+ /**
301
+ * Source file containing the function.
302
+ */
303
+ ddog_CharSlice filename;
304
+ /**
305
+ * Line number in source file.
306
+ */
307
+ int64_t start_line;
308
+ } ddog_Function;
309
+
310
+ typedef struct ddog_Line {
311
+ /**
312
+ * The corresponding profile.Function for this line.
313
+ */
314
+ struct ddog_Function function;
315
+ /**
316
+ * Line number in source code.
317
+ */
318
+ int64_t line;
319
+ } ddog_Line;
320
+
321
+ /**
322
+ * Remember, the data inside of each member is potentially coming from FFI,
323
+ * so every operation on it is unsafe!
324
+ */
325
+ typedef struct ddog_Slice_line {
326
+ const struct ddog_Line *ptr;
327
+ uintptr_t len;
328
+ } ddog_Slice_line;
329
+
330
+ typedef struct ddog_Location {
331
+ /**
332
+ * todo: how to handle unknown mapping?
333
+ */
334
+ struct ddog_Mapping mapping;
335
+ /**
336
+ * The instruction address for this location, if available. It
337
+ * should be within [Mapping.memory_start...Mapping.memory_limit]
338
+ * for the corresponding mapping. A non-leaf address may be in the
339
+ * middle of a call instruction. It is up to display tools to find
340
+ * the beginning of the instruction if necessary.
341
+ */
342
+ uint64_t address;
343
+ /**
344
+ * Multiple line indicates this location has inlined functions,
345
+ * where the last entry represents the caller into which the
346
+ * preceding entries were inlined.
347
+ *
348
+ * E.g., if memcpy() is inlined into printf:
349
+ * line[0].function_name == "memcpy"
350
+ * line[1].function_name == "printf"
351
+ */
352
+ struct ddog_Slice_line lines;
353
+ /**
354
+ * Provides an indication that multiple symbols map to this location's
355
+ * address, for example due to identical code folding by the linker. In that
356
+ * case the line information above represents one of the multiple
357
+ * symbols. This field must be recomputed when the symbolization state of the
358
+ * profile changes.
359
+ */
360
+ bool is_folded;
361
+ } ddog_Location;
362
+
363
+ /**
364
+ * Remember, the data inside of each member is potentially coming from FFI,
365
+ * so every operation on it is unsafe!
366
+ */
367
+ typedef struct ddog_Slice_location {
368
+ const struct ddog_Location *ptr;
369
+ uintptr_t len;
370
+ } ddog_Slice_location;
371
+
372
+ /**
373
+ * Remember, the data inside of each member is potentially coming from FFI,
374
+ * so every operation on it is unsafe!
375
+ */
376
+ typedef struct ddog_Slice_i64 {
377
+ const int64_t *ptr;
378
+ uintptr_t len;
379
+ } ddog_Slice_i64;
380
+
381
+ typedef struct ddog_Label {
382
+ ddog_CharSlice key;
383
+ /**
384
+ * At most one of the following must be present
385
+ */
386
+ ddog_CharSlice str;
387
+ int64_t num;
388
+ /**
389
+ * Should only be present when num is present.
390
+ * Specifies the units of num.
391
+ * Use arbitrary string (for example, "requests") as a custom count unit.
392
+ * If no unit is specified, consumer may apply heuristic to deduce the unit.
393
+ * Consumers may also interpret units like "bytes" and "kilobytes" as memory
394
+ * units and units like "seconds" and "nanoseconds" as time units,
395
+ * and apply appropriate unit conversions to these.
396
+ */
397
+ ddog_CharSlice num_unit;
398
+ } ddog_Label;
399
+
400
+ /**
401
+ * Remember, the data inside of each member is potentially coming from FFI,
402
+ * so every operation on it is unsafe!
403
+ */
404
+ typedef struct ddog_Slice_label {
405
+ const struct ddog_Label *ptr;
406
+ uintptr_t len;
407
+ } ddog_Slice_label;
408
+
409
+ typedef struct ddog_Sample {
410
+ /**
411
+ * The leaf is at locations[0].
412
+ */
413
+ struct ddog_Slice_location locations;
414
+ /**
415
+ * The type and unit of each value is defined by the corresponding
416
+ * entry in Profile.sample_type. All samples must have the same
417
+ * number of values, the same as the length of Profile.sample_type.
418
+ * When aggregating multiple samples into a single sample, the
419
+ * result has a list of values that is the element-wise sum of the
420
+ * lists of the originals.
421
+ */
422
+ struct ddog_Slice_i64 values;
423
+ /**
424
+ * label includes additional context for this sample. It can include
425
+ * things like a thread id, allocation size, etc
426
+ */
427
+ struct ddog_Slice_label labels;
428
+ } ddog_Sample;
429
+
430
+ typedef struct ddog_EncodedProfile {
431
+ struct ddog_Timespec start;
432
+ struct ddog_Timespec end;
433
+ struct ddog_Vec_u8 buffer;
434
+ } ddog_EncodedProfile;
435
+
436
+ typedef enum ddog_SerializeResult_Tag {
437
+ DDOG_SERIALIZE_RESULT_OK,
438
+ DDOG_SERIALIZE_RESULT_ERR,
439
+ } ddog_SerializeResult_Tag;
440
+
441
+ typedef struct ddog_SerializeResult {
442
+ ddog_SerializeResult_Tag tag;
443
+ union {
444
+ struct {
445
+ struct ddog_EncodedProfile ok;
446
+ };
447
+ struct {
448
+ struct ddog_Vec_u8 err;
449
+ };
450
+ };
451
+ } ddog_SerializeResult;
452
+
453
+ DDOG_CHECK_RETURN struct ddog_Vec_tag ddog_Vec_tag_new(void);
454
+
455
+ void ddog_Vec_tag_drop(struct ddog_Vec_tag);
456
+
457
+ void ddog_PushTagResult_drop(struct ddog_PushTagResult);
458
+
459
+ /**
460
+ * Creates a new Tag from the provided `key` and `value` by doing a utf8
461
+ * lossy conversion, and pushes into the `vec`. The strings `key` and `value`
462
+ * are cloned to avoid FFI lifetime issues.
463
+ *
464
+ * # Safety
465
+ * The `vec` must be a valid reference.
466
+ * The CharSlices `key` and `value` must point to at least many bytes as their
467
+ * `.len` properties claim.
468
+ */
469
+ DDOG_CHECK_RETURN
470
+ struct ddog_PushTagResult ddog_Vec_tag_push(struct ddog_Vec_tag *vec,
471
+ ddog_CharSlice key,
472
+ ddog_CharSlice value);
473
+
474
+ /**
475
+ * # Safety
476
+ * The `string`'s .ptr must point to a valid object at least as large as its
477
+ * .len property.
478
+ */
479
+ DDOG_CHECK_RETURN struct ddog_ParseTagsResult ddog_Vec_tag_parse(ddog_CharSlice string);
480
+
481
+ #endif /* DDOG_COMMON_H */
@@ -0,0 +1,214 @@
1
+ // Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
2
+ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present Datadog, Inc.
3
+
4
+
5
+ #ifndef DDOG_PROFILING_H
6
+ #define DDOG_PROFILING_H
7
+
8
+ #include <stdbool.h>
9
+ #include <stddef.h>
10
+ #include <stdint.h>
11
+ #include "datadog/common.h"
12
+
13
+ void ddog_NewProfileExporterResult_drop(struct ddog_NewProfileExporterResult result);
14
+
15
+ /**
16
+ * Creates an endpoint that uses the agent.
17
+ * # Arguments
18
+ * * `base_url` - Contains a URL with scheme, host, and port e.g. "https://agent:8126/".
19
+ */
20
+ struct ddog_Endpoint ddog_Endpoint_agent(ddog_CharSlice base_url);
21
+
22
+ /**
23
+ * Creates an endpoint that uses the Datadog intake directly aka agentless.
24
+ * # Arguments
25
+ * * `site` - Contains a host and port e.g. "datadoghq.com".
26
+ * * `api_key` - Contains the Datadog API key.
27
+ */
28
+ struct ddog_Endpoint ddog_Endpoint_agentless(ddog_CharSlice site, ddog_CharSlice api_key);
29
+
30
+ DDOG_CHECK_RETURN
31
+ struct ddog_NewProfileExporterResult ddog_ProfileExporter_new(ddog_CharSlice profiling_library_name,
32
+ ddog_CharSlice profiling_library_version,
33
+ ddog_CharSlice family,
34
+ const struct ddog_Vec_tag *tags,
35
+ struct ddog_Endpoint endpoint);
36
+
37
+ void ddog_ProfileExporter_delete(struct ddog_ProfileExporter *exporter);
38
+
39
+ /**
40
+ * Builds a Request object based on the profile data supplied.
41
+ *
42
+ * # Safety
43
+ * The `exporter` and the files inside of the `files` slice need to have been
44
+ * created by this module.
45
+ */
46
+ struct ddog_Request *ddog_ProfileExporter_build(struct ddog_ProfileExporter *exporter,
47
+ struct ddog_Timespec start,
48
+ struct ddog_Timespec end,
49
+ struct ddog_Slice_file files,
50
+ const struct ddog_Vec_tag *additional_tags,
51
+ uint64_t timeout_ms);
52
+
53
+ /**
54
+ * Sends the request, returning the HttpStatus.
55
+ *
56
+ * # Arguments
57
+ * * `exporter` - borrows the exporter for sending the request
58
+ * * `request` - takes ownership of the request
59
+ * * `cancel` - borrows the cancel, if any
60
+ *
61
+ * # Safety
62
+ * All non-null arguments MUST have been created by created by apis in this module.
63
+ */
64
+ DDOG_CHECK_RETURN
65
+ struct ddog_SendResult ddog_ProfileExporter_send(struct ddog_ProfileExporter *exporter,
66
+ struct ddog_Request *request,
67
+ struct ddog_CancellationToken *cancel);
68
+
69
+ void ddog_Request_drop(struct ddog_Request *_request);
70
+
71
+ /**
72
+ * Can be passed as an argument to send and then be used to asynchronously cancel it from a different thread.
73
+ */
74
+ DDOG_CHECK_RETURN
75
+ struct ddog_CancellationToken *ddog_CancellationToken_new(void);
76
+
77
+ /**
78
+ * A cloned CancellationToken is connected to the CancellationToken it was created from.
79
+ * Either the cloned or the original token can be used to cancel or provided as arguments to send.
80
+ * The useful part is that they have independent lifetimes and can be dropped separately.
81
+ *
82
+ * Thus, it's possible to do something like:
83
+ * ```c
84
+ * cancel_t1 = ddog_CancellationToken_new();
85
+ * cancel_t2 = ddog_CancellationToken_clone(cancel_t1);
86
+ *
87
+ * // On thread t1:
88
+ * ddog_ProfileExporter_send(..., cancel_t1);
89
+ * ddog_CancellationToken_drop(cancel_t1);
90
+ *
91
+ * // On thread t2:
92
+ * ddog_CancellationToken_cancel(cancel_t2);
93
+ * ddog_CancellationToken_drop(cancel_t2);
94
+ * ```
95
+ *
96
+ * Without clone, both t1 and t2 would need to synchronize to make sure neither was using the cancel
97
+ * before it could be dropped. With clone, there is no need for such synchronization, both threads
98
+ * have their own cancel and should drop that cancel after they are done with it.
99
+ */
100
+ DDOG_CHECK_RETURN
101
+ struct ddog_CancellationToken *ddog_CancellationToken_clone(struct ddog_CancellationToken *cancel);
102
+
103
+ /**
104
+ * Cancel send that is being called in another thread with the given token.
105
+ * Note that cancellation is a terminal state; cancelling a token more than once does nothing.
106
+ * Returns `true` if token was successfully cancelled.
107
+ */
108
+ bool ddog_CancellationToken_cancel(struct ddog_CancellationToken *cancel);
109
+
110
+ void ddog_CancellationToken_drop(struct ddog_CancellationToken *_cancel);
111
+
112
+ void ddog_SendResult_drop(struct ddog_SendResult result);
113
+
114
+ /**
115
+ * Create a new profile with the given sample types. Must call
116
+ * `ddog_Profile_free` when you are done with the profile.
117
+ *
118
+ * # Arguments
119
+ * * `sample_types`
120
+ * * `period` - Optional period of the profile. Passing None/null translates to zero values.
121
+ * * `start_time` - Optional time the profile started at. Passing None/null will use the current
122
+ * time.
123
+ *
124
+ * # Safety
125
+ * All slices must be have pointers that are suitably aligned for their type
126
+ * and must have the correct number of elements for the slice.
127
+ */
128
+ DDOG_CHECK_RETURN
129
+ struct ddog_Profile *ddog_Profile_new(struct ddog_Slice_value_type sample_types,
130
+ const struct ddog_Period *period,
131
+ const struct ddog_Timespec *start_time);
132
+
133
+ /**
134
+ * # Safety
135
+ * The `profile` must point to an object created by another FFI routine in this
136
+ * module, such as `ddog_Profile_with_sample_types`.
137
+ */
138
+ void ddog_Profile_free(struct ddog_Profile *_profile);
139
+
140
+ /**
141
+ * # Safety
142
+ * The `profile` ptr must point to a valid Profile object created by this
143
+ * module. All pointers inside the `sample` need to be valid for the duration
144
+ * of this call.
145
+ * This call is _NOT_ thread-safe.
146
+ */
147
+ uint64_t ddog_Profile_add(struct ddog_Profile *profile, struct ddog_Sample sample);
148
+
149
+ /**
150
+ * Associate an endpoint to a given local root span id.
151
+ * During the serialization of the profile, an endpoint label will be added
152
+ * to all samples that contain a matching local root span id label.
153
+ *
154
+ * Note: calling this API causes the "trace endpoint" and "local root span id" strings
155
+ * to be interned, even if no matching sample is found.
156
+ *
157
+ * # Arguments
158
+ * * `profile` - a reference to the profile that will contain the samples.
159
+ * * `local_root_span_id` - the value of the local root span id label to look for.
160
+ * * `endpoint` - the value of the endpoint label to add for matching samples.
161
+ *
162
+ * # Safety
163
+ * The `profile` ptr must point to a valid Profile object created by this
164
+ * module.
165
+ * This call is _NOT_ thread-safe.
166
+ */
167
+ void ddog_Profile_set_endpoint(struct ddog_Profile *profile,
168
+ ddog_CharSlice local_root_span_id,
169
+ ddog_CharSlice endpoint);
170
+
171
+ /**
172
+ * Serialize the aggregated profile. Don't forget to clean up the result by
173
+ * calling ddog_SerializeResult_drop.
174
+ *
175
+ * # Arguments
176
+ * * `profile` - a reference to the profile being serialized.
177
+ * * `end_time` - optional end time of the profile. If None/null is passed, the current time will
178
+ * be used.
179
+ * * `duration_nanos` - Optional duration of the profile. Passing None or a negative duration will
180
+ * mean the duration will based on the end time minus the start time, but
181
+ * under anomalous conditions this may fail as system clocks can be adjusted,
182
+ * or the programmer accidentally passed an earlier time. The duration of
183
+ * the serialized profile will be set to zero for these cases.
184
+ *
185
+ * # Safety
186
+ * The `profile` must point to a valid profile object.
187
+ * The `end_time` must be null or otherwise point to a valid TimeSpec object.
188
+ * The `duration_nanos` must be null or otherwise point to a valid i64.
189
+ */
190
+ struct ddog_SerializeResult ddog_Profile_serialize(const struct ddog_Profile *profile,
191
+ const struct ddog_Timespec *end_time,
192
+ const int64_t *duration_nanos);
193
+
194
+ void ddog_SerializeResult_drop(struct ddog_SerializeResult _result);
195
+
196
+ DDOG_CHECK_RETURN struct ddog_Slice_u8 ddog_Vec_u8_as_slice(const struct ddog_Vec_u8 *vec);
197
+
198
+ /**
199
+ * Resets all data in `profile` except the sample types and period. Returns
200
+ * true if it successfully reset the profile and false otherwise. The profile
201
+ * remains valid if false is returned.
202
+ *
203
+ * # Arguments
204
+ * * `profile` - A mutable reference to the profile to be reset.
205
+ * * `start_time` - The time of the profile (after reset). Pass None/null to use the current time.
206
+ *
207
+ * # Safety
208
+ * The `profile` must meet all the requirements of a mutable reference to the profile. Given this
209
+ * can be called across an FFI boundary, the compiler cannot enforce this.
210
+ * If `time` is not null, it must point to a valid Timespec object.
211
+ */
212
+ bool ddog_Profile_reset(struct ddog_Profile *profile, const struct ddog_Timespec *start_time);
213
+
214
+ #endif /* DDOG_PROFILING_H */