libdatadog 40.0.0.1.0 → 40.0.0.2.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 (22) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libdatadog/version.rb +1 -1
  3. data/tasks/build.rake +7 -1
  4. data/vendor/libdatadog-40.0.0/aarch64-linux/bin/libdatadog-crashtracking-receiver +0 -0
  5. data/vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/common.h +15 -0
  6. data/vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/otel-thread-ctx.h +86 -0
  7. data/vendor/libdatadog-40.0.0/aarch64-linux/lib/libdatadog_profiling.so +0 -0
  8. data/vendor/libdatadog-40.0.0/aarch64-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  9. data/vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/common.h +15 -0
  10. data/vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/otel-thread-ctx.h +86 -0
  11. data/vendor/libdatadog-40.0.0/aarch64-linux-musl/lib/libdatadog_profiling.so +0 -0
  12. data/vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/common.h +15 -0
  13. data/vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/otel-thread-ctx.h +86 -0
  14. data/vendor/libdatadog-40.0.0/arm64-darwin/lib/libdatadog_profiling.dylib +0 -0
  15. data/vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/common.h +15 -0
  16. data/vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/otel-thread-ctx.h +86 -0
  17. data/vendor/libdatadog-40.0.0/x86_64-linux/lib/libdatadog_profiling.so +0 -0
  18. data/vendor/libdatadog-40.0.0/x86_64-linux-musl/bin/libdatadog-crashtracking-receiver +0 -0
  19. data/vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/common.h +15 -0
  20. data/vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/otel-thread-ctx.h +86 -0
  21. data/vendor/libdatadog-40.0.0/x86_64-linux-musl/lib/libdatadog_profiling.so +0 -0
  22. metadata +6 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d504f44b27d92cdae236776497e54dc9410352658f00ca566402ed501fb1e37c
4
- data.tar.gz: b14c06df3f9039faafea968db80f88daf6c496eb6a98ad7c3f33ac00ed44ddd5
3
+ metadata.gz: c4fd0813b2598a196d03dbd4c0fb419b6199a7b1f8151d0438690da2a7e4f92f
4
+ data.tar.gz: a35852a85ee22b63c13744135bc0b2f3f927223616933d821efc8f616f1a61fd
5
5
  SHA512:
6
- metadata.gz: c8021d4c49389571171674b3ecde28baed658bd930b4a09891ada8cdf655af4d059d008b9ef42466275842f48bdb7b4a732623409bdeee2a7f1fbcd76a696cf5
7
- data.tar.gz: 33fe4d6fda2ada6275064b17e4facffb0377c9120fd11cf3fc52fe4136fc4153a816321760e59bea25f3d8f1a44e2a2ffaabcbf76fd4baf2fe19a65dfe1c1724
6
+ metadata.gz: 490d1cd1939d533ad8957aec87a569ddaff65257f7645a6102f92fb5cece232726cbef66e0eccb98b03782a81fb4181ab4e1ff399e1bb88b64059834e2420ac1
7
+ data.tar.gz: 55f16bc62b11f8b75aeb74212505affefee3a3cdf58178de3bac8b1b4b3d912e90513225153bfbdde81b97b9452cb185c99f8ae1612d26cd927ce179ede06b8b
@@ -4,7 +4,7 @@ module Libdatadog
4
4
  # Current libdatadog version
5
5
  LIB_VERSION = "40.0.0"
6
6
 
7
- GEM_MAJOR_VERSION = "1"
7
+ GEM_MAJOR_VERSION = "2"
8
8
  GEM_MINOR_VERSION = "0"
9
9
  GEM_PRERELEASE_VERSION = "" # remember to include dot prefix, if needed!
10
10
  private_constant :GEM_MAJOR_VERSION, :GEM_MINOR_VERSION, :GEM_PRERELEASE_VERSION
data/tasks/build.rake CHANGED
@@ -107,6 +107,8 @@ module BuildFromSource
107
107
  end
108
108
 
109
109
  module Builder
110
+ REQUIRED_EXTRA_FEATURES = %w[otel-thread-ctx].freeze
111
+
110
112
  class << self
111
113
  # Build the cargo install command for the builder crate's `release` binary.
112
114
  #
@@ -125,7 +127,11 @@ module BuildFromSource
125
127
  ]
126
128
  end
127
129
 
128
- cmd += ["--no-default-features", "--features", features] if features
130
+ cmd += if features
131
+ ["--no-default-features", "--features", features]
132
+ else
133
+ ["--features", REQUIRED_EXTRA_FEATURES.join(",")]
134
+ end
129
135
 
130
136
  cmd
131
137
  end
@@ -2432,6 +2432,21 @@ typedef struct ddog_SharedRuntimeFFIError {
2432
2432
  char *msg;
2433
2433
  } ddog_SharedRuntimeFFIError;
2434
2434
 
2435
+ /**
2436
+ * Maximum size in bytes of the `attrs_data` field of a thread context record.
2437
+ */
2438
+ #define ddog_MAX_ATTRS_DATA_SIZE 612
2439
+
2440
+ /**
2441
+ * Opaque handle to a thread context record. Used to allow the FFI to convert [ThreadContext]
2442
+ * to and from raw pointers without exposing [ThreadContextRecord], as the latter needs extra
2443
+ * care to be manipulated (async-signal-safety, seq-lock-like modification protocol through
2444
+ * [ThreadContextRecord::valid], etc.)
2445
+ */
2446
+ typedef struct ddog_ThreadContextHandle {
2447
+
2448
+ } ddog_ThreadContextHandle;
2449
+
2435
2450
  typedef enum ddog_crasht_BuildIdType {
2436
2451
  DDOG_CRASHT_BUILD_ID_TYPE_GNU,
2437
2452
  DDOG_CRASHT_BUILD_ID_TYPE_GO,
@@ -0,0 +1,86 @@
1
+ // Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_OTEL_THREAD_CTX_H
6
+ #define DDOG_OTEL_THREAD_CTX_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif // __cplusplus
17
+
18
+ #if defined(DDOG_OTEL_THREAD_CTX_SANITY_CHECK)
19
+ /**
20
+ * Verify that this binary was linked with the correct options such that the thread contexts are
21
+ * visible to an external reader (typically the eBPF profiler).
22
+ *
23
+ * Returns `VoidResult::Ok` if all checks pass, or a `VoidResult::Err` with a
24
+ * diagnostic message on failure.
25
+ */
26
+ struct ddog_VoidResult ddog_otel_thread_ctx_sanity_check(void);
27
+ #endif
28
+
29
+ /**
30
+ * Allocate and initialise a new thread context, including its W3C trace-flags byte.
31
+ *
32
+ * Returns a non-null owned handle that must eventually be released with
33
+ * `ddog_otel_thread_ctx_free`.
34
+ */
35
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_new(const uint8_t (*trace_id)[16],
36
+ const uint8_t (*span_id)[8],
37
+ uint8_t trace_flags,
38
+ const uint8_t (*local_root_span_id)[8]);
39
+
40
+ /**
41
+ * Free an owned thread context.
42
+ *
43
+ * # Safety
44
+ *
45
+ * `ctx` must be a valid non-null pointer obtained from `ddog_otel_thread_ctx_new` or
46
+ * `ddog_otel_thread_ctx_detach`, and must not be used after this call. In particular, `ctx`
47
+ * must not be currently attached to a thread.
48
+ */
49
+ void ddog_otel_thread_ctx_free(struct ddog_ThreadContextHandle *ctx);
50
+
51
+ /**
52
+ * Attach `ctx` to the current thread. Returns the previously attached context if any, or null
53
+ * otherwise.
54
+ *
55
+ * # Safety
56
+ *
57
+ * `ctx` must be a valid non-null pointer obtained from this API. Ownership of `ctx` is
58
+ * transferred to the TLS slot: the caller must not drop `ctx` while it is still actively
59
+ * attached.
60
+ */
61
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_attach(struct ddog_ThreadContextHandle *ctx);
62
+
63
+ /**
64
+ * Remove the currently attached context from the TLS slot.
65
+ *
66
+ * Returns the detached context (caller now owns it and must release it with
67
+ * `ddog_otel_thread_ctx_free`), or null if the slot was empty.
68
+ */
69
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_detach(void);
70
+
71
+ /**
72
+ * Update the currently attached context in-place, including its W3C trace-flags byte.
73
+ *
74
+ * If no context is currently attached, one is created and attached, equivalent to calling
75
+ * `ddog_otel_thread_ctx_new` followed by `ddog_otel_thread_ctx_attach`.
76
+ */
77
+ void ddog_otel_thread_ctx_update(const uint8_t (*trace_id)[16],
78
+ const uint8_t (*span_id)[8],
79
+ uint8_t trace_flags,
80
+ const uint8_t (*local_root_span_id)[8]);
81
+
82
+ #ifdef __cplusplus
83
+ } // extern "C"
84
+ #endif // __cplusplus
85
+
86
+ #endif /* DDOG_OTEL_THREAD_CTX_H */
@@ -2432,6 +2432,21 @@ typedef struct ddog_SharedRuntimeFFIError {
2432
2432
  char *msg;
2433
2433
  } ddog_SharedRuntimeFFIError;
2434
2434
 
2435
+ /**
2436
+ * Maximum size in bytes of the `attrs_data` field of a thread context record.
2437
+ */
2438
+ #define ddog_MAX_ATTRS_DATA_SIZE 612
2439
+
2440
+ /**
2441
+ * Opaque handle to a thread context record. Used to allow the FFI to convert [ThreadContext]
2442
+ * to and from raw pointers without exposing [ThreadContextRecord], as the latter needs extra
2443
+ * care to be manipulated (async-signal-safety, seq-lock-like modification protocol through
2444
+ * [ThreadContextRecord::valid], etc.)
2445
+ */
2446
+ typedef struct ddog_ThreadContextHandle {
2447
+
2448
+ } ddog_ThreadContextHandle;
2449
+
2435
2450
  typedef enum ddog_crasht_BuildIdType {
2436
2451
  DDOG_CRASHT_BUILD_ID_TYPE_GNU,
2437
2452
  DDOG_CRASHT_BUILD_ID_TYPE_GO,
@@ -0,0 +1,86 @@
1
+ // Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_OTEL_THREAD_CTX_H
6
+ #define DDOG_OTEL_THREAD_CTX_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif // __cplusplus
17
+
18
+ #if defined(DDOG_OTEL_THREAD_CTX_SANITY_CHECK)
19
+ /**
20
+ * Verify that this binary was linked with the correct options such that the thread contexts are
21
+ * visible to an external reader (typically the eBPF profiler).
22
+ *
23
+ * Returns `VoidResult::Ok` if all checks pass, or a `VoidResult::Err` with a
24
+ * diagnostic message on failure.
25
+ */
26
+ struct ddog_VoidResult ddog_otel_thread_ctx_sanity_check(void);
27
+ #endif
28
+
29
+ /**
30
+ * Allocate and initialise a new thread context, including its W3C trace-flags byte.
31
+ *
32
+ * Returns a non-null owned handle that must eventually be released with
33
+ * `ddog_otel_thread_ctx_free`.
34
+ */
35
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_new(const uint8_t (*trace_id)[16],
36
+ const uint8_t (*span_id)[8],
37
+ uint8_t trace_flags,
38
+ const uint8_t (*local_root_span_id)[8]);
39
+
40
+ /**
41
+ * Free an owned thread context.
42
+ *
43
+ * # Safety
44
+ *
45
+ * `ctx` must be a valid non-null pointer obtained from `ddog_otel_thread_ctx_new` or
46
+ * `ddog_otel_thread_ctx_detach`, and must not be used after this call. In particular, `ctx`
47
+ * must not be currently attached to a thread.
48
+ */
49
+ void ddog_otel_thread_ctx_free(struct ddog_ThreadContextHandle *ctx);
50
+
51
+ /**
52
+ * Attach `ctx` to the current thread. Returns the previously attached context if any, or null
53
+ * otherwise.
54
+ *
55
+ * # Safety
56
+ *
57
+ * `ctx` must be a valid non-null pointer obtained from this API. Ownership of `ctx` is
58
+ * transferred to the TLS slot: the caller must not drop `ctx` while it is still actively
59
+ * attached.
60
+ */
61
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_attach(struct ddog_ThreadContextHandle *ctx);
62
+
63
+ /**
64
+ * Remove the currently attached context from the TLS slot.
65
+ *
66
+ * Returns the detached context (caller now owns it and must release it with
67
+ * `ddog_otel_thread_ctx_free`), or null if the slot was empty.
68
+ */
69
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_detach(void);
70
+
71
+ /**
72
+ * Update the currently attached context in-place, including its W3C trace-flags byte.
73
+ *
74
+ * If no context is currently attached, one is created and attached, equivalent to calling
75
+ * `ddog_otel_thread_ctx_new` followed by `ddog_otel_thread_ctx_attach`.
76
+ */
77
+ void ddog_otel_thread_ctx_update(const uint8_t (*trace_id)[16],
78
+ const uint8_t (*span_id)[8],
79
+ uint8_t trace_flags,
80
+ const uint8_t (*local_root_span_id)[8]);
81
+
82
+ #ifdef __cplusplus
83
+ } // extern "C"
84
+ #endif // __cplusplus
85
+
86
+ #endif /* DDOG_OTEL_THREAD_CTX_H */
@@ -2432,6 +2432,21 @@ typedef struct ddog_SharedRuntimeFFIError {
2432
2432
  char *msg;
2433
2433
  } ddog_SharedRuntimeFFIError;
2434
2434
 
2435
+ /**
2436
+ * Maximum size in bytes of the `attrs_data` field of a thread context record.
2437
+ */
2438
+ #define ddog_MAX_ATTRS_DATA_SIZE 612
2439
+
2440
+ /**
2441
+ * Opaque handle to a thread context record. Used to allow the FFI to convert [ThreadContext]
2442
+ * to and from raw pointers without exposing [ThreadContextRecord], as the latter needs extra
2443
+ * care to be manipulated (async-signal-safety, seq-lock-like modification protocol through
2444
+ * [ThreadContextRecord::valid], etc.)
2445
+ */
2446
+ typedef struct ddog_ThreadContextHandle {
2447
+
2448
+ } ddog_ThreadContextHandle;
2449
+
2435
2450
  typedef enum ddog_crasht_BuildIdType {
2436
2451
  DDOG_CRASHT_BUILD_ID_TYPE_GNU,
2437
2452
  DDOG_CRASHT_BUILD_ID_TYPE_GO,
@@ -0,0 +1,86 @@
1
+ // Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_OTEL_THREAD_CTX_H
6
+ #define DDOG_OTEL_THREAD_CTX_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif // __cplusplus
17
+
18
+ #if defined(DDOG_OTEL_THREAD_CTX_SANITY_CHECK)
19
+ /**
20
+ * Verify that this binary was linked with the correct options such that the thread contexts are
21
+ * visible to an external reader (typically the eBPF profiler).
22
+ *
23
+ * Returns `VoidResult::Ok` if all checks pass, or a `VoidResult::Err` with a
24
+ * diagnostic message on failure.
25
+ */
26
+ struct ddog_VoidResult ddog_otel_thread_ctx_sanity_check(void);
27
+ #endif
28
+
29
+ /**
30
+ * Allocate and initialise a new thread context, including its W3C trace-flags byte.
31
+ *
32
+ * Returns a non-null owned handle that must eventually be released with
33
+ * `ddog_otel_thread_ctx_free`.
34
+ */
35
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_new(const uint8_t (*trace_id)[16],
36
+ const uint8_t (*span_id)[8],
37
+ uint8_t trace_flags,
38
+ const uint8_t (*local_root_span_id)[8]);
39
+
40
+ /**
41
+ * Free an owned thread context.
42
+ *
43
+ * # Safety
44
+ *
45
+ * `ctx` must be a valid non-null pointer obtained from `ddog_otel_thread_ctx_new` or
46
+ * `ddog_otel_thread_ctx_detach`, and must not be used after this call. In particular, `ctx`
47
+ * must not be currently attached to a thread.
48
+ */
49
+ void ddog_otel_thread_ctx_free(struct ddog_ThreadContextHandle *ctx);
50
+
51
+ /**
52
+ * Attach `ctx` to the current thread. Returns the previously attached context if any, or null
53
+ * otherwise.
54
+ *
55
+ * # Safety
56
+ *
57
+ * `ctx` must be a valid non-null pointer obtained from this API. Ownership of `ctx` is
58
+ * transferred to the TLS slot: the caller must not drop `ctx` while it is still actively
59
+ * attached.
60
+ */
61
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_attach(struct ddog_ThreadContextHandle *ctx);
62
+
63
+ /**
64
+ * Remove the currently attached context from the TLS slot.
65
+ *
66
+ * Returns the detached context (caller now owns it and must release it with
67
+ * `ddog_otel_thread_ctx_free`), or null if the slot was empty.
68
+ */
69
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_detach(void);
70
+
71
+ /**
72
+ * Update the currently attached context in-place, including its W3C trace-flags byte.
73
+ *
74
+ * If no context is currently attached, one is created and attached, equivalent to calling
75
+ * `ddog_otel_thread_ctx_new` followed by `ddog_otel_thread_ctx_attach`.
76
+ */
77
+ void ddog_otel_thread_ctx_update(const uint8_t (*trace_id)[16],
78
+ const uint8_t (*span_id)[8],
79
+ uint8_t trace_flags,
80
+ const uint8_t (*local_root_span_id)[8]);
81
+
82
+ #ifdef __cplusplus
83
+ } // extern "C"
84
+ #endif // __cplusplus
85
+
86
+ #endif /* DDOG_OTEL_THREAD_CTX_H */
@@ -2432,6 +2432,21 @@ typedef struct ddog_SharedRuntimeFFIError {
2432
2432
  char *msg;
2433
2433
  } ddog_SharedRuntimeFFIError;
2434
2434
 
2435
+ /**
2436
+ * Maximum size in bytes of the `attrs_data` field of a thread context record.
2437
+ */
2438
+ #define ddog_MAX_ATTRS_DATA_SIZE 612
2439
+
2440
+ /**
2441
+ * Opaque handle to a thread context record. Used to allow the FFI to convert [ThreadContext]
2442
+ * to and from raw pointers without exposing [ThreadContextRecord], as the latter needs extra
2443
+ * care to be manipulated (async-signal-safety, seq-lock-like modification protocol through
2444
+ * [ThreadContextRecord::valid], etc.)
2445
+ */
2446
+ typedef struct ddog_ThreadContextHandle {
2447
+
2448
+ } ddog_ThreadContextHandle;
2449
+
2435
2450
  typedef enum ddog_crasht_BuildIdType {
2436
2451
  DDOG_CRASHT_BUILD_ID_TYPE_GNU,
2437
2452
  DDOG_CRASHT_BUILD_ID_TYPE_GO,
@@ -0,0 +1,86 @@
1
+ // Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_OTEL_THREAD_CTX_H
6
+ #define DDOG_OTEL_THREAD_CTX_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif // __cplusplus
17
+
18
+ #if defined(DDOG_OTEL_THREAD_CTX_SANITY_CHECK)
19
+ /**
20
+ * Verify that this binary was linked with the correct options such that the thread contexts are
21
+ * visible to an external reader (typically the eBPF profiler).
22
+ *
23
+ * Returns `VoidResult::Ok` if all checks pass, or a `VoidResult::Err` with a
24
+ * diagnostic message on failure.
25
+ */
26
+ struct ddog_VoidResult ddog_otel_thread_ctx_sanity_check(void);
27
+ #endif
28
+
29
+ /**
30
+ * Allocate and initialise a new thread context, including its W3C trace-flags byte.
31
+ *
32
+ * Returns a non-null owned handle that must eventually be released with
33
+ * `ddog_otel_thread_ctx_free`.
34
+ */
35
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_new(const uint8_t (*trace_id)[16],
36
+ const uint8_t (*span_id)[8],
37
+ uint8_t trace_flags,
38
+ const uint8_t (*local_root_span_id)[8]);
39
+
40
+ /**
41
+ * Free an owned thread context.
42
+ *
43
+ * # Safety
44
+ *
45
+ * `ctx` must be a valid non-null pointer obtained from `ddog_otel_thread_ctx_new` or
46
+ * `ddog_otel_thread_ctx_detach`, and must not be used after this call. In particular, `ctx`
47
+ * must not be currently attached to a thread.
48
+ */
49
+ void ddog_otel_thread_ctx_free(struct ddog_ThreadContextHandle *ctx);
50
+
51
+ /**
52
+ * Attach `ctx` to the current thread. Returns the previously attached context if any, or null
53
+ * otherwise.
54
+ *
55
+ * # Safety
56
+ *
57
+ * `ctx` must be a valid non-null pointer obtained from this API. Ownership of `ctx` is
58
+ * transferred to the TLS slot: the caller must not drop `ctx` while it is still actively
59
+ * attached.
60
+ */
61
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_attach(struct ddog_ThreadContextHandle *ctx);
62
+
63
+ /**
64
+ * Remove the currently attached context from the TLS slot.
65
+ *
66
+ * Returns the detached context (caller now owns it and must release it with
67
+ * `ddog_otel_thread_ctx_free`), or null if the slot was empty.
68
+ */
69
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_detach(void);
70
+
71
+ /**
72
+ * Update the currently attached context in-place, including its W3C trace-flags byte.
73
+ *
74
+ * If no context is currently attached, one is created and attached, equivalent to calling
75
+ * `ddog_otel_thread_ctx_new` followed by `ddog_otel_thread_ctx_attach`.
76
+ */
77
+ void ddog_otel_thread_ctx_update(const uint8_t (*trace_id)[16],
78
+ const uint8_t (*span_id)[8],
79
+ uint8_t trace_flags,
80
+ const uint8_t (*local_root_span_id)[8]);
81
+
82
+ #ifdef __cplusplus
83
+ } // extern "C"
84
+ #endif // __cplusplus
85
+
86
+ #endif /* DDOG_OTEL_THREAD_CTX_H */
@@ -2432,6 +2432,21 @@ typedef struct ddog_SharedRuntimeFFIError {
2432
2432
  char *msg;
2433
2433
  } ddog_SharedRuntimeFFIError;
2434
2434
 
2435
+ /**
2436
+ * Maximum size in bytes of the `attrs_data` field of a thread context record.
2437
+ */
2438
+ #define ddog_MAX_ATTRS_DATA_SIZE 612
2439
+
2440
+ /**
2441
+ * Opaque handle to a thread context record. Used to allow the FFI to convert [ThreadContext]
2442
+ * to and from raw pointers without exposing [ThreadContextRecord], as the latter needs extra
2443
+ * care to be manipulated (async-signal-safety, seq-lock-like modification protocol through
2444
+ * [ThreadContextRecord::valid], etc.)
2445
+ */
2446
+ typedef struct ddog_ThreadContextHandle {
2447
+
2448
+ } ddog_ThreadContextHandle;
2449
+
2435
2450
  typedef enum ddog_crasht_BuildIdType {
2436
2451
  DDOG_CRASHT_BUILD_ID_TYPE_GNU,
2437
2452
  DDOG_CRASHT_BUILD_ID_TYPE_GO,
@@ -0,0 +1,86 @@
1
+ // Copyright 2026-Present Datadog, Inc. https://www.datadoghq.com/
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+
5
+ #ifndef DDOG_OTEL_THREAD_CTX_H
6
+ #define DDOG_OTEL_THREAD_CTX_H
7
+
8
+ #pragma once
9
+
10
+ #include <stdbool.h>
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif // __cplusplus
17
+
18
+ #if defined(DDOG_OTEL_THREAD_CTX_SANITY_CHECK)
19
+ /**
20
+ * Verify that this binary was linked with the correct options such that the thread contexts are
21
+ * visible to an external reader (typically the eBPF profiler).
22
+ *
23
+ * Returns `VoidResult::Ok` if all checks pass, or a `VoidResult::Err` with a
24
+ * diagnostic message on failure.
25
+ */
26
+ struct ddog_VoidResult ddog_otel_thread_ctx_sanity_check(void);
27
+ #endif
28
+
29
+ /**
30
+ * Allocate and initialise a new thread context, including its W3C trace-flags byte.
31
+ *
32
+ * Returns a non-null owned handle that must eventually be released with
33
+ * `ddog_otel_thread_ctx_free`.
34
+ */
35
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_new(const uint8_t (*trace_id)[16],
36
+ const uint8_t (*span_id)[8],
37
+ uint8_t trace_flags,
38
+ const uint8_t (*local_root_span_id)[8]);
39
+
40
+ /**
41
+ * Free an owned thread context.
42
+ *
43
+ * # Safety
44
+ *
45
+ * `ctx` must be a valid non-null pointer obtained from `ddog_otel_thread_ctx_new` or
46
+ * `ddog_otel_thread_ctx_detach`, and must not be used after this call. In particular, `ctx`
47
+ * must not be currently attached to a thread.
48
+ */
49
+ void ddog_otel_thread_ctx_free(struct ddog_ThreadContextHandle *ctx);
50
+
51
+ /**
52
+ * Attach `ctx` to the current thread. Returns the previously attached context if any, or null
53
+ * otherwise.
54
+ *
55
+ * # Safety
56
+ *
57
+ * `ctx` must be a valid non-null pointer obtained from this API. Ownership of `ctx` is
58
+ * transferred to the TLS slot: the caller must not drop `ctx` while it is still actively
59
+ * attached.
60
+ */
61
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_attach(struct ddog_ThreadContextHandle *ctx);
62
+
63
+ /**
64
+ * Remove the currently attached context from the TLS slot.
65
+ *
66
+ * Returns the detached context (caller now owns it and must release it with
67
+ * `ddog_otel_thread_ctx_free`), or null if the slot was empty.
68
+ */
69
+ struct ddog_ThreadContextHandle *ddog_otel_thread_ctx_detach(void);
70
+
71
+ /**
72
+ * Update the currently attached context in-place, including its W3C trace-flags byte.
73
+ *
74
+ * If no context is currently attached, one is created and attached, equivalent to calling
75
+ * `ddog_otel_thread_ctx_new` followed by `ddog_otel_thread_ctx_attach`.
76
+ */
77
+ void ddog_otel_thread_ctx_update(const uint8_t (*trace_id)[16],
78
+ const uint8_t (*span_id)[8],
79
+ uint8_t trace_flags,
80
+ const uint8_t (*local_root_span_id)[8]);
81
+
82
+ #ifdef __cplusplus
83
+ } // extern "C"
84
+ #endif // __cplusplus
85
+
86
+ #endif /* DDOG_OTEL_THREAD_CTX_H */
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libdatadog
3
3
  version: !ruby/object:Gem::Version
4
- version: 40.0.0.1.0
4
+ version: 40.0.0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datadog, Inc.
@@ -40,6 +40,7 @@ files:
40
40
  - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/ffe.h
41
41
  - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/library-config.h
42
42
  - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/log.h
43
+ - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/otel-thread-ctx.h
43
44
  - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/profiling.h
44
45
  - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/shared-runtime.h
45
46
  - vendor/libdatadog-40.0.0/aarch64-linux-musl/include/datadog/telemetry.h
@@ -57,6 +58,7 @@ files:
57
58
  - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/ffe.h
58
59
  - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/library-config.h
59
60
  - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/log.h
61
+ - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/otel-thread-ctx.h
60
62
  - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/profiling.h
61
63
  - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/shared-runtime.h
62
64
  - vendor/libdatadog-40.0.0/aarch64-linux/include/datadog/telemetry.h
@@ -74,6 +76,7 @@ files:
74
76
  - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/ffe.h
75
77
  - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/library-config.h
76
78
  - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/log.h
79
+ - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/otel-thread-ctx.h
77
80
  - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/profiling.h
78
81
  - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/shared-runtime.h
79
82
  - vendor/libdatadog-40.0.0/arm64-darwin/include/datadog/telemetry.h
@@ -91,6 +94,7 @@ files:
91
94
  - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/ffe.h
92
95
  - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/library-config.h
93
96
  - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/log.h
97
+ - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/otel-thread-ctx.h
94
98
  - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/profiling.h
95
99
  - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/shared-runtime.h
96
100
  - vendor/libdatadog-40.0.0/x86_64-linux-musl/include/datadog/telemetry.h
@@ -108,6 +112,7 @@ files:
108
112
  - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/ffe.h
109
113
  - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/library-config.h
110
114
  - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/log.h
115
+ - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/otel-thread-ctx.h
111
116
  - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/profiling.h
112
117
  - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/shared-runtime.h
113
118
  - vendor/libdatadog-40.0.0/x86_64-linux/include/datadog/telemetry.h