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,941 @@
1
+ // Copyright 2021-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_PROFILING_H
6
+ #define DDOG_PROFILING_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+ // Forward declarations for types used in common.h to avoid circular dependencies
14
+ #include "common.h"
15
+ struct TokioCancellationToken;
16
+
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif // __cplusplus
21
+
22
+ extern const ddog_prof_StringId ddog_INTERNED_EMPTY_STRING;
23
+
24
+ /**
25
+ * A StringId that represents the empty string.
26
+ * This is always available in every string set and can be used without
27
+ * needing to insert it into a string set.
28
+ */
29
+ extern const ddog_prof_StringId2 DDOG_PROF_STRINGID2_EMPTY;
30
+
31
+ /**
32
+ * A StringId that represents the string "end_timestamp_ns".
33
+ * This is always available in every string set and can be used without
34
+ * needing to insert it into a string set.
35
+ */
36
+ extern const ddog_prof_StringId2 DDOG_PROF_STRINGID2_END_TIMESTAMP_NS;
37
+
38
+ /**
39
+ * A StringId that represents the string "local root span id".
40
+ * This is always available in every string set and can be used without
41
+ * needing to insert it into a string set.
42
+ */
43
+ extern const ddog_prof_StringId2 DDOG_PROF_STRINGID2_LOCAL_ROOT_SPAN_ID;
44
+
45
+ /**
46
+ * A StringId that represents the string "trace endpoint".
47
+ * This is always available in every string set and can be used without
48
+ * needing to insert it into a string set.
49
+ */
50
+ extern const ddog_prof_StringId2 DDOG_PROF_STRINGID2_TRACE_ENDPOINT;
51
+
52
+ /**
53
+ * A StringId that represents the string "span id".
54
+ * This is always available in every string set and can be used without
55
+ * needing to insert it into a string set.
56
+ */
57
+ extern const ddog_prof_StringId2 DDOG_PROF_STRINGID2_SPAN_ID;
58
+
59
+ DDOG_CHECK_RETURN struct ddog_prof_Exporter_Slice_File ddog_prof_Exporter_Slice_File_empty(void);
60
+
61
+ /**
62
+ * Creates an endpoint that uses the agent.
63
+ * # Arguments
64
+ * * `base_url` - Contains a URL with scheme, host, and port e.g. "https://agent:8126/".
65
+ * * `timeout_ms` - Timeout in milliseconds. Use 0 for default timeout (3000ms).
66
+ */
67
+ struct ddog_prof_Endpoint ddog_prof_Endpoint_agent(ddog_CharSlice base_url, uint64_t timeout_ms);
68
+
69
+ /**
70
+ * Creates an endpoint that uses the Datadog intake directly aka agentless.
71
+ * # Arguments
72
+ * * `site` - Contains a host and port e.g. "datadoghq.com".
73
+ * * `api_key` - Contains the Datadog API key.
74
+ * * `timeout_ms` - Timeout in milliseconds. Use 0 for default timeout (3000ms).
75
+ */
76
+ struct ddog_prof_Endpoint ddog_prof_Endpoint_agentless(ddog_CharSlice site,
77
+ ddog_CharSlice api_key,
78
+ uint64_t timeout_ms);
79
+
80
+ /**
81
+ * Creates an endpoint that writes to a file.
82
+ * Useful for local debugging.
83
+ * Currently only supported by the crashtracker.
84
+ * # Arguments
85
+ * * `filename` - Path to the output file "/tmp/file.txt".
86
+ */
87
+ struct ddog_prof_Endpoint ddog_Endpoint_file(ddog_CharSlice filename);
88
+
89
+ /**
90
+ * Creates a new exporter to be used to report profiling data.
91
+ * # Arguments
92
+ * * `profiling_library_name` - Profiling library name, usually dd-trace-something, e.g.
93
+ * "dd-trace-rb". See
94
+ * https://datadoghq.atlassian.net/wiki/spaces/PROF/pages/1538884229/Client#Header-values
95
+ * (Datadog internal link)
96
+ * for a list of common values.
97
+ * * `profliling_library_version` - Version used when publishing the profiling library to a package
98
+ * manager
99
+ * * `family` - Profile family, e.g. "ruby"
100
+ * * `tags` - Tags to include with every profile reported by this exporter. It's also possible to
101
+ * include profile-specific tags, see `additional_tags` on `profile_exporter_build`.
102
+ * * `endpoint` - Configuration for reporting data
103
+ * # Safety
104
+ * All pointers must refer to valid objects of the correct types.
105
+ */
106
+ DDOG_CHECK_RETURN
107
+ struct ddog_prof_ProfileExporter_Result ddog_prof_Exporter_new(ddog_CharSlice profiling_library_name,
108
+ ddog_CharSlice profiling_library_version,
109
+ ddog_CharSlice family,
110
+ const struct ddog_Vec_Tag *tags,
111
+ struct ddog_prof_Endpoint endpoint);
112
+
113
+ /**
114
+ * # Safety
115
+ * The `exporter` may be null, but if non-null the pointer must point to a
116
+ * valid `ddog_prof_Exporter_Request` object made by the Rust Global
117
+ * allocator that has not already been dropped.
118
+ */
119
+ void ddog_prof_Exporter_drop(struct ddog_prof_ProfileExporter *exporter);
120
+
121
+ /**
122
+ * Builds a request and sends it, returning the HttpStatus.
123
+ * This is a more efficient version of calling `ddog_prof_Exporter_Request_build`
124
+ * followed by `ddog_prof_Exporter_send`, as it avoids exposing the intermediate
125
+ * `Request` object.
126
+ *
127
+ * # Arguments
128
+ * * `exporter` - Borrows the exporter.
129
+ * * `profile` - Takes ownership of the profile.
130
+ * * `files_to_compress_and_export` - Files to compress and attach to the profile.
131
+ * * `optional_additional_tags` - Additional tags to include with this profile.
132
+ * * `optional_process_tags` - Process-level tags as a comma-separated string.
133
+ * * `optional_internal_metadata_json` - Internal metadata as a JSON string.
134
+ * * `optional_info_json` - System info as a JSON string.
135
+ * * `cancel` - Optional cancellation token.
136
+ *
137
+ * # Safety
138
+ * All non-null arguments MUST have been created by APIs in this module.
139
+ */
140
+ DDOG_CHECK_RETURN
141
+ struct ddog_prof_Result_HttpStatus ddog_prof_Exporter_send_blocking(struct ddog_prof_ProfileExporter *exporter,
142
+ struct ddog_prof_EncodedProfile *profile,
143
+ struct ddog_prof_Exporter_Slice_File files_to_compress_and_export,
144
+ const struct ddog_Vec_Tag *optional_additional_tags,
145
+ const ddog_CharSlice *optional_process_tags,
146
+ const ddog_CharSlice *optional_internal_metadata_json,
147
+ const ddog_CharSlice *optional_info_json,
148
+ struct ddog_CancellationToken *cancel);
149
+
150
+ /**
151
+ * Can be passed as an argument to send and then be used to asynchronously cancel it from a
152
+ * different thread.
153
+ */
154
+ DDOG_CHECK_RETURN struct ddog_CancellationToken ddog_CancellationToken_new(void);
155
+
156
+ /**
157
+ * A cloned TokioCancellationToken is connected to the TokioCancellationToken it was created from.
158
+ * Either the cloned or the original token can be used to cancel or provided as arguments to send.
159
+ * The useful part is that they have independent lifetimes and can be dropped separately.
160
+ *
161
+ * Thus, it's possible to do something like:
162
+ * ```c
163
+ * cancel_t1 = ddog_CancellationToken_new();
164
+ * cancel_t2 = ddog_CancellationToken_clone(cancel_t1);
165
+ *
166
+ * // On thread t1:
167
+ * ddog_prof_Exporter_send(..., cancel_t1);
168
+ * ddog_CancellationToken_drop(cancel_t1);
169
+ *
170
+ * // On thread t2:
171
+ * ddog_CancellationToken_cancel(cancel_t2);
172
+ * ddog_CancellationToken_drop(cancel_t2);
173
+ * ```
174
+ *
175
+ * Without clone, both t1 and t2 would need to synchronize to make sure neither was using the
176
+ * cancel before it could be dropped. With clone, there is no need for such synchronization, both
177
+ * threads have their own cancel and should drop that cancel after they are done with it.
178
+ *
179
+ * # Safety
180
+ * If the `token` is non-null, it must point to a valid object.
181
+ */
182
+ DDOG_CHECK_RETURN
183
+ struct ddog_CancellationToken ddog_CancellationToken_clone(struct ddog_CancellationToken *token);
184
+
185
+ /**
186
+ * Cancel send that is being called in another thread with the given token.
187
+ * Note that cancellation is a terminal state; cancelling a token more than once does nothing.
188
+ * Returns `true` if token was successfully cancelled.
189
+ */
190
+ bool ddog_CancellationToken_cancel(struct ddog_CancellationToken *cancel);
191
+
192
+ /**
193
+ * # Safety
194
+ * The `token` can be null, but non-null values must be created by the Rust
195
+ * Global allocator and must have not been dropped already.
196
+ */
197
+ void ddog_CancellationToken_drop(struct ddog_CancellationToken *token);
198
+
199
+ /**
200
+ * Frees any error associated with the status, and replaces it with an OK.
201
+ *
202
+ * # Safety
203
+ *
204
+ * The pointer should point at a valid Status object, if it's not null.
205
+ */
206
+ void ddog_prof_Status_drop(struct ddog_prof_Status *status);
207
+
208
+ /**
209
+ * Create a new profile with the given sample types. Must call
210
+ * `ddog_prof_Profile_drop` when you are done with the profile.
211
+ *
212
+ * # Arguments
213
+ * * `sample_types`
214
+ * * `period` - Optional period of the profile. Passing None/null translates to zero values.
215
+ * * `start_time` - Optional time the profile started at. Passing None/null will use the current
216
+ * time.
217
+ *
218
+ * # Safety
219
+ * All slices must be have pointers that are suitably aligned for their type
220
+ * and must have the correct number of elements for the slice.
221
+ */
222
+ DDOG_CHECK_RETURN
223
+ struct ddog_prof_Profile_NewResult ddog_prof_Profile_new(struct ddog_prof_Slice_ValueType sample_types,
224
+ const struct ddog_prof_Period *period);
225
+
226
+ /**
227
+ * Create a new profile with the given sample types. Must call
228
+ * `ddog_prof_Profile_drop` when you are done with the profile.
229
+ *
230
+ * # Arguments
231
+ * * `out` - a non-null pointer to an uninitialized Profile.
232
+ * * `dict`: a valid reference to a ProfilesDictionary handle.
233
+ * * `sample_types`
234
+ * * `period` - Optional period of the profile. Passing None/null translates to zero values.
235
+ *
236
+ * # Safety
237
+ * All slices must have pointers that are suitably aligned for their type
238
+ * and must have the correct number of elements for the slice.
239
+ *
240
+ * The `dict` reference must be to a valid ProfilesDictionary handle. It may
241
+ * be an empty handle, but it must be a valid handle.
242
+ *
243
+ * The `out` pointer must be non-null and suitable for pointer writes,
244
+ * including that it has the correct size and alignment.
245
+ */
246
+ DDOG_CHECK_RETURN
247
+ struct ddog_prof_Status ddog_prof_Profile_with_dictionary(struct ddog_prof_Profile *out,
248
+ const ddog_prof_ProfilesDictionaryHandle *dict,
249
+ struct ddog_prof_Slice_ValueType sample_types,
250
+ const struct ddog_prof_Period *period);
251
+
252
+ /**
253
+ * Same as `ddog_profile_new` but also configures a `string_storage` for the profile.
254
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
255
+ */
256
+ DDOG_CHECK_RETURN
257
+ struct ddog_prof_Profile_NewResult ddog_prof_Profile_with_string_storage(struct ddog_prof_Slice_ValueType sample_types,
258
+ const struct ddog_prof_Period *period,
259
+ struct ddog_prof_ManagedStringStorage string_storage);
260
+
261
+ /**
262
+ * # Safety
263
+ * The `profile` can be null, but if non-null it must point to a Profile
264
+ * made by this module, which has not previously been dropped.
265
+ */
266
+ void ddog_prof_Profile_drop(struct ddog_prof_Profile *profile);
267
+
268
+ /**
269
+ * # Safety
270
+ * The `profile` ptr must point to a valid Profile object created by this
271
+ * module. All pointers inside the `sample` need to be valid for the duration
272
+ * of this call.
273
+ *
274
+ * If successful, it returns the Ok variant.
275
+ * On error, it holds an error message in the error variant.
276
+ *
277
+ * # Safety
278
+ * The `profile` ptr must point to a valid Profile object created by this
279
+ * module.
280
+ * This call is _NOT_ thread-safe.
281
+ */
282
+ DDOG_CHECK_RETURN
283
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add(struct ddog_prof_Profile *profile,
284
+ struct ddog_prof_Sample sample,
285
+ int64_t timestamp);
286
+
287
+ /**
288
+ * # Safety
289
+ * The `profile` ptr must point to a valid Profile object created by this
290
+ * module. All pointers inside the `sample` need to be valid for the duration
291
+ * of this call.
292
+ *
293
+ * If successful, it returns the Ok variant.
294
+ * On error, it holds an error message in the error variant.
295
+ *
296
+ * This call is _NOT_ thread-safe.
297
+ */
298
+ DDOG_CHECK_RETURN
299
+ struct ddog_prof_Status ddog_prof_Profile_add2(struct ddog_prof_Profile *profile,
300
+ struct ddog_prof_Sample2 sample,
301
+ int64_t timestamp);
302
+
303
+ /**
304
+ * Associate an endpoint to a given local root span id.
305
+ * During the serialization of the profile, an endpoint label will be added
306
+ * to all samples that contain a matching local root span id label.
307
+ *
308
+ * Note: calling this API causes the "trace endpoint" and "local root span id" strings
309
+ * to be interned, even if no matching sample is found.
310
+ *
311
+ * # Arguments
312
+ * * `profile` - a reference to the profile that will contain the samples.
313
+ * * `local_root_span_id`
314
+ * * `endpoint` - the value of the endpoint label to add for matching samples.
315
+ *
316
+ * # Safety
317
+ * The `profile` ptr must point to a valid Profile object created by this
318
+ * module.
319
+ * This call is _NOT_ thread-safe.
320
+ */
321
+ DDOG_CHECK_RETURN
322
+ struct ddog_prof_Profile_Result ddog_prof_Profile_set_endpoint(struct ddog_prof_Profile *profile,
323
+ uint64_t local_root_span_id,
324
+ ddog_CharSlice endpoint);
325
+
326
+ /**
327
+ * Count the number of times an endpoint has been seen.
328
+ *
329
+ * # Arguments
330
+ * * `profile` - a reference to the profile that will contain the samples.
331
+ * * `endpoint` - the endpoint label for which the count will be incremented
332
+ *
333
+ * # Safety
334
+ * The `profile` ptr must point to a valid Profile object created by this
335
+ * module.
336
+ * This call is _NOT_ thread-safe.
337
+ */
338
+ DDOG_CHECK_RETURN
339
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add_endpoint_count(struct ddog_prof_Profile *profile,
340
+ ddog_CharSlice endpoint,
341
+ int64_t value);
342
+
343
+ /**
344
+ * Add a poisson-based upscaling rule which will be use to adjust values and make them
345
+ * closer to reality.
346
+ *
347
+ * # Arguments
348
+ * * `profile` - a reference to the profile that will contain the samples.
349
+ * * `offset_values` - offset of the values
350
+ * * `label_name` - name of the label used to identify sample(s)
351
+ * * `label_value` - value of the label used to identify sample(s)
352
+ * * `sum_value_offset` - offset of the value used as a sum (compute the average with
353
+ * `count_value_offset`)
354
+ * * `count_value_offset` - offset of the value used as a count (compute the average with
355
+ * `sum_value_offset`)
356
+ * * `sampling_distance` - this is the threshold for this sampling window. This value must not be
357
+ * equal to 0
358
+ *
359
+ * # Safety
360
+ * This function must be called before serialize and must not be called after.
361
+ * The `profile` ptr must point to a valid Profile object created by this
362
+ * module.
363
+ * This call is _NOT_ thread-safe.
364
+ */
365
+ DDOG_CHECK_RETURN
366
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add_upscaling_rule_poisson(struct ddog_prof_Profile *profile,
367
+ struct ddog_prof_Slice_Usize offset_values,
368
+ ddog_CharSlice label_name,
369
+ ddog_CharSlice label_value,
370
+ uintptr_t sum_value_offset,
371
+ uintptr_t count_value_offset,
372
+ uint64_t sampling_distance);
373
+
374
+ /**
375
+ * Add a proportional-based upscaling rule which will be use to adjust values and make them
376
+ * closer to reality.
377
+ *
378
+ * # Arguments
379
+ * * `profile` - a reference to the profile that will contain the samples.
380
+ * * `offset_values` - offset of the values
381
+ * * `label_name` - name of the label used to identify sample(s)
382
+ * * `label_value` - value of the label used to identify sample(s)
383
+ * * `total_sampled` - number of sampled event (found in the pprof). This value must not be equal
384
+ * to 0
385
+ * * `total_real` - number of events the profiler actually witnessed. This value must not be equal
386
+ * to 0
387
+ *
388
+ * # Safety
389
+ * This function must be called before serialize and must not be called after.
390
+ * The `profile` ptr must point to a valid Profile object created by this
391
+ * module.
392
+ * This call is _NOT_ thread-safe.
393
+ */
394
+ DDOG_CHECK_RETURN
395
+ struct ddog_prof_Profile_Result ddog_prof_Profile_add_upscaling_rule_proportional(struct ddog_prof_Profile *profile,
396
+ struct ddog_prof_Slice_Usize offset_values,
397
+ ddog_CharSlice label_name,
398
+ ddog_CharSlice label_value,
399
+ uint64_t total_sampled,
400
+ uint64_t total_real);
401
+
402
+ /**
403
+ * # Safety
404
+ * Only pass a reference to a valid `ddog_prof_EncodedProfile`, or null. A
405
+ * valid reference also means that it hasn't already been dropped or exported (do not
406
+ * call this twice on the same object).
407
+ */
408
+ void ddog_prof_EncodedProfile_drop(struct ddog_prof_EncodedProfile *profile);
409
+
410
+ /**
411
+ * Given an EncodedProfile, get a slice representing the bytes in the pprof.
412
+ * This slice is valid for use until the encoded_profile is modified in any way (e.g. dropped or
413
+ * consumed).
414
+ * # Safety
415
+ * Only pass a reference to a valid `ddog_prof_EncodedProfile`.
416
+ */
417
+ DDOG_CHECK_RETURN
418
+ struct ddog_prof_Result_ByteSlice ddog_prof_EncodedProfile_bytes(struct ddog_prof_EncodedProfile *encoded_profile);
419
+
420
+ /**
421
+ * Serialize the aggregated profile.
422
+ * Drains the data, and then resets the profile for future use.
423
+ *
424
+ * Don't forget to clean up the ok with `ddog_prof_EncodedProfile_drop` or
425
+ * the error variant with `ddog_Error_drop` when you are done with them.
426
+ *
427
+ * # Arguments
428
+ * * `profile` - a reference to the profile being serialized.
429
+ * * `start_time` - optional start time for the serialized profile. If None/null is passed, the
430
+ * time of profile creation will be used.
431
+ * * `end_time` - optional end time of the profile. If None/null is passed, the current time will
432
+ * be used.
433
+ *
434
+ * # Safety
435
+ * The `profile` must point to a valid profile object.
436
+ * The `start_time` and `end_time` must be null or otherwise point to a valid TimeSpec object.
437
+ */
438
+ DDOG_CHECK_RETURN
439
+ struct ddog_prof_Profile_SerializeResult ddog_prof_Profile_serialize(struct ddog_prof_Profile *profile,
440
+ const struct ddog_Timespec *start_time,
441
+ const struct ddog_Timespec *end_time);
442
+
443
+ DDOG_CHECK_RETURN struct ddog_Slice_U8 ddog_Vec_U8_as_slice(const struct ddog_Vec_U8 *vec);
444
+
445
+ /**
446
+ * Resets all data in `profile` except the sample types and period. Returns
447
+ * true if it successfully reset the profile and false otherwise. The profile
448
+ * remains valid if false is returned.
449
+ *
450
+ * # Arguments
451
+ * * `profile` - A mutable reference to the profile to be reset.
452
+ * * `start_time` - The time of the profile (after reset). Pass None/null to use the current time.
453
+ *
454
+ * # Safety
455
+ * The `profile` must meet all the requirements of a mutable reference to the profile. Given this
456
+ * can be called across an FFI boundary, the compiler cannot enforce this.
457
+ * If `time` is not null, it must point to a valid Timespec object.
458
+ */
459
+ DDOG_CHECK_RETURN
460
+ struct ddog_prof_Profile_Result ddog_prof_Profile_reset(struct ddog_prof_Profile *profile);
461
+
462
+ /**
463
+ * This function interns its argument into the profiler.
464
+ * If successful, it returns an opaque interning ID.
465
+ * This ID is valid for use on this profiler, until the profiler is reset.
466
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
467
+ * On error, it holds an error message in the error variant.
468
+ *
469
+ * # Safety
470
+ * The `profile` ptr must point to a valid Profile object created by this
471
+ * module.
472
+ * All other arguments must remain valid for the length of this call.
473
+ * This call is _NOT_ thread-safe.
474
+ */
475
+ DDOG_CHECK_RETURN
476
+ struct ddog_prof_FunctionId_Result ddog_prof_Profile_intern_function(struct ddog_prof_Profile *profile,
477
+ struct ddog_prof_StringId name,
478
+ struct ddog_prof_StringId system_name,
479
+ struct ddog_prof_StringId filename);
480
+
481
+ /**
482
+ * This function interns its argument into the profiler.
483
+ * If successful, it returns an opaque interning ID.
484
+ * This ID is valid for use on this profiler, until the profiler is reset.
485
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
486
+ * On error, it holds an error message in the error variant.
487
+ *
488
+ * # Safety
489
+ * The `profile` ptr must point to a valid Profile object created by this
490
+ * module.
491
+ * All other arguments must remain valid for the length of this call.
492
+ * This call is _NOT_ thread-safe.
493
+ */
494
+ DDOG_CHECK_RETURN
495
+ struct ddog_prof_LabelId_Result ddog_prof_Profile_intern_label_num(struct ddog_prof_Profile *profile,
496
+ struct ddog_prof_StringId key,
497
+ int64_t val);
498
+
499
+ /**
500
+ * This function interns its argument into the profiler.
501
+ * If successful, it returns an opaque interning ID.
502
+ * This ID is valid for use on this profiler, until the profiler is reset.
503
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
504
+ * On error, it holds an error message in the error variant.
505
+ *
506
+ * # Safety
507
+ * The `profile` ptr must point to a valid Profile object created by this
508
+ * module.
509
+ * All other arguments must remain valid for the length of this call.
510
+ * This call is _NOT_ thread-safe.
511
+ */
512
+ DDOG_CHECK_RETURN
513
+ struct ddog_prof_LabelId_Result ddog_prof_Profile_intern_label_num_with_unit(struct ddog_prof_Profile *profile,
514
+ struct ddog_prof_StringId key,
515
+ int64_t val,
516
+ struct ddog_prof_StringId unit);
517
+
518
+ /**
519
+ * This function interns its argument into the profiler.
520
+ * If successful, it returns an opaque interning ID.
521
+ * This ID is valid for use on this profiler, until the profiler is reset.
522
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
523
+ * On error, it holds an error message in the error variant.
524
+ *
525
+ * # Safety
526
+ * The `profile` ptr must point to a valid Profile object created by this
527
+ * module.
528
+ * All other arguments must remain valid for the length of this call.
529
+ * This call is _NOT_ thread-safe.
530
+ */
531
+ DDOG_CHECK_RETURN
532
+ struct ddog_prof_LabelId_Result ddog_prof_Profile_intern_label_str(struct ddog_prof_Profile *profile,
533
+ struct ddog_prof_StringId key,
534
+ struct ddog_prof_StringId val);
535
+
536
+ /**
537
+ * This function interns its argument into the profiler.
538
+ * If successful, it returns an opaque interning ID.
539
+ * This ID is valid for use on this profiler, until the profiler is reset.
540
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
541
+ * On error, it holds an error message in the error variant.
542
+ *
543
+ * # Safety
544
+ * The `profile` ptr must point to a valid Profile object created by this
545
+ * module.
546
+ * All other arguments must remain valid for the length of this call.
547
+ * This call is _NOT_ thread-safe.
548
+ */
549
+ DDOG_CHECK_RETURN
550
+ struct ddog_prof_LabelSetId_Result ddog_prof_Profile_intern_labelset(struct ddog_prof_Profile *profile,
551
+ struct ddog_prof_Slice_LabelId labels);
552
+
553
+ /**
554
+ * This function interns its argument into the profiler.
555
+ * If successful, it returns an opaque interning ID.
556
+ * This ID is valid for use on this profiler, until the profiler is reset.
557
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
558
+ * On error, it holds an error message in the error variant.
559
+ *
560
+ * # Safety
561
+ * The `profile` ptr must point to a valid Profile object created by this
562
+ * module.
563
+ * All other arguments must remain valid for the length of this call.
564
+ * This call is _NOT_ thread-safe.
565
+ */
566
+ DDOG_CHECK_RETURN
567
+ struct ddog_prof_LocationId_Result ddog_prof_Profile_intern_location(struct ddog_prof_Profile *profile,
568
+ struct ddog_prof_FunctionId function_id,
569
+ uint64_t address,
570
+ int64_t line);
571
+
572
+ /**
573
+ * This function interns its argument into the profiler.
574
+ * If successful, it returns an opaque interning ID.
575
+ * This ID is valid for use on this profiler, until the profiler is reset.
576
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
577
+ * On error, it holds an error message in the error variant.
578
+ *
579
+ * # Safety
580
+ * The `profile` ptr must point to a valid Profile object created by this
581
+ * module.
582
+ * All other arguments must remain valid for the length of this call.
583
+ * This call is _NOT_ thread-safe.
584
+ */
585
+ DDOG_CHECK_RETURN
586
+ struct ddog_prof_LocationId_Result ddog_prof_Profile_intern_location_with_mapping_id(struct ddog_prof_Profile *profile,
587
+ struct ddog_prof_MappingId mapping_id,
588
+ struct ddog_prof_FunctionId function_id,
589
+ uint64_t address,
590
+ int64_t line);
591
+
592
+ /**
593
+ * This function interns its argument into the profiler.
594
+ * If successful, it returns an opaque interning ID.
595
+ * This ID is valid for use on this profiler, until the profiler is reset.
596
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
597
+ * On error, it holds an error message in the error variant.
598
+ *
599
+ * # Safety
600
+ * The `profile` ptr must point to a valid Profile object created by this
601
+ * module.
602
+ * All other arguments must remain valid for the length of this call.
603
+ * This call is _NOT_ thread-safe.
604
+ */
605
+ DDOG_CHECK_RETURN
606
+ struct ddog_prof_StringId_Result ddog_prof_Profile_intern_managed_string(struct ddog_prof_Profile *profile,
607
+ struct ddog_prof_ManagedStringId s);
608
+
609
+ /**
610
+ * This function interns its argument into the profiler.
611
+ * If successful, it returns an opaque interning ID.
612
+ * This ID is valid for use on this profiler, until the profiler is reset.
613
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
614
+ * On error, it holds an error message in the error variant.
615
+ *
616
+ * # Safety
617
+ * The `profile` ptr must point to a valid Profile object created by this
618
+ * module.
619
+ * All other arguments must remain valid for the length of this call.
620
+ * This call is _NOT_ thread-safe.
621
+ */
622
+ DDOG_CHECK_RETURN
623
+ struct ddog_VoidResult ddog_prof_Profile_intern_managed_strings(struct ddog_prof_Profile *profile,
624
+ struct ddog_prof_Slice_ManagedStringId strings,
625
+ struct ddog_prof_MutSlice_GenerationalIdStringId out);
626
+
627
+ /**
628
+ * This function interns its argument into the profiler.
629
+ * If successful, it returns an opaque interning ID.
630
+ * This ID is valid for use on this profiler, until the profiler is reset.
631
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
632
+ * On error, it holds an error message in the error variant.
633
+ *
634
+ * # Safety
635
+ * The `profile` ptr must point to a valid Profile object created by this
636
+ * module.
637
+ * All other arguments must remain valid for the length of this call.
638
+ * This call is _NOT_ thread-safe.
639
+ */
640
+ DDOG_CHECK_RETURN
641
+ struct ddog_prof_MappingId_Result ddog_prof_Profile_intern_mapping(struct ddog_prof_Profile *profile,
642
+ uint64_t memory_start,
643
+ uint64_t memory_limit,
644
+ uint64_t file_offset,
645
+ struct ddog_prof_StringId filename,
646
+ struct ddog_prof_StringId build_id);
647
+
648
+ /**
649
+ * This function interns its argument into the profiler.
650
+ * If successful, it returns void.
651
+ * This ID is valid for use on this profiler, until the profiler is reset.
652
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
653
+ * On error, it holds an error message in the error variant.
654
+ *
655
+ * # Safety
656
+ * The `profile` ptr must point to a valid Profile object created by this
657
+ * module.
658
+ * All other arguments must remain valid for the length of this call.
659
+ * This call is _NOT_ thread-safe.
660
+ */
661
+ DDOG_CHECK_RETURN
662
+ struct ddog_VoidResult ddog_prof_Profile_intern_sample(struct ddog_prof_Profile *profile,
663
+ struct ddog_prof_StackTraceId stacktrace,
664
+ struct ddog_Slice_I64 values,
665
+ struct ddog_prof_LabelSetId labels,
666
+ int64_t timestamp);
667
+
668
+ /**
669
+ * This function interns its argument into the profiler.
670
+ * If successful, it returns an opaque interning ID.
671
+ * This ID is valid for use on this profiler, until the profiler is reset.
672
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
673
+ * On error, it holds an error message in the error variant.
674
+ *
675
+ * # Safety
676
+ * The `profile` ptr must point to a valid Profile object created by this
677
+ * module.
678
+ * All other arguments must remain valid for the length of this call.
679
+ * This call is _NOT_ thread-safe.
680
+ */
681
+ DDOG_CHECK_RETURN
682
+ struct ddog_prof_StackTraceId_Result ddog_prof_Profile_intern_stacktrace(struct ddog_prof_Profile *profile,
683
+ struct ddog_prof_Slice_LocationId locations);
684
+
685
+ /**
686
+ * This function interns its argument into the profiler.
687
+ * If successful, it returns an opaque interning ID.
688
+ * This ID is valid for use on this profiler, until the profiler is reset.
689
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
690
+ * On error, it holds an error message in the error variant.
691
+ *
692
+ * # Safety
693
+ * The `profile` ptr must point to a valid Profile object created by this
694
+ * module.
695
+ * All other arguments must remain valid for the length of this call.
696
+ * This call is _NOT_ thread-safe.
697
+ */
698
+ DDOG_CHECK_RETURN
699
+ struct ddog_prof_StringId_Result ddog_prof_Profile_intern_string(struct ddog_prof_Profile *profile,
700
+ ddog_CharSlice s);
701
+
702
+ /**
703
+ * This functions returns an interned id for an empty string
704
+ *
705
+ * # Safety
706
+ * No preconditions
707
+ */
708
+ struct ddog_prof_StringId ddog_prof_Profile_interned_empty_string(void);
709
+
710
+ /**
711
+ * This function interns its argument into the profiler.
712
+ * If successful, it returns an opaque interning ID.
713
+ * This ID is valid for use on this profiler, until the profiler is reset.
714
+ * It is an error to use this id after the profiler has been reset, or on a different profiler.
715
+ * On error, it holds an error message in the error variant.
716
+ *
717
+ * # Safety
718
+ * The `profile` ptr must point to a valid Profile object created by this
719
+ * module.
720
+ * All other arguments must remain valid for the length of this call.
721
+ * This call is _NOT_ thread-safe.
722
+ */
723
+ DDOG_CHECK_RETURN
724
+ struct ddog_VoidResult ddog_prof_Profile_intern_strings(struct ddog_prof_Profile *profile,
725
+ struct ddog_prof_Slice_CharSlice strings,
726
+ struct ddog_prof_MutSlice_GenerationalIdStringId out);
727
+
728
+ /**
729
+ * This functions returns the current generation of the profiler.
730
+ * On error, it holds an error message in the error variant.
731
+ *
732
+ * # Safety
733
+ * The `profile` ptr must point to a valid Profile object created by this
734
+ * module.
735
+ * This call is _NOT_ thread-safe.
736
+ */
737
+ DDOG_CHECK_RETURN
738
+ struct ddog_prof_Result_Generation ddog_prof_Profile_get_generation(struct ddog_prof_Profile *profile);
739
+
740
+ /**
741
+ * This functions returns whether the given generations are equal.
742
+ *
743
+ * # Safety: No safety requirements
744
+ */
745
+ DDOG_CHECK_RETURN
746
+ bool ddog_prof_Profile_generations_are_equal(struct ddog_prof_Generation a,
747
+ struct ddog_prof_Generation b);
748
+
749
+ /**
750
+ * This functions ends the current sample and allows the profiler exporter to continue, if it was
751
+ * blocked.
752
+ * It must have been paired with exactly one `sample_start`.
753
+ *
754
+ * # Safety
755
+ * The `profile` ptr must point to a valid Profile object created by this
756
+ * module.
757
+ * This call is probably thread-safe, but I haven't confirmed this.
758
+ */
759
+ DDOG_CHECK_RETURN
760
+ struct ddog_VoidResult ddog_prof_Profile_sample_end(struct ddog_prof_Profile *profile);
761
+
762
+ /**
763
+ * This functions starts a sample and blocks the exporter from continuing.
764
+ *
765
+ * # Safety
766
+ * The `profile` ptr must point to a valid Profile object created by this
767
+ * module.
768
+ * This call is probably thread-safe, but I haven't confirmed this.
769
+ */
770
+ DDOG_CHECK_RETURN
771
+ struct ddog_VoidResult ddog_prof_Profile_sample_start(struct ddog_prof_Profile *profile);
772
+
773
+ /**
774
+ * Allocates a new `ProfilesDictionary` and writes a handle to it in `handle`.
775
+ *
776
+ * # Safety
777
+ *
778
+ * - `handle` must be non-null and valid for writes of `ProfilesDictionaryHandle`.
779
+ * - The returned handle must eventually drop the resource; see
780
+ * [`ddog_prof_ProfilesDictionary_drop`] for more details.
781
+ * - If you need a copy, use [`ddog_prof_ProfilesDictionary_try_clone`]; don't just memcpy a new
782
+ * handle.
783
+ */
784
+ struct ddog_prof_Status ddog_prof_ProfilesDictionary_new(ddog_prof_ProfilesDictionaryHandle *handle);
785
+
786
+ /**
787
+ * Creates a new handle to the same `ProfilesDictionary` by incrementing the
788
+ * internal reference count.
789
+ *
790
+ * # Safety
791
+ *
792
+ * - `out` must be non-null and valid for writes of `ProfilesDictionaryHandle`.
793
+ * - `handle` must point to a live dictionary resource.
794
+ * - Do not duplicate handles via memcpy; always use this API to create new handles so the
795
+ * reference count is maintained correctly.
796
+ */
797
+ struct ddog_prof_Status ddog_prof_ProfilesDictionary_try_clone(ddog_prof_ProfilesDictionaryHandle *out,
798
+ ddog_prof_ProfilesDictionaryHandle handle);
799
+
800
+ /**
801
+ * Inserts a `Function` into the dictionary and returns its id.
802
+ *
803
+ * # Safety
804
+ *
805
+ * - `function_id` must be non-null and valid for writes of `FunctionId`.
806
+ * - `dict` must refer to a live dictionary.
807
+ * - `function` must be non-null and point to a valid `Function` for the duration of the call.
808
+ */
809
+ struct ddog_prof_Status ddog_prof_ProfilesDictionary_insert_function(ddog_prof_FunctionId2 *function_id,
810
+ const struct ddog_prof_ProfilesDictionary *dict,
811
+ const struct ddog_prof_Function2 *function);
812
+
813
+ /**
814
+ * Inserts a `Mapping` into the dictionary and returns its id.
815
+ *
816
+ * # Safety
817
+ *
818
+ * - `mapping_id` must be non-null and valid for writes of `MappingId`.
819
+ * - `dict` must refer to a live dictionary.
820
+ * - `mapping` must be non-null and point to a valid `Mapping` for the duration of the call.
821
+ */
822
+ struct ddog_prof_Status ddog_prof_ProfilesDictionary_insert_mapping(ddog_prof_MappingId2 *mapping_id,
823
+ const struct ddog_prof_ProfilesDictionary *dict,
824
+ const struct ddog_prof_Mapping2 *mapping);
825
+
826
+ /**
827
+ * Inserts a UTF-8 string into the dictionary string table.
828
+ *
829
+ * # Safety
830
+ *
831
+ * - `string_id` must be non-null and valid for writes of `StringId`.
832
+ * - `handle` must refer to a live dictionary.
833
+ * - The UTF-8 policy indicated by `utf8_option` must be respected by caller for the provided
834
+ * `byte_slice`.
835
+ */
836
+ struct ddog_prof_Status ddog_prof_ProfilesDictionary_insert_str(ddog_prof_StringId2 *string_id,
837
+ const struct ddog_prof_ProfilesDictionary *dict,
838
+ ddog_CharSlice byte_slice,
839
+ enum ddog_prof_Utf8Option utf8_option);
840
+
841
+ /**
842
+ * Tries to get the string value associated with the string id. Fails if the
843
+ * handle has been taken from, or the result param is null.
844
+ *
845
+ * # Safety
846
+ *
847
+ * 1. The lifetime of the return slice is tied to the underlying storage of the string set, make
848
+ * sure the string set is still alive when using the returned slice.
849
+ * 2. The string id should belong to the string set in this dictionary. Well-known strings are an
850
+ * exception, as they exist in every set.
851
+ * 3. The handle must represent a live profiles dictionary. Remember handles can be copied, and if
852
+ * _any_ handle drops the resource, then all handles pointing the resource are now invalid,
853
+ * even if though they are unaware of it.
854
+ * 4. The result pointer must valid for [`core::ptr::write`].
855
+ */
856
+ struct ddog_prof_Status ddog_prof_ProfilesDictionary_get_str(ddog_CharSlice *result,
857
+ const struct ddog_prof_ProfilesDictionary *dict,
858
+ ddog_prof_StringId2 string_id);
859
+
860
+ /**
861
+ * Drops the `ProfilesDictionary` that the handle owns, leaving a valid but
862
+ * useless handle (all operations on it will error). This takes a pointer to
863
+ * the handle to be able to modify it to leave behind an empty handle.
864
+ *
865
+ * # Safety
866
+ *
867
+ * - If non-null, `handle` must point to a valid `ProfilesDictionaryHandle`.
868
+ * - The underlying resource must be dropped exactly once across all copies of the handle. After
869
+ * dropping, all other copies become invalid and must not be used; they should be discarded
870
+ * without dropping.
871
+ */
872
+ void ddog_prof_ProfilesDictionary_drop(ddog_prof_ProfilesDictionaryHandle *handle);
873
+
874
+ DDOG_CHECK_RETURN
875
+ struct ddog_prof_ManagedStringStorageNewResult ddog_prof_ManagedStringStorage_new(void);
876
+
877
+ /**
878
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
879
+ */
880
+ void ddog_prof_ManagedStringStorage_drop(struct ddog_prof_ManagedStringStorage storage);
881
+
882
+ /**
883
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
884
+ */
885
+ DDOG_CHECK_RETURN
886
+ struct ddog_prof_ManagedStringStorageInternResult ddog_prof_ManagedStringStorage_intern(struct ddog_prof_ManagedStringStorage storage,
887
+ ddog_CharSlice string);
888
+
889
+ /**
890
+ * Interns all the strings in `strings`, writing the resulting id to the same
891
+ * offset in `output_ids`.
892
+ *
893
+ * This can fail if:
894
+ * 1. The given `output_ids_size` doesn't match the size of the input slice.
895
+ * 2. The internal storage pointer is null.
896
+ * 3. It fails to acquire a lock (e.g. it was poisoned).
897
+ * 4. Defensive checks against bugs fail.
898
+ *
899
+ * If a failure occurs, do not use any of the ids in the output array. After
900
+ * this point, you should only use read-only routines (except for drop) on
901
+ * the managed string storage.
902
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
903
+ */
904
+ ddog_prof_MaybeError ddog_prof_ManagedStringStorage_intern_all(struct ddog_prof_ManagedStringStorage storage,
905
+ struct ddog_prof_Slice_CharSlice strings,
906
+ struct ddog_prof_ManagedStringId *output_ids,
907
+ uintptr_t output_ids_size);
908
+
909
+ /**
910
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
911
+ */
912
+ ddog_prof_MaybeError ddog_prof_ManagedStringStorage_unintern(struct ddog_prof_ManagedStringStorage storage,
913
+ struct ddog_prof_ManagedStringId id);
914
+
915
+ /**
916
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
917
+ */
918
+ ddog_prof_MaybeError ddog_prof_ManagedStringStorage_unintern_all(struct ddog_prof_ManagedStringStorage storage,
919
+ struct ddog_prof_Slice_ManagedStringId ids);
920
+
921
+ /**
922
+ * Returns a string given its id.
923
+ * This API is mostly for testing, overall you should avoid reading back strings from libdatadog
924
+ * once they've been interned and should instead always operate on the id.
925
+ * Remember to `ddog_StringWrapper_drop` the string once you're done with it.
926
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
927
+ */
928
+ DDOG_CHECK_RETURN
929
+ struct ddog_StringWrapperResult ddog_prof_ManagedStringStorage_get_string(struct ddog_prof_ManagedStringStorage storage,
930
+ struct ddog_prof_ManagedStringId id);
931
+
932
+ /**
933
+ * TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
934
+ */
935
+ ddog_prof_MaybeError ddog_prof_ManagedStringStorage_advance_gen(struct ddog_prof_ManagedStringStorage storage);
936
+
937
+ #ifdef __cplusplus
938
+ } // extern "C"
939
+ #endif // __cplusplus
940
+
941
+ #endif /* DDOG_PROFILING_H */