From 448ef3aca1bda0d37fd1acad088f9ceb7e95dae9 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 29 Nov 2020 11:25:38 +0300 Subject: [PATCH 1/3] Send info about official build, memory and cpu to Sentry --- base/daemon/SentryWriter.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/base/daemon/SentryWriter.cpp b/base/daemon/SentryWriter.cpp index 33f2b237dd5..5ab72f37a9c 100644 --- a/base/daemon/SentryWriter.cpp +++ b/base/daemon/SentryWriter.cpp @@ -6,10 +6,12 @@ #include #include +#include #include #include #include +#include #if !defined(ARCADIA_BUILD) # include "Common/config_version.h" @@ -31,11 +33,9 @@ bool anonymize = false; void setExtras() { - if (!anonymize) - { sentry_set_extra("server_name", sentry_value_new_string(getFQDNOrHostName().c_str())); - } + sentry_set_tag("version", VERSION_STRING); sentry_set_extra("version_githash", sentry_value_new_string(VERSION_GITHASH)); sentry_set_extra("version_describe", sentry_value_new_string(VERSION_DESCRIBE)); @@ -44,6 +44,10 @@ void setExtras() sentry_set_extra("version_major", sentry_value_new_int32(VERSION_MAJOR)); sentry_set_extra("version_minor", sentry_value_new_int32(VERSION_MINOR)); sentry_set_extra("version_patch", sentry_value_new_int32(VERSION_PATCH)); + sentry_set_extra("version_official", sentry_value_new_string(VERSION_OFFICIAL)); + + sentry_set_extra("total_ram", sentry_value_new_string(formatReadableSizeWithBinarySuffix(getMemoryAmountOrZero()).c_str())); + sentry_set_extra("physical_cpu_cores", sentry_value_new_int32(getNumberOfPhysicalCPUCores())); } void sentry_logger(sentry_level_e level, const char * message, va_list args, void *) From a8937ca792005c0aea71fe7eaabb1c792f7725f7 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 29 Nov 2020 11:31:06 +0300 Subject: [PATCH 2/3] Send info about official build, memory and cpu to Sentry --- base/daemon/SentryWriter.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/base/daemon/SentryWriter.cpp b/base/daemon/SentryWriter.cpp index 5ab72f37a9c..c5d7e4b1293 100644 --- a/base/daemon/SentryWriter.cpp +++ b/base/daemon/SentryWriter.cpp @@ -30,6 +30,7 @@ namespace bool initialized = false; bool anonymize = false; +std::string server_data_path; void setExtras() { @@ -48,6 +49,10 @@ void setExtras() sentry_set_extra("total_ram", sentry_value_new_string(formatReadableSizeWithBinarySuffix(getMemoryAmountOrZero()).c_str())); sentry_set_extra("physical_cpu_cores", sentry_value_new_int32(getNumberOfPhysicalCPUCores())); + + if (!server_data_path.empty()) + sentry_set_extra("disk_free_space", sentry_value_new_string(formatReadableSizeWithBinarySuffix( + Poco::File(server_data_path).freeSpace()).c_str())); } void sentry_logger(sentry_level_e level, const char * message, va_list args, void *) @@ -102,6 +107,7 @@ void SentryWriter::initialize(Poco::Util::LayeredConfiguration & config) } if (enabled) { + server_data_path = config.getString("path", ""); const std::filesystem::path & default_tmp_path = std::filesystem::path(config.getString("tmp_path", Poco::Path::temp())) / "sentry"; const std::string & endpoint = config.getString("send_crash_reports.endpoint"); From c516b96b00adf2d04bf65445875d957b6fe8d6fd Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 29 Nov 2020 11:34:42 +0300 Subject: [PATCH 3/3] Add comment --- base/daemon/SentryWriter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/base/daemon/SentryWriter.cpp b/base/daemon/SentryWriter.cpp index c5d7e4b1293..b8f2e5073ab 100644 --- a/base/daemon/SentryWriter.cpp +++ b/base/daemon/SentryWriter.cpp @@ -47,6 +47,7 @@ void setExtras() sentry_set_extra("version_patch", sentry_value_new_int32(VERSION_PATCH)); sentry_set_extra("version_official", sentry_value_new_string(VERSION_OFFICIAL)); + /// Sentry does not support 64-bit integers. sentry_set_extra("total_ram", sentry_value_new_string(formatReadableSizeWithBinarySuffix(getMemoryAmountOrZero()).c_str())); sentry_set_extra("physical_cpu_cores", sentry_value_new_int32(getNumberOfPhysicalCPUCores()));