Skip to content

Commit 8984269

Browse files
committed
feat: add tests for trace-to-profile correlation
* test/test_tracer.cpp
1 parent 2367003 commit 8984269

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/test_tracer.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,32 @@ TEST_CASE("128-bit trace IDs") {
15661566
REQUIRE(*high == trace_id.high);
15671567
}
15681568

1569+
#ifdef __linux__
1570+
TEST_CASE("correlate full host profiles") {
1571+
TracerConfig config;
1572+
config.service = "testsvc";
1573+
config.collector = std::make_shared<NullCollector>();
1574+
config.logger = std::make_shared<NullLogger>();
1575+
1576+
SECTION("is off by default") {
1577+
auto finalized_config = finalize_config(config);
1578+
REQUIRE(finalized_config);
1579+
Tracer tracer{*finalized_config};
1580+
REQUIRE(elastic_apm_profiling_correlation_process_storage_v1 == nullptr);
1581+
}
1582+
1583+
SECTION("is available when enabled") {
1584+
config.correlate_full_host_profiles = true;
1585+
auto finalized_config = finalize_config(config);
1586+
REQUIRE(finalized_config);
1587+
Tracer tracer{*finalized_config};
1588+
REQUIRE(elastic_apm_profiling_correlation_process_storage_v1 != nullptr);
1589+
auto span = tracer.create_span();
1590+
REQUIRE(elastic_apm_profiling_correlation_tls_v1 != nullptr);
1591+
}
1592+
}
1593+
#endif
1594+
15691595
TEST_CASE(
15701596
"_dd.p.tid invalid or inconsistent with trace ID results in error tag") {
15711597
struct TestCase {

0 commit comments

Comments
 (0)