libdatadog 14.1.0.1.0 → 18.1.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.
- checksums.yaml +4 -4
- data/lib/libdatadog/version.rb +2 -2
- data/vendor/{libdatadog-14.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/LICENSE-3rdparty.yml +15960 -10835
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/{libdatadog-14.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/blazesym.h +2 -2
- data/vendor/{libdatadog-14.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu}/include/datadog/common.h +935 -146
- data/vendor/libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/crashtracker.h +905 -0
- data/vendor/libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/data-pipeline.h +170 -0
- data/vendor/libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/library-config.h +73 -0
- data/vendor/libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/profiling.h +782 -0
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/telemetry.h +27 -30
- data/vendor/libdatadog-18.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-14.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/LICENSE-3rdparty.yml +15960 -10835
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/blazesym.h +2 -2
- data/vendor/{libdatadog-14.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/common.h +935 -146
- data/vendor/libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/crashtracker.h +905 -0
- data/vendor/libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/data-pipeline.h +170 -0
- data/vendor/libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/library-config.h +73 -0
- data/vendor/libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/profiling.h +782 -0
- data/vendor/{libdatadog-14.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl → libdatadog-18.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl}/include/datadog/telemetry.h +27 -30
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE-3rdparty.yml +15960 -10835
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/{libdatadog-14.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/blazesym.h +2 -2
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/common.h +935 -146
- data/vendor/libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +905 -0
- data/vendor/libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/data-pipeline.h +170 -0
- data/vendor/libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/library-config.h +73 -0
- data/vendor/libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/profiling.h +782 -0
- data/vendor/{libdatadog-14.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl → libdatadog-18.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu}/include/datadog/telemetry.h +27 -30
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/{libdatadog-14.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/LICENSE-3rdparty.yml +15960 -10835
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
- data/vendor/{libdatadog-14.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/blazesym.h +2 -2
- data/vendor/{libdatadog-14.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu → libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/common.h +935 -146
- data/vendor/libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/crashtracker.h +905 -0
- data/vendor/libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/data-pipeline.h +170 -0
- data/vendor/libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/library-config.h +73 -0
- data/vendor/libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/profiling.h +782 -0
- data/vendor/{libdatadog-14.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu → libdatadog-18.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl}/include/datadog/telemetry.h +27 -30
- data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/libdatadog_profiling.so +0 -0
- metadata +56 -51
- data/vendor/libdatadog-14.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/crashtracker.h +0 -418
- data/vendor/libdatadog-14.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/include/datadog/profiling.h +0 -394
- data/vendor/libdatadog-14.1.0/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so +0 -0
- data/vendor/libdatadog-14.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/crashtracker.h +0 -418
- data/vendor/libdatadog-14.1.0/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/include/datadog/profiling.h +0 -394
- data/vendor/libdatadog-14.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/crashtracker.h +0 -418
- data/vendor/libdatadog-14.1.0/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/include/datadog/profiling.h +0 -394
- data/vendor/libdatadog-14.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/crashtracker.h +0 -418
- data/vendor/libdatadog-14.1.0/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/include/datadog/profiling.h +0 -394
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/LICENSE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/NOTICE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux/libdatadog-aarch64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/LICENSE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/NOTICE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/aarch64-linux-musl/libdatadog-aarch64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/LICENSE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/NOTICE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux/libdatadog-x86_64-unknown-linux-gnu/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/LICENSE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/NOTICE +0 -0
- /data/vendor/{libdatadog-14.1.0 → libdatadog-18.1.0}/x86_64-linux-musl/libdatadog-x86_64-alpine-linux-musl/lib/pkgconfig/datadog_profiling_with_rpath.pc +0 -0
@@ -0,0 +1,782 @@
|
|
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
|
+
#include "common.h"
|
14
|
+
struct TokioCancellationToken;
|
15
|
+
|
16
|
+
|
17
|
+
#ifdef __cplusplus
|
18
|
+
extern "C" {
|
19
|
+
#endif // __cplusplus
|
20
|
+
|
21
|
+
extern const ddog_prof_StringId INTERNED_EMPTY_STRING;
|
22
|
+
|
23
|
+
DDOG_CHECK_RETURN struct ddog_prof_Exporter_Slice_File ddog_prof_Exporter_Slice_File_empty(void);
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Creates an endpoint that uses the agent.
|
27
|
+
* # Arguments
|
28
|
+
* * `base_url` - Contains a URL with scheme, host, and port e.g. "https://agent:8126/".
|
29
|
+
*/
|
30
|
+
struct ddog_prof_Endpoint ddog_prof_Endpoint_agent(ddog_CharSlice base_url);
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Creates an endpoint that uses the Datadog intake directly aka agentless.
|
34
|
+
* # Arguments
|
35
|
+
* * `site` - Contains a host and port e.g. "datadoghq.com".
|
36
|
+
* * `api_key` - Contains the Datadog API key.
|
37
|
+
*/
|
38
|
+
struct ddog_prof_Endpoint ddog_prof_Endpoint_agentless(ddog_CharSlice site, ddog_CharSlice api_key);
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Creates an endpoint that writes to a file.
|
42
|
+
* Useful for local debugging.
|
43
|
+
* Currently only supported by the crashtracker.
|
44
|
+
* # Arguments
|
45
|
+
* * `filename` - Path to the output file "/tmp/file.txt".
|
46
|
+
*/
|
47
|
+
struct ddog_prof_Endpoint ddog_Endpoint_file(ddog_CharSlice filename);
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Creates a new exporter to be used to report profiling data.
|
51
|
+
* # Arguments
|
52
|
+
* * `profiling_library_name` - Profiling library name, usually dd-trace-something, e.g.
|
53
|
+
* "dd-trace-rb". See
|
54
|
+
* https://datadoghq.atlassian.net/wiki/spaces/PROF/pages/1538884229/Client#Header-values
|
55
|
+
* (Datadog internal link)
|
56
|
+
* for a list of common values.
|
57
|
+
* * `profliling_library_version` - Version used when publishing the profiling library to a package
|
58
|
+
* manager
|
59
|
+
* * `family` - Profile family, e.g. "ruby"
|
60
|
+
* * `tags` - Tags to include with every profile reported by this exporter. It's also possible to
|
61
|
+
* include profile-specific tags, see `additional_tags` on `profile_exporter_build`.
|
62
|
+
* * `endpoint` - Configuration for reporting data
|
63
|
+
* # Safety
|
64
|
+
* All pointers must refer to valid objects of the correct types.
|
65
|
+
*/
|
66
|
+
DDOG_CHECK_RETURN
|
67
|
+
struct ddog_prof_ProfileExporter_Result ddog_prof_Exporter_new(ddog_CharSlice profiling_library_name,
|
68
|
+
ddog_CharSlice profiling_library_version,
|
69
|
+
ddog_CharSlice family,
|
70
|
+
const struct ddog_Vec_Tag *tags,
|
71
|
+
struct ddog_prof_Endpoint endpoint);
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Sets the value for the exporter's timeout.
|
75
|
+
* # Arguments
|
76
|
+
* * `exporter` - ProfileExporter instance.
|
77
|
+
* * `timeout_ms` - timeout in milliseconds.
|
78
|
+
*/
|
79
|
+
DDOG_CHECK_RETURN
|
80
|
+
struct ddog_VoidResult ddog_prof_Exporter_set_timeout(struct ddog_prof_ProfileExporter *exporter,
|
81
|
+
uint64_t timeout_ms);
|
82
|
+
|
83
|
+
/**
|
84
|
+
* # Safety
|
85
|
+
* The `exporter` may be null, but if non-null the pointer must point to a
|
86
|
+
* valid `ddog_prof_Exporter_Request` object made by the Rust Global
|
87
|
+
* allocator that has not already been dropped.
|
88
|
+
*/
|
89
|
+
void ddog_prof_Exporter_drop(struct ddog_prof_ProfileExporter *exporter);
|
90
|
+
|
91
|
+
/**
|
92
|
+
* If successful, builds a `ddog_prof_Exporter_Request` object based on the
|
93
|
+
* profile data supplied. If unsuccessful, it returns an error message.
|
94
|
+
*
|
95
|
+
* For details on the `optional_internal_metadata_json`, please reference the Datadog-internal
|
96
|
+
* "RFC: Attaching internal metadata to pprof profiles".
|
97
|
+
* If you use this parameter, please update the RFC with your use-case, so we can keep track of how
|
98
|
+
* this is getting used.
|
99
|
+
*
|
100
|
+
* For details on the `optional_info_json`, please reference the Datadog-internal
|
101
|
+
* "RFC: Pprof System Info Support".
|
102
|
+
*
|
103
|
+
* # Safety
|
104
|
+
* The `exporter`, `optional_additional_stats`, and `optional_endpoint_stats` args should be
|
105
|
+
* valid objects created by this module.
|
106
|
+
* NULL is allowed for `optional_additional_tags`, `optional_endpoints_stats`,
|
107
|
+
* `optional_internal_metadata_json` and `optional_info_json`.
|
108
|
+
* Consumes the `SerializedProfile`
|
109
|
+
*/
|
110
|
+
DDOG_CHECK_RETURN
|
111
|
+
struct ddog_prof_Request_Result ddog_prof_Exporter_Request_build(struct ddog_prof_ProfileExporter *exporter,
|
112
|
+
struct ddog_prof_EncodedProfile *profile,
|
113
|
+
struct ddog_prof_Exporter_Slice_File files_to_compress_and_export,
|
114
|
+
struct ddog_prof_Exporter_Slice_File files_to_export_unmodified,
|
115
|
+
const struct ddog_Vec_Tag *optional_additional_tags,
|
116
|
+
const ddog_CharSlice *optional_internal_metadata_json,
|
117
|
+
const ddog_CharSlice *optional_info_json);
|
118
|
+
|
119
|
+
/**
|
120
|
+
* # Safety
|
121
|
+
* Each pointer of `request` may be null, but if non-null the inner-most
|
122
|
+
* pointer must point to a valid `ddog_prof_Exporter_Request` object made by
|
123
|
+
* the Rust Global allocator.
|
124
|
+
*/
|
125
|
+
void ddog_prof_Exporter_Request_drop(struct ddog_prof_Request *request);
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Sends the request, returning the HttpStatus.
|
129
|
+
*
|
130
|
+
* # Arguments
|
131
|
+
* * `exporter` - Borrows the exporter for sending the request.
|
132
|
+
* * `request` - Takes ownership of the request, replacing it with a null pointer. This is why it
|
133
|
+
* takes a double-pointer, rather than a single one.
|
134
|
+
* * `cancel` - Borrows the cancel, if any.
|
135
|
+
*
|
136
|
+
* # Safety
|
137
|
+
* All non-null arguments MUST have been created by created by apis in this module.
|
138
|
+
*/
|
139
|
+
DDOG_CHECK_RETURN
|
140
|
+
struct ddog_prof_Result_HttpStatus ddog_prof_Exporter_send(struct ddog_prof_ProfileExporter *exporter,
|
141
|
+
struct ddog_prof_Request *request,
|
142
|
+
struct ddog_CancellationToken *cancel);
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Can be passed as an argument to send and then be used to asynchronously cancel it from a
|
146
|
+
* different thread.
|
147
|
+
*/
|
148
|
+
DDOG_CHECK_RETURN struct ddog_CancellationToken ddog_CancellationToken_new(void);
|
149
|
+
|
150
|
+
/**
|
151
|
+
* A cloned TokioCancellationToken is connected to the TokioCancellationToken it was created from.
|
152
|
+
* Either the cloned or the original token can be used to cancel or provided as arguments to send.
|
153
|
+
* The useful part is that they have independent lifetimes and can be dropped separately.
|
154
|
+
*
|
155
|
+
* Thus, it's possible to do something like:
|
156
|
+
* ```c
|
157
|
+
* cancel_t1 = ddog_CancellationToken_new();
|
158
|
+
* cancel_t2 = ddog_CancellationToken_clone(cancel_t1);
|
159
|
+
*
|
160
|
+
* // On thread t1:
|
161
|
+
* ddog_prof_Exporter_send(..., cancel_t1);
|
162
|
+
* ddog_CancellationToken_drop(cancel_t1);
|
163
|
+
*
|
164
|
+
* // On thread t2:
|
165
|
+
* ddog_CancellationToken_cancel(cancel_t2);
|
166
|
+
* ddog_CancellationToken_drop(cancel_t2);
|
167
|
+
* ```
|
168
|
+
*
|
169
|
+
* Without clone, both t1 and t2 would need to synchronize to make sure neither was using the
|
170
|
+
* cancel before it could be dropped. With clone, there is no need for such synchronization, both
|
171
|
+
* threads have their own cancel and should drop that cancel after they are done with it.
|
172
|
+
*
|
173
|
+
* # Safety
|
174
|
+
* If the `token` is non-null, it must point to a valid object.
|
175
|
+
*/
|
176
|
+
DDOG_CHECK_RETURN
|
177
|
+
struct ddog_CancellationToken ddog_CancellationToken_clone(struct ddog_CancellationToken *token);
|
178
|
+
|
179
|
+
/**
|
180
|
+
* Cancel send that is being called in another thread with the given token.
|
181
|
+
* Note that cancellation is a terminal state; cancelling a token more than once does nothing.
|
182
|
+
* Returns `true` if token was successfully cancelled.
|
183
|
+
*/
|
184
|
+
bool ddog_CancellationToken_cancel(struct ddog_CancellationToken *cancel);
|
185
|
+
|
186
|
+
/**
|
187
|
+
* # Safety
|
188
|
+
* The `token` can be null, but non-null values must be created by the Rust
|
189
|
+
* Global allocator and must have not been dropped already.
|
190
|
+
*/
|
191
|
+
void ddog_CancellationToken_drop(struct ddog_CancellationToken *token);
|
192
|
+
|
193
|
+
/**
|
194
|
+
* Create a new profile with the given sample types. Must call
|
195
|
+
* `ddog_prof_Profile_drop` when you are done with the profile.
|
196
|
+
*
|
197
|
+
* # Arguments
|
198
|
+
* * `sample_types`
|
199
|
+
* * `period` - Optional period of the profile. Passing None/null translates to zero values.
|
200
|
+
* * `start_time` - Optional time the profile started at. Passing None/null will use the current
|
201
|
+
* time.
|
202
|
+
*
|
203
|
+
* # Safety
|
204
|
+
* All slices must be have pointers that are suitably aligned for their type
|
205
|
+
* and must have the correct number of elements for the slice.
|
206
|
+
*/
|
207
|
+
DDOG_CHECK_RETURN
|
208
|
+
struct ddog_prof_Profile_NewResult ddog_prof_Profile_new(struct ddog_prof_Slice_ValueType sample_types,
|
209
|
+
const struct ddog_prof_Period *period);
|
210
|
+
|
211
|
+
/**
|
212
|
+
* Same as `ddog_profile_new` but also configures a `string_storage` for the profile.
|
213
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
214
|
+
*/
|
215
|
+
DDOG_CHECK_RETURN
|
216
|
+
struct ddog_prof_Profile_NewResult ddog_prof_Profile_with_string_storage(struct ddog_prof_Slice_ValueType sample_types,
|
217
|
+
const struct ddog_prof_Period *period,
|
218
|
+
struct ddog_prof_ManagedStringStorage string_storage);
|
219
|
+
|
220
|
+
/**
|
221
|
+
* # Safety
|
222
|
+
* The `profile` can be null, but if non-null it must point to a Profile
|
223
|
+
* made by this module, which has not previously been dropped.
|
224
|
+
*/
|
225
|
+
void ddog_prof_Profile_drop(struct ddog_prof_Profile *profile);
|
226
|
+
|
227
|
+
/**
|
228
|
+
* # Safety
|
229
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
230
|
+
* module. All pointers inside the `sample` need to be valid for the duration
|
231
|
+
* of this call.
|
232
|
+
*
|
233
|
+
* If successful, it returns the Ok variant.
|
234
|
+
* On error, it holds an error message in the error variant.
|
235
|
+
*
|
236
|
+
* # Safety
|
237
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
238
|
+
* module.
|
239
|
+
* This call is _NOT_ thread-safe.
|
240
|
+
*/
|
241
|
+
DDOG_CHECK_RETURN
|
242
|
+
struct ddog_prof_Profile_Result ddog_prof_Profile_add(struct ddog_prof_Profile *profile,
|
243
|
+
struct ddog_prof_Sample sample,
|
244
|
+
int64_t timestamp);
|
245
|
+
|
246
|
+
/**
|
247
|
+
* Associate an endpoint to a given local root span id.
|
248
|
+
* During the serialization of the profile, an endpoint label will be added
|
249
|
+
* to all samples that contain a matching local root span id label.
|
250
|
+
*
|
251
|
+
* Note: calling this API causes the "trace endpoint" and "local root span id" strings
|
252
|
+
* to be interned, even if no matching sample is found.
|
253
|
+
*
|
254
|
+
* # Arguments
|
255
|
+
* * `profile` - a reference to the profile that will contain the samples.
|
256
|
+
* * `local_root_span_id`
|
257
|
+
* * `endpoint` - the value of the endpoint label to add for matching samples.
|
258
|
+
*
|
259
|
+
* # Safety
|
260
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
261
|
+
* module.
|
262
|
+
* This call is _NOT_ thread-safe.
|
263
|
+
*/
|
264
|
+
DDOG_CHECK_RETURN
|
265
|
+
struct ddog_prof_Profile_Result ddog_prof_Profile_set_endpoint(struct ddog_prof_Profile *profile,
|
266
|
+
uint64_t local_root_span_id,
|
267
|
+
ddog_CharSlice endpoint);
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Count the number of times an endpoint has been seen.
|
271
|
+
*
|
272
|
+
* # Arguments
|
273
|
+
* * `profile` - a reference to the profile that will contain the samples.
|
274
|
+
* * `endpoint` - the endpoint label for which the count will be incremented
|
275
|
+
*
|
276
|
+
* # Safety
|
277
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
278
|
+
* module.
|
279
|
+
* This call is _NOT_ thread-safe.
|
280
|
+
*/
|
281
|
+
DDOG_CHECK_RETURN
|
282
|
+
struct ddog_prof_Profile_Result ddog_prof_Profile_add_endpoint_count(struct ddog_prof_Profile *profile,
|
283
|
+
ddog_CharSlice endpoint,
|
284
|
+
int64_t value);
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Add a poisson-based upscaling rule which will be use to adjust values and make them
|
288
|
+
* closer to reality.
|
289
|
+
*
|
290
|
+
* # Arguments
|
291
|
+
* * `profile` - a reference to the profile that will contain the samples.
|
292
|
+
* * `offset_values` - offset of the values
|
293
|
+
* * `label_name` - name of the label used to identify sample(s)
|
294
|
+
* * `label_value` - value of the label used to identify sample(s)
|
295
|
+
* * `sum_value_offset` - offset of the value used as a sum (compute the average with
|
296
|
+
* `count_value_offset`)
|
297
|
+
* * `count_value_offset` - offset of the value used as a count (compute the average with
|
298
|
+
* `sum_value_offset`)
|
299
|
+
* * `sampling_distance` - this is the threshold for this sampling window. This value must not be
|
300
|
+
* equal to 0
|
301
|
+
*
|
302
|
+
* # Safety
|
303
|
+
* This function must be called before serialize and must not be called after.
|
304
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
305
|
+
* module.
|
306
|
+
* This call is _NOT_ thread-safe.
|
307
|
+
*/
|
308
|
+
DDOG_CHECK_RETURN
|
309
|
+
struct ddog_prof_Profile_Result ddog_prof_Profile_add_upscaling_rule_poisson(struct ddog_prof_Profile *profile,
|
310
|
+
struct ddog_prof_Slice_Usize offset_values,
|
311
|
+
ddog_CharSlice label_name,
|
312
|
+
ddog_CharSlice label_value,
|
313
|
+
uintptr_t sum_value_offset,
|
314
|
+
uintptr_t count_value_offset,
|
315
|
+
uint64_t sampling_distance);
|
316
|
+
|
317
|
+
/**
|
318
|
+
* Add a proportional-based upscaling rule which will be use to adjust values and make them
|
319
|
+
* closer to reality.
|
320
|
+
*
|
321
|
+
* # Arguments
|
322
|
+
* * `profile` - a reference to the profile that will contain the samples.
|
323
|
+
* * `offset_values` - offset of the values
|
324
|
+
* * `label_name` - name of the label used to identify sample(s)
|
325
|
+
* * `label_value` - value of the label used to identify sample(s)
|
326
|
+
* * `total_sampled` - number of sampled event (found in the pprof). This value must not be equal
|
327
|
+
* to 0
|
328
|
+
* * `total_real` - number of events the profiler actually witnessed. This value must not be equal
|
329
|
+
* to 0
|
330
|
+
*
|
331
|
+
* # Safety
|
332
|
+
* This function must be called before serialize and must not be called after.
|
333
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
334
|
+
* module.
|
335
|
+
* This call is _NOT_ thread-safe.
|
336
|
+
*/
|
337
|
+
DDOG_CHECK_RETURN
|
338
|
+
struct ddog_prof_Profile_Result ddog_prof_Profile_add_upscaling_rule_proportional(struct ddog_prof_Profile *profile,
|
339
|
+
struct ddog_prof_Slice_Usize offset_values,
|
340
|
+
ddog_CharSlice label_name,
|
341
|
+
ddog_CharSlice label_value,
|
342
|
+
uint64_t total_sampled,
|
343
|
+
uint64_t total_real);
|
344
|
+
|
345
|
+
/**
|
346
|
+
* # Safety
|
347
|
+
* Only pass a reference to a valid `ddog_prof_EncodedProfile`, or null. A
|
348
|
+
* valid reference also means that it hasn't already been dropped or exported (do not
|
349
|
+
* call this twice on the same object).
|
350
|
+
*/
|
351
|
+
void ddog_prof_EncodedProfile_drop(struct ddog_prof_EncodedProfile *profile);
|
352
|
+
|
353
|
+
/**
|
354
|
+
* Given an EncodedProfile, get a slice representing the bytes in the pprof.
|
355
|
+
* This slice is valid for use until the encoded_profile is modified in any way (e.g. dropped or
|
356
|
+
* consumed).
|
357
|
+
* # Safety
|
358
|
+
* Only pass a reference to a valid `ddog_prof_EncodedProfile`.
|
359
|
+
*/
|
360
|
+
DDOG_CHECK_RETURN
|
361
|
+
struct ddog_prof_Result_ByteSlice ddog_prof_EncodedProfile_bytes(struct ddog_prof_EncodedProfile *encoded_profile);
|
362
|
+
|
363
|
+
/**
|
364
|
+
* Serialize the aggregated profile.
|
365
|
+
* Drains the data, and then resets the profile for future use.
|
366
|
+
*
|
367
|
+
* Don't forget to clean up the ok with `ddog_prof_EncodedProfile_drop` or
|
368
|
+
* the error variant with `ddog_Error_drop` when you are done with them.
|
369
|
+
*
|
370
|
+
* # Arguments
|
371
|
+
* * `profile` - a reference to the profile being serialized.
|
372
|
+
* * `start_time` - start time for the serialized profile.
|
373
|
+
* * `end_time` - optional end time of the profile. If None/null is passed, the current time will
|
374
|
+
* be used.
|
375
|
+
*
|
376
|
+
* # Safety
|
377
|
+
* The `profile` must point to a valid profile object.
|
378
|
+
* The `start_time` and `end_time` must be null or otherwise point to a valid TimeSpec object.
|
379
|
+
*/
|
380
|
+
DDOG_CHECK_RETURN
|
381
|
+
struct ddog_prof_Profile_SerializeResult ddog_prof_Profile_serialize(struct ddog_prof_Profile *profile,
|
382
|
+
const struct ddog_Timespec *start_time,
|
383
|
+
const struct ddog_Timespec *end_time);
|
384
|
+
|
385
|
+
DDOG_CHECK_RETURN struct ddog_Slice_U8 ddog_Vec_U8_as_slice(const struct ddog_Vec_U8 *vec);
|
386
|
+
|
387
|
+
/**
|
388
|
+
* Resets all data in `profile` except the sample types and period. Returns
|
389
|
+
* true if it successfully reset the profile and false otherwise. The profile
|
390
|
+
* remains valid if false is returned.
|
391
|
+
*
|
392
|
+
* # Arguments
|
393
|
+
* * `profile` - A mutable reference to the profile to be reset.
|
394
|
+
* * `start_time` - The time of the profile (after reset). Pass None/null to use the current time.
|
395
|
+
*
|
396
|
+
* # Safety
|
397
|
+
* The `profile` must meet all the requirements of a mutable reference to the profile. Given this
|
398
|
+
* can be called across an FFI boundary, the compiler cannot enforce this.
|
399
|
+
* If `time` is not null, it must point to a valid Timespec object.
|
400
|
+
*/
|
401
|
+
DDOG_CHECK_RETURN
|
402
|
+
struct ddog_prof_Profile_Result ddog_prof_Profile_reset(struct ddog_prof_Profile *profile);
|
403
|
+
|
404
|
+
/**
|
405
|
+
* This function interns its argument into the profiler.
|
406
|
+
* If successful, it returns an opaque interning ID.
|
407
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
408
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
409
|
+
* On error, it holds an error message in the error variant.
|
410
|
+
*
|
411
|
+
* # Safety
|
412
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
413
|
+
* module.
|
414
|
+
* All other arguments must remain valid for the length of this call.
|
415
|
+
* This call is _NOT_ thread-safe.
|
416
|
+
*/
|
417
|
+
DDOG_CHECK_RETURN
|
418
|
+
struct ddog_prof_FunctionId_Result ddog_prof_Profile_intern_function(struct ddog_prof_Profile *profile,
|
419
|
+
struct ddog_prof_StringId name,
|
420
|
+
struct ddog_prof_StringId system_name,
|
421
|
+
struct ddog_prof_StringId filename);
|
422
|
+
|
423
|
+
/**
|
424
|
+
* This function interns its argument into the profiler.
|
425
|
+
* If successful, it returns an opaque interning ID.
|
426
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
427
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
428
|
+
* On error, it holds an error message in the error variant.
|
429
|
+
*
|
430
|
+
* # Safety
|
431
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
432
|
+
* module.
|
433
|
+
* All other arguments must remain valid for the length of this call.
|
434
|
+
* This call is _NOT_ thread-safe.
|
435
|
+
*/
|
436
|
+
DDOG_CHECK_RETURN
|
437
|
+
struct ddog_prof_LabelId_Result ddog_prof_Profile_intern_label_num(struct ddog_prof_Profile *profile,
|
438
|
+
struct ddog_prof_StringId key,
|
439
|
+
int64_t val);
|
440
|
+
|
441
|
+
/**
|
442
|
+
* This function interns its argument into the profiler.
|
443
|
+
* If successful, it returns an opaque interning ID.
|
444
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
445
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
446
|
+
* On error, it holds an error message in the error variant.
|
447
|
+
*
|
448
|
+
* # Safety
|
449
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
450
|
+
* module.
|
451
|
+
* All other arguments must remain valid for the length of this call.
|
452
|
+
* This call is _NOT_ thread-safe.
|
453
|
+
*/
|
454
|
+
DDOG_CHECK_RETURN
|
455
|
+
struct ddog_prof_LabelId_Result ddog_prof_Profile_intern_label_num_with_unit(struct ddog_prof_Profile *profile,
|
456
|
+
struct ddog_prof_StringId key,
|
457
|
+
int64_t val,
|
458
|
+
struct ddog_prof_StringId unit);
|
459
|
+
|
460
|
+
/**
|
461
|
+
* This function interns its argument into the profiler.
|
462
|
+
* If successful, it returns an opaque interning ID.
|
463
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
464
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
465
|
+
* On error, it holds an error message in the error variant.
|
466
|
+
*
|
467
|
+
* # Safety
|
468
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
469
|
+
* module.
|
470
|
+
* All other arguments must remain valid for the length of this call.
|
471
|
+
* This call is _NOT_ thread-safe.
|
472
|
+
*/
|
473
|
+
DDOG_CHECK_RETURN
|
474
|
+
struct ddog_prof_LabelId_Result ddog_prof_Profile_intern_label_str(struct ddog_prof_Profile *profile,
|
475
|
+
struct ddog_prof_StringId key,
|
476
|
+
struct ddog_prof_StringId val);
|
477
|
+
|
478
|
+
/**
|
479
|
+
* This function interns its argument into the profiler.
|
480
|
+
* If successful, it returns an opaque interning ID.
|
481
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
482
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
483
|
+
* On error, it holds an error message in the error variant.
|
484
|
+
*
|
485
|
+
* # Safety
|
486
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
487
|
+
* module.
|
488
|
+
* All other arguments must remain valid for the length of this call.
|
489
|
+
* This call is _NOT_ thread-safe.
|
490
|
+
*/
|
491
|
+
DDOG_CHECK_RETURN
|
492
|
+
struct ddog_prof_LabelSetId_Result ddog_prof_Profile_intern_labelset(struct ddog_prof_Profile *profile,
|
493
|
+
struct ddog_prof_Slice_LabelId labels);
|
494
|
+
|
495
|
+
/**
|
496
|
+
* This function interns its argument into the profiler.
|
497
|
+
* If successful, it returns an opaque interning ID.
|
498
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
499
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
500
|
+
* On error, it holds an error message in the error variant.
|
501
|
+
*
|
502
|
+
* # Safety
|
503
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
504
|
+
* module.
|
505
|
+
* All other arguments must remain valid for the length of this call.
|
506
|
+
* This call is _NOT_ thread-safe.
|
507
|
+
*/
|
508
|
+
DDOG_CHECK_RETURN
|
509
|
+
struct ddog_prof_LocationId_Result ddog_prof_Profile_intern_location(struct ddog_prof_Profile *profile,
|
510
|
+
struct ddog_prof_FunctionId function_id,
|
511
|
+
uint64_t address,
|
512
|
+
int64_t line);
|
513
|
+
|
514
|
+
/**
|
515
|
+
* This function interns its argument into the profiler.
|
516
|
+
* If successful, it returns an opaque interning ID.
|
517
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
518
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
519
|
+
* On error, it holds an error message in the error variant.
|
520
|
+
*
|
521
|
+
* # Safety
|
522
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
523
|
+
* module.
|
524
|
+
* All other arguments must remain valid for the length of this call.
|
525
|
+
* This call is _NOT_ thread-safe.
|
526
|
+
*/
|
527
|
+
DDOG_CHECK_RETURN
|
528
|
+
struct ddog_prof_LocationId_Result ddog_prof_Profile_intern_location_with_mapping_id(struct ddog_prof_Profile *profile,
|
529
|
+
struct ddog_prof_MappingId mapping_id,
|
530
|
+
struct ddog_prof_FunctionId function_id,
|
531
|
+
uint64_t address,
|
532
|
+
int64_t line);
|
533
|
+
|
534
|
+
/**
|
535
|
+
* This function interns its argument into the profiler.
|
536
|
+
* If successful, it returns an opaque interning ID.
|
537
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
538
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
539
|
+
* On error, it holds an error message in the error variant.
|
540
|
+
*
|
541
|
+
* # Safety
|
542
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
543
|
+
* module.
|
544
|
+
* All other arguments must remain valid for the length of this call.
|
545
|
+
* This call is _NOT_ thread-safe.
|
546
|
+
*/
|
547
|
+
DDOG_CHECK_RETURN
|
548
|
+
struct ddog_prof_StringId_Result ddog_prof_Profile_intern_managed_string(struct ddog_prof_Profile *profile,
|
549
|
+
struct ddog_prof_ManagedStringId s);
|
550
|
+
|
551
|
+
/**
|
552
|
+
* This function interns its argument into the profiler.
|
553
|
+
* If successful, it returns an opaque interning ID.
|
554
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
555
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
556
|
+
* On error, it holds an error message in the error variant.
|
557
|
+
*
|
558
|
+
* # Safety
|
559
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
560
|
+
* module.
|
561
|
+
* All other arguments must remain valid for the length of this call.
|
562
|
+
* This call is _NOT_ thread-safe.
|
563
|
+
*/
|
564
|
+
DDOG_CHECK_RETURN
|
565
|
+
struct ddog_VoidResult ddog_prof_Profile_intern_managed_strings(struct ddog_prof_Profile *profile,
|
566
|
+
struct ddog_prof_Slice_ManagedStringId strings,
|
567
|
+
struct ddog_prof_MutSlice_GenerationalIdStringId out);
|
568
|
+
|
569
|
+
/**
|
570
|
+
* This function interns its argument into the profiler.
|
571
|
+
* If successful, it returns an opaque interning ID.
|
572
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
573
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
574
|
+
* On error, it holds an error message in the error variant.
|
575
|
+
*
|
576
|
+
* # Safety
|
577
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
578
|
+
* module.
|
579
|
+
* All other arguments must remain valid for the length of this call.
|
580
|
+
* This call is _NOT_ thread-safe.
|
581
|
+
*/
|
582
|
+
DDOG_CHECK_RETURN
|
583
|
+
struct ddog_prof_MappingId_Result ddog_prof_Profile_intern_mapping(struct ddog_prof_Profile *profile,
|
584
|
+
uint64_t memory_start,
|
585
|
+
uint64_t memory_limit,
|
586
|
+
uint64_t file_offset,
|
587
|
+
struct ddog_prof_StringId filename,
|
588
|
+
struct ddog_prof_StringId build_id);
|
589
|
+
|
590
|
+
/**
|
591
|
+
* This function interns its argument into the profiler.
|
592
|
+
* If successful, it returns void.
|
593
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
594
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
595
|
+
* On error, it holds an error message in the error variant.
|
596
|
+
*
|
597
|
+
* # Safety
|
598
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
599
|
+
* module.
|
600
|
+
* All other arguments must remain valid for the length of this call.
|
601
|
+
* This call is _NOT_ thread-safe.
|
602
|
+
*/
|
603
|
+
DDOG_CHECK_RETURN
|
604
|
+
struct ddog_VoidResult ddog_prof_Profile_intern_sample(struct ddog_prof_Profile *profile,
|
605
|
+
struct ddog_prof_StackTraceId stacktrace,
|
606
|
+
struct ddog_Slice_I64 values,
|
607
|
+
struct ddog_prof_LabelSetId labels,
|
608
|
+
int64_t timestamp);
|
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_StackTraceId_Result ddog_prof_Profile_intern_stacktrace(struct ddog_prof_Profile *profile,
|
625
|
+
struct ddog_prof_Slice_LocationId locations);
|
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_StringId_Result ddog_prof_Profile_intern_string(struct ddog_prof_Profile *profile,
|
642
|
+
ddog_CharSlice s);
|
643
|
+
|
644
|
+
/**
|
645
|
+
* This functions returns an interned id for an empty string
|
646
|
+
*
|
647
|
+
* # Safety
|
648
|
+
* No preconditions
|
649
|
+
*/
|
650
|
+
struct ddog_prof_StringId ddog_prof_Profile_interned_empty_string(void);
|
651
|
+
|
652
|
+
/**
|
653
|
+
* This function interns its argument into the profiler.
|
654
|
+
* If successful, it returns an opaque interning ID.
|
655
|
+
* This ID is valid for use on this profiler, until the profiler is reset.
|
656
|
+
* It is an error to use this id after the profiler has been reset, or on a different profiler.
|
657
|
+
* On error, it holds an error message in the error variant.
|
658
|
+
*
|
659
|
+
* # Safety
|
660
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
661
|
+
* module.
|
662
|
+
* All other arguments must remain valid for the length of this call.
|
663
|
+
* This call is _NOT_ thread-safe.
|
664
|
+
*/
|
665
|
+
DDOG_CHECK_RETURN
|
666
|
+
struct ddog_VoidResult ddog_prof_Profile_intern_strings(struct ddog_prof_Profile *profile,
|
667
|
+
struct ddog_prof_Slice_CharSlice strings,
|
668
|
+
struct ddog_prof_MutSlice_GenerationalIdStringId out);
|
669
|
+
|
670
|
+
/**
|
671
|
+
* This functions returns the current generation of the profiler.
|
672
|
+
* On error, it holds an error message in the error variant.
|
673
|
+
*
|
674
|
+
* # Safety
|
675
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
676
|
+
* module.
|
677
|
+
* This call is _NOT_ thread-safe.
|
678
|
+
*/
|
679
|
+
DDOG_CHECK_RETURN
|
680
|
+
struct ddog_prof_Result_Generation ddog_prof_Profile_get_generation(struct ddog_prof_Profile *profile);
|
681
|
+
|
682
|
+
/**
|
683
|
+
* This functions returns whether the given generations are equal.
|
684
|
+
*
|
685
|
+
* # Safety: No safety requirements
|
686
|
+
*/
|
687
|
+
DDOG_CHECK_RETURN
|
688
|
+
bool ddog_prof_Profile_generations_are_equal(struct ddog_prof_Generation a,
|
689
|
+
struct ddog_prof_Generation b);
|
690
|
+
|
691
|
+
/**
|
692
|
+
* This functions ends the current sample and allows the profiler exporter to continue, if it was
|
693
|
+
* blocked.
|
694
|
+
* It must have been paired with exactly one `sample_start`.
|
695
|
+
*
|
696
|
+
* # Safety
|
697
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
698
|
+
* module.
|
699
|
+
* This call is probably thread-safe, but I haven't confirmed this.
|
700
|
+
*/
|
701
|
+
DDOG_CHECK_RETURN
|
702
|
+
struct ddog_VoidResult ddog_prof_Profile_sample_end(struct ddog_prof_Profile *profile);
|
703
|
+
|
704
|
+
/**
|
705
|
+
* This functions starts a sample and blocks the exporter from continuing.
|
706
|
+
*
|
707
|
+
* # Safety
|
708
|
+
* The `profile` ptr must point to a valid Profile object created by this
|
709
|
+
* module.
|
710
|
+
* This call is probably thread-safe, but I haven't confirmed this.
|
711
|
+
*/
|
712
|
+
DDOG_CHECK_RETURN
|
713
|
+
struct ddog_VoidResult ddog_prof_Profile_sample_start(struct ddog_prof_Profile *profile);
|
714
|
+
|
715
|
+
DDOG_CHECK_RETURN
|
716
|
+
struct ddog_prof_ManagedStringStorageNewResult ddog_prof_ManagedStringStorage_new(void);
|
717
|
+
|
718
|
+
/**
|
719
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
720
|
+
*/
|
721
|
+
void ddog_prof_ManagedStringStorage_drop(struct ddog_prof_ManagedStringStorage storage);
|
722
|
+
|
723
|
+
/**
|
724
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
725
|
+
*/
|
726
|
+
DDOG_CHECK_RETURN
|
727
|
+
struct ddog_prof_ManagedStringStorageInternResult ddog_prof_ManagedStringStorage_intern(struct ddog_prof_ManagedStringStorage storage,
|
728
|
+
ddog_CharSlice string);
|
729
|
+
|
730
|
+
/**
|
731
|
+
* Interns all the strings in `strings`, writing the resulting id to the same
|
732
|
+
* offset in `output_ids`.
|
733
|
+
*
|
734
|
+
* This can fail if:
|
735
|
+
* 1. The given `output_ids_size` doesn't match the size of the input slice.
|
736
|
+
* 2. The internal storage pointer is null.
|
737
|
+
* 3. It fails to acquire a lock (e.g. it was poisoned).
|
738
|
+
* 4. Defensive checks against bugs fail.
|
739
|
+
*
|
740
|
+
* If a failure occurs, do not use any of the ids in the output array. After
|
741
|
+
* this point, you should only use read-only routines (except for drop) on
|
742
|
+
* the managed string storage.
|
743
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
744
|
+
*/
|
745
|
+
ddog_prof_MaybeError ddog_prof_ManagedStringStorage_intern_all(struct ddog_prof_ManagedStringStorage storage,
|
746
|
+
struct ddog_prof_Slice_CharSlice strings,
|
747
|
+
struct ddog_prof_ManagedStringId *output_ids,
|
748
|
+
uintptr_t output_ids_size);
|
749
|
+
|
750
|
+
/**
|
751
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
752
|
+
*/
|
753
|
+
ddog_prof_MaybeError ddog_prof_ManagedStringStorage_unintern(struct ddog_prof_ManagedStringStorage storage,
|
754
|
+
struct ddog_prof_ManagedStringId id);
|
755
|
+
|
756
|
+
/**
|
757
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
758
|
+
*/
|
759
|
+
ddog_prof_MaybeError ddog_prof_ManagedStringStorage_unintern_all(struct ddog_prof_ManagedStringStorage storage,
|
760
|
+
struct ddog_prof_Slice_ManagedStringId ids);
|
761
|
+
|
762
|
+
/**
|
763
|
+
* Returns a string given its id.
|
764
|
+
* This API is mostly for testing, overall you should avoid reading back strings from libdatadog
|
765
|
+
* once they've been interned and should instead always operate on the id.
|
766
|
+
* Remember to `ddog_StringWrapper_drop` the string once you're done with it.
|
767
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
768
|
+
*/
|
769
|
+
DDOG_CHECK_RETURN
|
770
|
+
struct ddog_StringWrapperResult ddog_prof_ManagedStringStorage_get_string(struct ddog_prof_ManagedStringStorage storage,
|
771
|
+
struct ddog_prof_ManagedStringId id);
|
772
|
+
|
773
|
+
/**
|
774
|
+
* TODO: @ivoanjo Should this take a `*mut ManagedStringStorage` like Profile APIs do?
|
775
|
+
*/
|
776
|
+
ddog_prof_MaybeError ddog_prof_ManagedStringStorage_advance_gen(struct ddog_prof_ManagedStringStorage storage);
|
777
|
+
|
778
|
+
#ifdef __cplusplus
|
779
|
+
} // extern "C"
|
780
|
+
#endif // __cplusplus
|
781
|
+
|
782
|
+
#endif /* DDOG_PROFILING_H */
|