libdatadog 2.0.0.1.0 → 7.0.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/lib/libdatadog.rb +40 -16
  4. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE-3rdparty.yml +29615 -0
  5. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  6. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/blazesym.h +895 -0
  7. data/vendor/{libdatadog-2.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/common.h +346 -122
  8. data/vendor/{libdatadog-2.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/profiling.h +159 -49
  9. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +290 -0
  10. data/vendor/libdatadog-7.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  11. data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +3 -5
  12. data/vendor/libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE-3rdparty.yml +29615 -0
  13. data/vendor/libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  14. data/vendor/libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +895 -0
  15. data/vendor/{libdatadog-2.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/common.h +346 -122
  16. data/vendor/{libdatadog-2.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/profiling.h +159 -49
  17. data/vendor/libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/telemetry.h +290 -0
  18. data/vendor/libdatadog-7.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  19. data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +3 -5
  20. data/vendor/libdatadog-7.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +29615 -0
  21. data/vendor/libdatadog-7.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
  22. data/vendor/libdatadog-7.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/blazesym.h +895 -0
  23. data/vendor/{libdatadog-2.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-7.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/common.h +346 -122
  24. data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/profiling.h +159 -49
  25. data/vendor/libdatadog-7.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/telemetry.h +290 -0
  26. data/vendor/libdatadog-7.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  27. data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +3 -5
  28. data/vendor/libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +29615 -0
  29. data/vendor/libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  30. data/vendor/libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/blazesym.h +895 -0
  31. data/vendor/{libdatadog-2.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/common.h +346 -122
  32. data/vendor/{libdatadog-2.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/profiling.h +159 -49
  33. data/vendor/libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/telemetry.h +290 -0
  34. data/vendor/libdatadog-7.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  35. data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +3 -5
  36. metadata +45 -33
  37. data/vendor/libdatadog-2.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE-3rdparty.yml +0 -1183
  38. data/vendor/libdatadog-2.0.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  39. data/vendor/libdatadog-2.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE-3rdparty.yml +0 -1183
  40. data/vendor/libdatadog-2.0.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  41. data/vendor/libdatadog-2.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +0 -1183
  42. data/vendor/libdatadog-2.0.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
  43. data/vendor/libdatadog-2.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE-3rdparty.yml +0 -1183
  44. data/vendor/libdatadog-2.0.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
  45. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
  46. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
  47. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
  48. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
  49. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
  50. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
  51. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
  52. /data/vendor/{libdatadog-2.0.0 → libdatadog-7.0.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
@@ -1,5 +1,6 @@
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.
1
+ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
3
4
 
4
5
  #ifndef DDOG_PROFILING_H
5
6
  #define DDOG_PROFILING_H
@@ -11,12 +12,36 @@
11
12
  #include <stdint.h>
12
13
  #include "common.h"
13
14
 
15
+ #ifdef __cplusplus
16
+ extern "C" {
17
+ #endif // __cplusplus
18
+
19
+ DDOG_CHECK_RETURN
20
+ struct ddog_prof_Profile_Result ddog_prof_Crashtracker_begin_profiling_op(enum ddog_prof_ProfilingOpTypes op);
21
+
22
+ DDOG_CHECK_RETURN
23
+ struct ddog_prof_Profile_Result ddog_prof_Crashtracker_end_profiling_op(enum ddog_prof_ProfilingOpTypes op);
24
+
25
+ DDOG_CHECK_RETURN struct ddog_prof_Profile_Result ddog_prof_Crashtracker_shutdown(void);
26
+
27
+ DDOG_CHECK_RETURN
28
+ struct ddog_prof_Profile_Result ddog_prof_Crashtracker_update_on_fork(struct ddog_prof_CrashtrackerConfiguration config,
29
+ struct ddog_prof_CrashtrackerMetadata metadata);
30
+
31
+ DDOG_CHECK_RETURN struct ddog_prof_Profile_Result ddog_prof_Crashtracker_receiver_entry_point(void);
32
+
33
+ DDOG_CHECK_RETURN
34
+ struct ddog_prof_Profile_Result ddog_prof_Crashtracker_init(struct ddog_prof_CrashtrackerConfiguration config,
35
+ struct ddog_prof_CrashtrackerMetadata metadata);
36
+
37
+ DDOG_CHECK_RETURN struct ddog_prof_Exporter_Slice_File ddog_prof_Exporter_Slice_File_empty(void);
38
+
14
39
  /**
15
40
  * Creates an endpoint that uses the agent.
16
41
  * # Arguments
17
42
  * * `base_url` - Contains a URL with scheme, host, and port e.g. "https://agent:8126/".
18
43
  */
19
- struct ddog_Endpoint ddog_Endpoint_agent(ddog_CharSlice base_url);
44
+ struct ddog_prof_Endpoint ddog_prof_Endpoint_agent(ddog_CharSlice base_url);
20
45
 
21
46
  /**
22
47
  * Creates an endpoint that uses the Datadog intake directly aka agentless.
@@ -24,18 +49,21 @@ struct ddog_Endpoint ddog_Endpoint_agent(ddog_CharSlice base_url);
24
49
  * * `site` - Contains a host and port e.g. "datadoghq.com".
25
50
  * * `api_key` - Contains the Datadog API key.
26
51
  */
27
- struct ddog_Endpoint ddog_Endpoint_agentless(ddog_CharSlice site, ddog_CharSlice api_key);
52
+ struct ddog_prof_Endpoint ddog_prof_Endpoint_agentless(ddog_CharSlice site, ddog_CharSlice api_key);
28
53
 
29
54
  /**
30
55
  * Creates a new exporter to be used to report profiling data.
31
56
  * # Arguments
32
- * * `profiling_library_name` - Profiling library name, usually dd-trace-something, e.g. "dd-trace-rb". See
33
- * https://datadoghq.atlassian.net/wiki/spaces/PROF/pages/1538884229/Client#Header-values (Datadog internal link)
57
+ * * `profiling_library_name` - Profiling library name, usually dd-trace-something, e.g.
58
+ * "dd-trace-rb". See
59
+ * https://datadoghq.atlassian.net/wiki/spaces/PROF/pages/1538884229/Client#Header-values
60
+ * (Datadog internal link)
34
61
  * for a list of common values.
35
- * * `profliling_library_version` - Version used when publishing the profiling library to a package manager
62
+ * * `profliling_library_version` - Version used when publishing the profiling library to a package
63
+ * manager
36
64
  * * `family` - Profile family, e.g. "ruby"
37
- * * `tags` - Tags to include with every profile reported by this exporter. It's also possible to include
38
- * profile-specific tags, see `additional_tags` on `profile_exporter_build`.
65
+ * * `tags` - Tags to include with every profile reported by this exporter. It's also possible to
66
+ * include profile-specific tags, see `additional_tags` on `profile_exporter_build`.
39
67
  * * `endpoint` - Configuration for reporting data
40
68
  * # Safety
41
69
  * All pointers must refer to valid objects of the correct types.
@@ -45,7 +73,7 @@ struct ddog_prof_Exporter_NewResult ddog_prof_Exporter_new(ddog_CharSlice profil
45
73
  ddog_CharSlice profiling_library_version,
46
74
  ddog_CharSlice family,
47
75
  const struct ddog_Vec_Tag *tags,
48
- struct ddog_Endpoint endpoint);
76
+ struct ddog_prof_Endpoint endpoint);
49
77
 
50
78
  /**
51
79
  * # Safety
@@ -59,17 +87,30 @@ void ddog_prof_Exporter_drop(struct ddog_prof_Exporter *exporter);
59
87
  * If successful, builds a `ddog_prof_Exporter_Request` object based on the
60
88
  * profile data supplied. If unsuccessful, it returns an error message.
61
89
  *
90
+ * For details on the `optional_internal_metadata_json`, please reference the Datadog-internal
91
+ * "RFC: Attaching internal metadata to pprof profiles".
92
+ * If you use this parameter, please update the RFC with your use-case, so we can keep track of how
93
+ * this is getting used.
94
+ *
95
+ * For details on the `optional_info_json`, please reference the Datadog-internal
96
+ * "RFC: Pprof System Info Support".
97
+ *
62
98
  * # Safety
63
- * The `exporter`, `additional_stats`, and `endpoint_stats` args should be
64
- * valid objects created by this module, except NULL is allowed.
99
+ * The `exporter`, `optional_additional_stats`, and `optional_endpoint_stats` args should be
100
+ * valid objects created by this module.
101
+ * NULL is allowed for `optional_additional_tags`, `optional_endpoints_stats`,
102
+ * `optional_internal_metadata_json` and `optional_info_json`.
65
103
  */
66
104
  DDOG_CHECK_RETURN
67
105
  struct ddog_prof_Exporter_Request_BuildResult ddog_prof_Exporter_Request_build(struct ddog_prof_Exporter *exporter,
68
106
  struct ddog_Timespec start,
69
107
  struct ddog_Timespec end,
70
- struct ddog_prof_Exporter_Slice_File files,
71
- const struct ddog_Vec_Tag *additional_tags,
72
- const struct ddog_prof_ProfiledEndpointsStats *endpoints_stats,
108
+ struct ddog_prof_Exporter_Slice_File files_to_compress_and_export,
109
+ struct ddog_prof_Exporter_Slice_File files_to_export_unmodified,
110
+ const struct ddog_Vec_Tag *optional_additional_tags,
111
+ const struct ddog_prof_ProfiledEndpointsStats *optional_endpoints_stats,
112
+ const ddog_CharSlice *optional_internal_metadata_json,
113
+ const ddog_CharSlice *optional_info_json,
73
114
  uint64_t timeout_ms);
74
115
 
75
116
  /**
@@ -85,9 +126,8 @@ void ddog_prof_Exporter_Request_drop(struct ddog_prof_Exporter_Request **request
85
126
  *
86
127
  * # Arguments
87
128
  * * `exporter` - Borrows the exporter for sending the request.
88
- * * `request` - Takes ownership of the request, replacing it with a null
89
- * pointer. This is why it takes a double-pointer, rather than
90
- * a single one.
129
+ * * `request` - Takes ownership of the request, replacing it with a null pointer. This is why it
130
+ * takes a double-pointer, rather than a single one.
91
131
  * * `cancel` - Borrows the cancel, if any.
92
132
  *
93
133
  * # Safety
@@ -99,10 +139,10 @@ struct ddog_prof_Exporter_SendResult ddog_prof_Exporter_send(struct ddog_prof_Ex
99
139
  const struct ddog_CancellationToken *cancel);
100
140
 
101
141
  /**
102
- * Can be passed as an argument to send and then be used to asynchronously cancel it from a different thread.
142
+ * Can be passed as an argument to send and then be used to asynchronously cancel it from a
143
+ * different thread.
103
144
  */
104
- DDOG_CHECK_RETURN
105
- struct ddog_CancellationToken *ddog_CancellationToken_new(void);
145
+ DDOG_CHECK_RETURN struct ddog_CancellationToken *ddog_CancellationToken_new(void);
106
146
 
107
147
  /**
108
148
  * A cloned CancellationToken is connected to the CancellationToken it was created from.
@@ -123,9 +163,9 @@ struct ddog_CancellationToken *ddog_CancellationToken_new(void);
123
163
  * ddog_CancellationToken_drop(cancel_t2);
124
164
  * ```
125
165
  *
126
- * Without clone, both t1 and t2 would need to synchronize to make sure neither was using the cancel
127
- * before it could be dropped. With clone, there is no need for such synchronization, both threads
128
- * have their own cancel and should drop that cancel after they are done with it.
166
+ * Without clone, both t1 and t2 would need to synchronize to make sure neither was using the
167
+ * cancel before it could be dropped. With clone, there is no need for such synchronization, both
168
+ * threads have their own cancel and should drop that cancel after they are done with it.
129
169
  *
130
170
  * # Safety
131
171
  * If the `token` is non-null, it must point to a valid object.
@@ -155,21 +195,21 @@ void ddog_CancellationToken_drop(struct ddog_CancellationToken *token);
155
195
  * * `sample_types`
156
196
  * * `period` - Optional period of the profile. Passing None/null translates to zero values.
157
197
  * * `start_time` - Optional time the profile started at. Passing None/null will use the current
158
- * time.
198
+ * time.
159
199
  *
160
200
  * # Safety
161
201
  * All slices must be have pointers that are suitably aligned for their type
162
202
  * and must have the correct number of elements for the slice.
163
203
  */
164
204
  DDOG_CHECK_RETURN
165
- struct ddog_prof_Profile *ddog_prof_Profile_new(struct ddog_prof_Slice_ValueType sample_types,
166
- const struct ddog_prof_Period *period,
167
- const struct ddog_Timespec *start_time);
205
+ struct ddog_prof_Profile_NewResult ddog_prof_Profile_new(struct ddog_prof_Slice_ValueType sample_types,
206
+ const struct ddog_prof_Period *period,
207
+ const struct ddog_Timespec *start_time);
168
208
 
169
209
  /**
170
210
  * # Safety
171
- * The `profile` can be null, but if non-null it must point to a valid object
172
- * created by the Rust Global allocator.
211
+ * The `profile` can be null, but if non-null it must point to a Profile
212
+ * made by this module, which has not previously been dropped.
173
213
  */
174
214
  void ddog_prof_Profile_drop(struct ddog_prof_Profile *profile);
175
215
 
@@ -179,8 +219,8 @@ void ddog_prof_Profile_drop(struct ddog_prof_Profile *profile);
179
219
  * module. All pointers inside the `sample` need to be valid for the duration
180
220
  * of this call.
181
221
  *
182
- * If successful, it returns the internal id of the sample (> 0) in the Ok
183
- * variant. On error, it holds an error message in the error variant.
222
+ * If successful, it returns the Ok variant.
223
+ * On error, it holds an error message in the error variant.
184
224
  *
185
225
  * # Safety
186
226
  * The `profile` ptr must point to a valid Profile object created by this
@@ -188,8 +228,9 @@ void ddog_prof_Profile_drop(struct ddog_prof_Profile *profile);
188
228
  * This call is _NOT_ thread-safe.
189
229
  */
190
230
  DDOG_CHECK_RETURN
191
- struct ddog_prof_Profile_AddResult ddog_prof_Profile_add(struct ddog_prof_Profile *profile,
192
- struct ddog_prof_Sample sample);
231
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add(struct ddog_prof_Profile *profile,
232
+ struct ddog_prof_Sample sample,
233
+ int64_t timestamp);
193
234
 
194
235
  /**
195
236
  * Associate an endpoint to a given local root span id.
@@ -209,9 +250,10 @@ struct ddog_prof_Profile_AddResult ddog_prof_Profile_add(struct ddog_prof_Profil
209
250
  * module.
210
251
  * This call is _NOT_ thread-safe.
211
252
  */
212
- void ddog_prof_Profile_set_endpoint(struct ddog_prof_Profile *profile,
213
- uint64_t local_root_span_id,
214
- ddog_CharSlice endpoint);
253
+ DDOG_CHECK_RETURN
254
+ struct ddog_prof_Profile_Result ddog_prof_Profile_set_endpoint(struct ddog_prof_Profile *profile,
255
+ uint64_t local_root_span_id,
256
+ ddog_CharSlice endpoint);
215
257
 
216
258
  /**
217
259
  * Count the number of times an endpoint has been seen.
@@ -225,9 +267,69 @@ void ddog_prof_Profile_set_endpoint(struct ddog_prof_Profile *profile,
225
267
  * module.
226
268
  * This call is _NOT_ thread-safe.
227
269
  */
228
- void ddog_prof_Profile_add_endpoint_count(struct ddog_prof_Profile *profile,
229
- ddog_CharSlice endpoint,
230
- int64_t value);
270
+ DDOG_CHECK_RETURN
271
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add_endpoint_count(struct ddog_prof_Profile *profile,
272
+ ddog_CharSlice endpoint,
273
+ int64_t value);
274
+
275
+ /**
276
+ * Add a poisson-based upscaling rule which will be use to adjust values and make them
277
+ * closer to reality.
278
+ *
279
+ * # Arguments
280
+ * * `profile` - a reference to the profile that will contain the samples.
281
+ * * `offset_values` - offset of the values
282
+ * * `label_name` - name of the label used to identify sample(s)
283
+ * * `label_value` - value of the label used to identify sample(s)
284
+ * * `sum_value_offset` - offset of the value used as a sum (compute the average with
285
+ * `count_value_offset`)
286
+ * * `count_value_offset` - offset of the value used as a count (compute the average with
287
+ * `sum_value_offset`)
288
+ * * `sampling_distance` - this is the threshold for this sampling window. This value must not be
289
+ * equal to 0
290
+ *
291
+ * # Safety
292
+ * This function must be called before serialize and must not be called after.
293
+ * The `profile` ptr must point to a valid Profile object created by this
294
+ * module.
295
+ * This call is _NOT_ thread-safe.
296
+ */
297
+ DDOG_CHECK_RETURN
298
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add_upscaling_rule_poisson(struct ddog_prof_Profile *profile,
299
+ struct ddog_prof_Slice_Usize offset_values,
300
+ ddog_CharSlice label_name,
301
+ ddog_CharSlice label_value,
302
+ uintptr_t sum_value_offset,
303
+ uintptr_t count_value_offset,
304
+ uint64_t sampling_distance);
305
+
306
+ /**
307
+ * Add a proportional-based upscaling rule which will be use to adjust values and make them
308
+ * closer to reality.
309
+ *
310
+ * # Arguments
311
+ * * `profile` - a reference to the profile that will contain the samples.
312
+ * * `offset_values` - offset of the values
313
+ * * `label_name` - name of the label used to identify sample(s)
314
+ * * `label_value` - value of the label used to identify sample(s)
315
+ * * `total_sampled` - number of sampled event (found in the pprof). This value must not be equal
316
+ * to 0
317
+ * * `total_real` - number of events the profiler actually witnessed. This value must not be equal
318
+ * to 0
319
+ *
320
+ * # Safety
321
+ * This function must be called before serialize and must not be called after.
322
+ * The `profile` ptr must point to a valid Profile object created by this
323
+ * module.
324
+ * This call is _NOT_ thread-safe.
325
+ */
326
+ DDOG_CHECK_RETURN
327
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add_upscaling_rule_proportional(struct ddog_prof_Profile *profile,
328
+ struct ddog_prof_Slice_Usize offset_values,
329
+ ddog_CharSlice label_name,
330
+ ddog_CharSlice label_value,
331
+ uint64_t total_sampled,
332
+ uint64_t total_real);
231
333
 
232
334
  /**
233
335
  * # Safety
@@ -239,6 +341,7 @@ void ddog_prof_EncodedProfile_drop(struct ddog_prof_EncodedProfile *profile);
239
341
 
240
342
  /**
241
343
  * Serialize the aggregated profile.
344
+ * Drains the data, and then resets the profile for future use.
242
345
  *
243
346
  * Don't forget to clean up the ok with `ddog_prof_EncodedProfile_drop` or
244
347
  * the error variant with `ddog_Error_drop` when you are done with them.
@@ -246,12 +349,13 @@ void ddog_prof_EncodedProfile_drop(struct ddog_prof_EncodedProfile *profile);
246
349
  * # Arguments
247
350
  * * `profile` - a reference to the profile being serialized.
248
351
  * * `end_time` - optional end time of the profile. If None/null is passed, the current time will
249
- * be used.
352
+ * be used.
250
353
  * * `duration_nanos` - Optional duration of the profile. Passing None or a negative duration will
251
- * mean the duration will based on the end time minus the start time, but
252
- * under anomalous conditions this may fail as system clocks can be adjusted,
253
- * or the programmer accidentally passed an earlier time. The duration of
254
- * the serialized profile will be set to zero for these cases.
354
+ * mean the duration will based on the end time minus the start time, but under anomalous
355
+ * conditions this may fail as system clocks can be adjusted, or the programmer accidentally
356
+ * passed an earlier time. The duration of the serialized profile will be set to zero for these
357
+ * cases.
358
+ * * `start_time` - Optional start time for the next profile.
255
359
  *
256
360
  * # Safety
257
361
  * The `profile` must point to a valid profile object.
@@ -259,9 +363,10 @@ void ddog_prof_EncodedProfile_drop(struct ddog_prof_EncodedProfile *profile);
259
363
  * The `duration_nanos` must be null or otherwise point to a valid i64.
260
364
  */
261
365
  DDOG_CHECK_RETURN
262
- struct ddog_prof_Profile_SerializeResult ddog_prof_Profile_serialize(const struct ddog_prof_Profile *profile,
366
+ struct ddog_prof_Profile_SerializeResult ddog_prof_Profile_serialize(struct ddog_prof_Profile *profile,
263
367
  const struct ddog_Timespec *end_time,
264
- const int64_t *duration_nanos);
368
+ const int64_t *duration_nanos,
369
+ const struct ddog_Timespec *start_time);
265
370
 
266
371
  DDOG_CHECK_RETURN struct ddog_Slice_U8 ddog_Vec_U8_as_slice(const struct ddog_Vec_U8 *vec);
267
372
 
@@ -279,7 +384,12 @@ DDOG_CHECK_RETURN struct ddog_Slice_U8 ddog_Vec_U8_as_slice(const struct ddog_Ve
279
384
  * can be called across an FFI boundary, the compiler cannot enforce this.
280
385
  * If `time` is not null, it must point to a valid Timespec object.
281
386
  */
282
- bool ddog_prof_Profile_reset(struct ddog_prof_Profile *profile,
283
- const struct ddog_Timespec *start_time);
387
+ DDOG_CHECK_RETURN
388
+ struct ddog_prof_Profile_Result ddog_prof_Profile_reset(struct ddog_prof_Profile *profile,
389
+ const struct ddog_Timespec *start_time);
390
+
391
+ #ifdef __cplusplus
392
+ } // extern "C"
393
+ #endif // __cplusplus
284
394
 
285
395
  #endif /* DDOG_PROFILING_H */
@@ -0,0 +1,290 @@
1
+ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_TELEMETRY_H
6
+ #define DDOG_TELEMETRY_H
7
+
8
+ #include <stdbool.h>
9
+ #include <stddef.h>
10
+ #include <stdint.h>
11
+ #include <stdio.h>
12
+ #include "common.h"
13
+
14
+ void ddog_MaybeError_drop(ddog_MaybeError);
15
+
16
+ /**
17
+ * # Safety
18
+ * * builder should be a non null pointer to a null pointer to a builder
19
+ */
20
+ ddog_MaybeError ddog_builder_instantiate(struct ddog_TelemetryWorkerBuilder **out_builder,
21
+ ddog_CharSlice service_name,
22
+ ddog_CharSlice language_name,
23
+ ddog_CharSlice language_version,
24
+ ddog_CharSlice tracer_version);
25
+
26
+ /**
27
+ * # Safety
28
+ * * builder should be a non null pointer to a null pointer to a builder
29
+ */
30
+ ddog_MaybeError ddog_builder_instantiate_with_hostname(struct ddog_TelemetryWorkerBuilder **out_builder,
31
+ ddog_CharSlice hostname,
32
+ ddog_CharSlice service_name,
33
+ ddog_CharSlice language_name,
34
+ ddog_CharSlice language_version,
35
+ ddog_CharSlice tracer_version);
36
+
37
+ ddog_MaybeError ddog_builder_with_native_deps(struct ddog_TelemetryWorkerBuilder *builder,
38
+ bool include_native_deps);
39
+
40
+ ddog_MaybeError ddog_builder_with_rust_shared_lib_deps(struct ddog_TelemetryWorkerBuilder *builder,
41
+ bool include_rust_shared_lib_deps);
42
+
43
+ ddog_MaybeError ddog_builder_with_config(struct ddog_TelemetryWorkerBuilder *builder,
44
+ ddog_CharSlice name,
45
+ ddog_CharSlice value,
46
+ enum ddog_ConfigurationOrigin origin);
47
+
48
+ /**
49
+ * Builds the telemetry worker and return a handle to it
50
+ *
51
+ * # Safety
52
+ * * handle should be a non null pointer to a null pointer
53
+ */
54
+ ddog_MaybeError ddog_builder_run(struct ddog_TelemetryWorkerBuilder *builder,
55
+ struct ddog_TelemetryWorkerHandle **out_handle);
56
+
57
+ /**
58
+ * Builds the telemetry worker and return a handle to it. The worker will only process and send
59
+ * telemetry metrics and telemetry logs. Any lifecyle/dependency/configuration event will be
60
+ * ignored
61
+ *
62
+ * # Safety
63
+ * * handle should be a non null pointer to a null pointer
64
+ */
65
+ ddog_MaybeError ddog_builder_run_metric_logs(struct ddog_TelemetryWorkerBuilder *builder,
66
+ struct ddog_TelemetryWorkerHandle **out_handle);
67
+
68
+ ddog_MaybeError ddog_builder_with_str_application_service_version(struct ddog_TelemetryWorkerBuilder *builder,
69
+ ddog_CharSlice param);
70
+
71
+ ddog_MaybeError ddog_builder_with_str_application_env(struct ddog_TelemetryWorkerBuilder *builder,
72
+ ddog_CharSlice param);
73
+
74
+ ddog_MaybeError ddog_builder_with_str_application_runtime_name(struct ddog_TelemetryWorkerBuilder *builder,
75
+ ddog_CharSlice param);
76
+
77
+ ddog_MaybeError ddog_builder_with_str_application_runtime_version(struct ddog_TelemetryWorkerBuilder *builder,
78
+ ddog_CharSlice param);
79
+
80
+ ddog_MaybeError ddog_builder_with_str_application_runtime_patches(struct ddog_TelemetryWorkerBuilder *builder,
81
+ ddog_CharSlice param);
82
+
83
+ ddog_MaybeError ddog_builder_with_str_host_container_id(struct ddog_TelemetryWorkerBuilder *builder,
84
+ ddog_CharSlice param);
85
+
86
+ ddog_MaybeError ddog_builder_with_str_host_os(struct ddog_TelemetryWorkerBuilder *builder,
87
+ ddog_CharSlice param);
88
+
89
+ ddog_MaybeError ddog_builder_with_str_host_kernel_name(struct ddog_TelemetryWorkerBuilder *builder,
90
+ ddog_CharSlice param);
91
+
92
+ ddog_MaybeError ddog_builder_with_str_host_kernel_release(struct ddog_TelemetryWorkerBuilder *builder,
93
+ ddog_CharSlice param);
94
+
95
+ ddog_MaybeError ddog_builder_with_str_host_kernel_version(struct ddog_TelemetryWorkerBuilder *builder,
96
+ ddog_CharSlice param);
97
+
98
+ ddog_MaybeError ddog_builder_with_str_runtime_id(struct ddog_TelemetryWorkerBuilder *builder,
99
+ ddog_CharSlice param);
100
+
101
+ /**
102
+ * Sets a property from it's string value.
103
+ *
104
+ * Available properties:
105
+ *
106
+ * * application.service_version
107
+ *
108
+ * * application.env
109
+ *
110
+ * * application.runtime_name
111
+ *
112
+ * * application.runtime_version
113
+ *
114
+ * * application.runtime_patches
115
+ *
116
+ * * host.container_id
117
+ *
118
+ * * host.os
119
+ *
120
+ * * host.kernel_name
121
+ *
122
+ * * host.kernel_release
123
+ *
124
+ * * host.kernel_version
125
+ *
126
+ * * runtime_id
127
+ *
128
+ *
129
+ */
130
+ ddog_MaybeError ddog_builder_with_property_str(struct ddog_TelemetryWorkerBuilder *builder,
131
+ enum ddog_TelemetryWorkerBuilderStrProperty property,
132
+ ddog_CharSlice param);
133
+
134
+ /**
135
+ * Sets a property from it's string value.
136
+ *
137
+ * Available properties:
138
+ *
139
+ * * application.service_version
140
+ *
141
+ * * application.env
142
+ *
143
+ * * application.runtime_name
144
+ *
145
+ * * application.runtime_version
146
+ *
147
+ * * application.runtime_patches
148
+ *
149
+ * * host.container_id
150
+ *
151
+ * * host.os
152
+ *
153
+ * * host.kernel_name
154
+ *
155
+ * * host.kernel_release
156
+ *
157
+ * * host.kernel_version
158
+ *
159
+ * * runtime_id
160
+ *
161
+ *
162
+ */
163
+ ddog_MaybeError ddog_builder_with_str_named_property(struct ddog_TelemetryWorkerBuilder *builder,
164
+ ddog_CharSlice property,
165
+ ddog_CharSlice param);
166
+
167
+ ddog_MaybeError ddog_builder_with_bool_config_telemetry_debug_logging_enabled(struct ddog_TelemetryWorkerBuilder *builder,
168
+ bool param);
169
+
170
+ /**
171
+ * Sets a property from it's string value.
172
+ *
173
+ * Available properties:
174
+ *
175
+ * * config.telemetry_debug_logging_enabled
176
+ *
177
+ *
178
+ */
179
+ ddog_MaybeError ddog_builder_with_property_bool(struct ddog_TelemetryWorkerBuilder *builder,
180
+ enum ddog_TelemetryWorkerBuilderBoolProperty property,
181
+ bool param);
182
+
183
+ /**
184
+ * Sets a property from it's string value.
185
+ *
186
+ * Available properties:
187
+ *
188
+ * * config.telemetry_debug_logging_enabled
189
+ *
190
+ *
191
+ */
192
+ ddog_MaybeError ddog_builder_with_bool_named_property(struct ddog_TelemetryWorkerBuilder *builder,
193
+ ddog_CharSlice property,
194
+ bool param);
195
+
196
+ ddog_MaybeError ddog_builder_with_endpoint_config_endpoint(struct ddog_TelemetryWorkerBuilder *builder,
197
+ const struct ddog_Endpoint *param);
198
+
199
+ /**
200
+ * Sets a property from it's string value.
201
+ *
202
+ * Available properties:
203
+ *
204
+ * * config.endpoint
205
+ *
206
+ *
207
+ */
208
+ ddog_MaybeError ddog_builder_with_property_endpoint(struct ddog_TelemetryWorkerBuilder *builder,
209
+ enum ddog_TelemetryWorkerBuilderEndpointProperty property,
210
+ const struct ddog_Endpoint *param);
211
+
212
+ /**
213
+ * Sets a property from it's string value.
214
+ *
215
+ * Available properties:
216
+ *
217
+ * * config.endpoint
218
+ *
219
+ *
220
+ */
221
+ ddog_MaybeError ddog_builder_with_endpoint_named_property(struct ddog_TelemetryWorkerBuilder *builder,
222
+ ddog_CharSlice property,
223
+ const struct ddog_Endpoint *param);
224
+
225
+ ddog_MaybeError ddog_handle_add_dependency(const struct ddog_TelemetryWorkerHandle *handle,
226
+ ddog_CharSlice dependency_name,
227
+ ddog_CharSlice dependency_version);
228
+
229
+ ddog_MaybeError ddog_handle_add_integration(const struct ddog_TelemetryWorkerHandle *handle,
230
+ ddog_CharSlice dependency_name,
231
+ ddog_CharSlice dependency_version,
232
+ bool enabled,
233
+ struct ddog_Option_Bool compatible,
234
+ struct ddog_Option_Bool auto_enabled);
235
+
236
+ /**
237
+ * * indentifier: identifies a logging location uniquely. This can for instance be the template
238
+ * using for the log message or the concatenated file + line of the origin of the log
239
+ * * stack_trace: stack trace associated with the log. If no stack trace is available, an empty
240
+ * string should be passed
241
+ */
242
+ ddog_MaybeError ddog_handle_add_log(const struct ddog_TelemetryWorkerHandle *handle,
243
+ ddog_CharSlice indentifier,
244
+ ddog_CharSlice message,
245
+ enum ddog_LogLevel level,
246
+ ddog_CharSlice stack_trace);
247
+
248
+ ddog_MaybeError ddog_handle_start(const struct ddog_TelemetryWorkerHandle *handle);
249
+
250
+ struct ddog_TelemetryWorkerHandle *ddog_handle_clone(const struct ddog_TelemetryWorkerHandle *handle);
251
+
252
+ ddog_MaybeError ddog_handle_stop(const struct ddog_TelemetryWorkerHandle *handle);
253
+
254
+ /**
255
+ * * compatible: should be false if the metric is language specific, true otherwise
256
+ */
257
+ struct ddog_ContextKey ddog_handle_register_metric_context(const struct ddog_TelemetryWorkerHandle *handle,
258
+ ddog_CharSlice name,
259
+ enum ddog_MetricType metric_type,
260
+ struct ddog_Vec_Tag tags,
261
+ bool common,
262
+ enum ddog_MetricNamespace namespace_);
263
+
264
+ ddog_MaybeError ddog_handle_add_point(const struct ddog_TelemetryWorkerHandle *handle,
265
+ const struct ddog_ContextKey *context_key,
266
+ double value);
267
+
268
+ ddog_MaybeError ddog_handle_add_point_with_tags(const struct ddog_TelemetryWorkerHandle *handle,
269
+ const struct ddog_ContextKey *context_key,
270
+ double value,
271
+ struct ddog_Vec_Tag extra_tags);
272
+
273
+ /**
274
+ * This function takes ownership of the handle. It should not be used after calling it
275
+ */
276
+ void ddog_handle_wait_for_shutdown(struct ddog_TelemetryWorkerHandle *handle);
277
+
278
+ /**
279
+ * This function takes ownership of the handle. It should not be used after calling it
280
+ */
281
+ void ddog_handle_wait_for_shutdown_ms(struct ddog_TelemetryWorkerHandle *handle,
282
+ uint64_t wait_for_ms);
283
+
284
+ /**
285
+ * Drops the handle without waiting for shutdown. The worker will continue running in the
286
+ * background until it exits by itself
287
+ */
288
+ void ddog_handle_drop(struct ddog_TelemetryWorkerHandle *handle);
289
+
290
+ #endif /* DDOG_TELEMETRY_H */
@@ -1,7 +1,5 @@
1
- # Unless explicitly stated otherwise all files in this repository are licensed
2
- # under the Apache License Version 2.0. This product includes software
3
- # developed at Datadog (https://www.datadoghq.com/). Copyright 2021-Present
4
- # Datadog, Inc.
1
+ # Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
2
+ # SPDX-License-Identifier: Apache-2.0
5
3
 
6
4
  prefix=${pcfiledir}/../..
7
5
  exec_prefix=${prefix}
@@ -10,7 +8,7 @@ includedir=${prefix}/include
10
8
 
11
9
  Name: datadog_profiling
12
10
  Description: Contains common code used to implement Datadog's Continuous Profilers. (Dynamic linking variant, sets rpath)
13
- Version: 2.0.0
11
+ Version:
14
12
  Requires:
15
13
  Libs: -L${libdir} -ldatadog_profiling -Wl,-rpath,${libdir}
16
14
  Libs.private: