File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 55#include < array>
66#include < cstdint>
77
8+ // Global struct used to exposed thread-specific information.
9+ // https://github.com/elastic/apm/blob/149cd3e39a77a58002344270ed2ad35357bdd02d/specs/agents/universal-profiling-integration.md#thread-local-storage-layout
10+
811namespace datadog {
912namespace tracing {
1013struct __attribute__ ((packed)) TLSStorage {
@@ -17,5 +20,6 @@ struct __attribute__((packed)) TLSStorage {
1720 uint64_t span_id;
1821 uint64_t transaction_id;
1922};
23+
2024} // namespace tracing
2125} // namespace datadog
Original file line number Diff line number Diff line change 1111// `tracer_config.h`.
1212
1313#include < datadog/tls_storage.h>
14- #include < threads.h>
1514
1615#include < cstddef>
1716#include < memory>
Original file line number Diff line number Diff line change 3333const void * elastic_apm_profiling_correlation_process_storage_v1 = nullptr ;
3434thread_local struct datadog ::tracing::TLSStorage*
3535 elastic_apm_profiling_correlation_tls_v1 = nullptr ;
36+ thread_local std::unique_ptr<datadog::tracing::TLSStorage> tls_info_holder =
37+ nullptr ;
3638
3739namespace datadog {
3840namespace tracing {
@@ -118,11 +120,9 @@ Tracer::Tracer(const FinalizedTracerConfig& config,
118120}
119121
120122void Tracer::correlate (const Span& span) {
121- // TODO: update this variablle with data
122- // See Layout:
123- // https://github.com/elastic/apm/blob/149cd3e39a77a58002344270ed2ad35357bdd02d/specs/agents/universal-profiling-integration.md#thread-local-storage-layout
124- auto tls_storage_ptr = std::make_unique<struct TLSStorage >();
125- elastic_apm_profiling_correlation_tls_v1 = tls_storage_ptr.get ();
123+ tls_info_holder = std::make_unique<datadog::tracing::TLSStorage>();
124+ elastic_apm_profiling_correlation_tls_v1 = tls_info_holder.get ();
125+
126126 struct TLSStorage * tls_data = elastic_apm_profiling_correlation_tls_v1;
127127 tls_data->valid = 0 ;
128128
You can’t perform that action at this time.
0 commit comments