diff --git a/cmake/Findlibdatadog.cmake b/cmake/Findlibdatadog.cmake index 69920f3f..17ff522f 100644 --- a/cmake/Findlibdatadog.cmake +++ b/cmake/Findlibdatadog.cmake @@ -4,7 +4,7 @@ # libdatadog : common profiler imported libraries https://github.com/DataDog/libdatadog/releases set(TAG_LIBDATADOG - "v26.0.0" + "v28.0.0" CACHE STRING "libdatadog github tag") set(Datadog_ROOT ${VENDOR_PATH}/libdatadog-${TAG_LIBDATADOG}) diff --git a/src/exporter/ddprof_exporter.cc b/src/exporter/ddprof_exporter.cc index 7e60296d..dbda6bd6 100644 --- a/src/exporter/ddprof_exporter.cc +++ b/src/exporter/ddprof_exporter.cc @@ -263,10 +263,11 @@ DDRes ddprof_exporter_new(const UserTags *user_tags, DDProfExporter *exporter) { ddog_CharSlice const base_url = to_CharSlice(exporter->_url); ddog_prof_Endpoint endpoint; if (exporter->_agent) { - endpoint = ddog_prof_Endpoint_agent(base_url, k_timeout_ms); + endpoint = ddog_prof_Endpoint_agent(base_url, k_timeout_ms, false); } else { ddog_CharSlice const api_key = to_CharSlice(exporter->_input.api_key); - endpoint = ddog_prof_Endpoint_agentless(base_url, api_key, k_timeout_ms); + endpoint = + ddog_prof_Endpoint_agentless(base_url, api_key, k_timeout_ms, false); } ddog_prof_ProfileExporter_Result res_exporter = ddog_prof_Exporter_new( diff --git a/src/pprof/ddprof_pprof.cc b/src/pprof/ddprof_pprof.cc index 66f7c573..2b36f921 100644 --- a/src/pprof/ddprof_pprof.cc +++ b/src/pprof/ddprof_pprof.cc @@ -167,15 +167,42 @@ DDRes get_active_ids(std::span watchers, ActiveIdsResult &result) { return {}; } -class ProfValueTypes { +ddog_prof_SampleType to_ddog_sample_type(int sample_type_id, + EventAggregationModePos pos) { + if (pos == kSumPos) { + switch (sample_type_id) { + case DDPROF_PWT_CPU_NANOS: + return DDOG_PROF_SAMPLE_TYPE_CPU_TIME; + case DDPROF_PWT_CPU_SAMPLE: + return DDOG_PROF_SAMPLE_TYPE_CPU_SAMPLES; + case DDPROF_PWT_ALLOC_SAMPLE: + return DDOG_PROF_SAMPLE_TYPE_ALLOC_SAMPLES; + case DDPROF_PWT_ALLOC_SPACE: + return DDOG_PROF_SAMPLE_TYPE_ALLOC_SPACE; + default: + return DDOG_PROF_SAMPLE_TYPE_SAMPLE; + } + } + // Live aggregation + switch (sample_type_id) { + case DDPROF_PWT_ALLOC_SAMPLE: + return DDOG_PROF_SAMPLE_TYPE_INUSE_OBJECTS; + case DDPROF_PWT_ALLOC_SPACE: + return DDOG_PROF_SAMPLE_TYPE_INUSE_SPACE; + default: + return DDOG_PROF_SAMPLE_TYPE_SAMPLE; + } +} + +class ProfSampleTypes { private: int watcher_type_to_pprof_indices[DDPROF_PWT_LENGTH] [kNbEventAggregationModes]; - ddog_prof_ValueType perf_value_type[k_max_value_types] = {}; + ddog_prof_SampleType sample_types[k_max_value_types] = {}; int num_sample_type_ids = 0; public: - ProfValueTypes() { + ProfSampleTypes() { for (auto &indices : watcher_type_to_pprof_indices) { for (auto &index : indices) { index = -1; @@ -187,10 +214,8 @@ class ProfValueTypes { watcher_type_to_pprof_indices[watcher_type][pos] = value; } - void add_value_type(const char *name, const char *unit, int watcher_type, - EventAggregationModePos pos) { - perf_value_type[num_sample_type_ids].type_ = to_CharSlice(name); - perf_value_type[num_sample_type_ids].unit = to_CharSlice(unit); + void add_sample_type(int watcher_type, EventAggregationModePos pos) { + sample_types[num_sample_type_ids] = to_ddog_sample_type(watcher_type, pos); set_index(watcher_type, pos, num_sample_type_ids); ++num_sample_type_ids; } @@ -204,14 +229,14 @@ class ProfValueTypes { return num_sample_type_ids; } - [[nodiscard]] ddog_prof_Slice_ValueType get_sample_types_slice() const { - return {.ptr = perf_value_type, + [[nodiscard]] ddog_prof_Slice_SampleType get_sample_types_slice() const { + return {.ptr = sample_types, .len = static_cast(num_sample_type_ids)}; } }; -ProfValueTypes compute_pprof_values(const ActiveIdsResult &active_ids) { - ProfValueTypes result{}; +ProfSampleTypes compute_pprof_values(const ActiveIdsResult &active_ids) { + ProfSampleTypes result{}; for (int i = 0; i < DDPROF_PWT_LENGTH; ++i) { if (active_ids.output_mode[i] == EventAggregationMode::kDisabled) { continue; @@ -222,13 +247,12 @@ ProfValueTypes compute_pprof_values(const ActiveIdsResult &active_ids) { static_cast(1 << value_pos))) { const char *value_name = sample_type_name_from_idx( i, static_cast(value_pos)); - const char *value_unit = sample_type_unit_from_idx(i); - if (!value_name || !value_unit) { + if (!value_name) { LG_WRN("Malformed sample type (%d), ignoring", i); continue; } - result.add_value_type(value_name, value_unit, i, - static_cast(value_pos)); + result.add_sample_type(i, + static_cast(value_pos)); } } } @@ -400,9 +424,9 @@ DDRes pprof_create_profile(DDProfPProf *pprof, DDProfContext &ctx) { static_cast(active_ids.output_mode[i])); } #endif - // Based on active IDs, prepare the list pf pprof values + // Based on active IDs, prepare the list of pprof values // pprof_values should stay alive while we create the pprof - const ProfValueTypes pprof_values = compute_pprof_values(active_ids); + const ProfSampleTypes pprof_values = compute_pprof_values(active_ids); // Update each watcher with matching types for (unsigned i = 0; i < num_watchers; ++i) { @@ -427,9 +451,9 @@ DDRes pprof_create_profile(DDProfPProf *pprof, DDProfContext &ctx) { } pprof->_nb_values = pprof_values.get_num_sample_type_ids(); - const ddog_prof_Slice_ValueType sample_types = + const ddog_prof_Slice_SampleType sample_types = pprof_values.get_sample_types_slice(); - ddog_prof_Period period; + ddog_prof_Period period{}; if (pprof->_nb_values > 0) { if (!active_ids.default_watcher) { DDRES_RETURN_ERROR_LOG(DD_WHAT_PPROF, "Unable to find default watcher"); @@ -457,9 +481,8 @@ DDRes pprof_create_profile(DDProfPProf *pprof, DDProfContext &ctx) { DDRES_RETURN_ERROR_LOG(DD_WHAT_PPROF, "Unable to find default watcher's value"); } - // period is the default watcher's type. period = { - .type_ = sample_types.ptr[default_index], + .sample_type = sample_types.ptr[default_index], .value = default_period, }; } diff --git a/tools/libdatadog_checksums.txt b/tools/libdatadog_checksums.txt index a8b41386..7b3f05ee 100644 --- a/tools/libdatadog_checksums.txt +++ b/tools/libdatadog_checksums.txt @@ -1,6 +1,6 @@ -38b83da2781f20f004d278c077b071441f40671de2e0adf72f7e14e37b10db15 libdatadog-x86_64-apple-darwin.tar.gz -1420ba4970ff9158aec4bd8a80d139abe8c19cfd71ae31c6c518f8a2ad1416b8 libdatadog-aarch64-apple-darwin.tar.gz -1778bed8bb4ec5a63af792ed6d7b0acd2564e5c7633d9b65d7c715e7f8635743 libdatadog-x86_64-unknown-linux-gnu.tar.gz -c90bd4959026f7fddb9012036fdc5b1e49bdf57d716cb429cdde291af6108740 libdatadog-aarch64-alpine-linux-musl.tar.gz -c67ada4359cd6a806adafcb44043bc8fb0dffd463e3aa328856496e2883142ac libdatadog-aarch64-unknown-linux-gnu.tar.gz -394b13591400b36d90755bc9851be047e6d31813347ed9d0e2638355cc9617d4 libdatadog-x86_64-alpine-linux-musl.tar.gz +23ab09884eba1b651eb841c3eb99c858a9760d1dc27ea928624c9fbe65b163a0 libdatadog-x86_64-apple-darwin.tar.gz +f9d3042918a9962415e3a5e403a2dca5a1c17fe535e7be9a932ae8ba9a6f44da libdatadog-x86_64-alpine-linux-musl.tar.gz +9e2302d99d028316dd9f0f2e2deb39b49af9387f6c849035ce7b3ec68f8021cc libdatadog-aarch64-apple-darwin.tar.gz +26936f3b8c3371aa09ae0b0cd31649401671f845e9ab08980e37fe912dd9ad7c libdatadog-aarch64-unknown-linux-gnu.tar.gz +d53951629b0173d6cf7df0ed036e706041d73541c18bc738550f5fe33d1a825f libdatadog-x86_64-unknown-linux-gnu.tar.gz +766cbe5fb9633ec57e5f4199beb3bbb182763edb7ce9e8dce554976d488b3364 libdatadog-aarch64-alpine-linux-musl.tar.gz