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