mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #17543 from ClickHouse/sentry-official-cpu-ram
Sentry: send info about official build, memory, cpu and free disk space.
This commit is contained in:
commit
c0489ce537
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
#include <common/defines.h>
|
#include <common/defines.h>
|
||||||
#include <common/getFQDNOrHostName.h>
|
#include <common/getFQDNOrHostName.h>
|
||||||
|
#include <common/getMemoryAmount.h>
|
||||||
#include <common/logger_useful.h>
|
#include <common/logger_useful.h>
|
||||||
|
|
||||||
#include <Common/SymbolIndex.h>
|
#include <Common/SymbolIndex.h>
|
||||||
#include <Common/StackTrace.h>
|
#include <Common/StackTrace.h>
|
||||||
|
#include <Common/getNumberOfPhysicalCPUCores.h>
|
||||||
|
|
||||||
#if !defined(ARCADIA_BUILD)
|
#if !defined(ARCADIA_BUILD)
|
||||||
# include "Common/config_version.h"
|
# include "Common/config_version.h"
|
||||||
@ -28,14 +30,13 @@ namespace
|
|||||||
|
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
bool anonymize = false;
|
bool anonymize = false;
|
||||||
|
std::string server_data_path;
|
||||||
|
|
||||||
void setExtras()
|
void setExtras()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!anonymize)
|
if (!anonymize)
|
||||||
{
|
|
||||||
sentry_set_extra("server_name", sentry_value_new_string(getFQDNOrHostName().c_str()));
|
sentry_set_extra("server_name", sentry_value_new_string(getFQDNOrHostName().c_str()));
|
||||||
}
|
|
||||||
sentry_set_tag("version", VERSION_STRING);
|
sentry_set_tag("version", VERSION_STRING);
|
||||||
sentry_set_extra("version_githash", sentry_value_new_string(VERSION_GITHASH));
|
sentry_set_extra("version_githash", sentry_value_new_string(VERSION_GITHASH));
|
||||||
sentry_set_extra("version_describe", sentry_value_new_string(VERSION_DESCRIBE));
|
sentry_set_extra("version_describe", sentry_value_new_string(VERSION_DESCRIBE));
|
||||||
@ -44,6 +45,15 @@ void setExtras()
|
|||||||
sentry_set_extra("version_major", sentry_value_new_int32(VERSION_MAJOR));
|
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_minor", sentry_value_new_int32(VERSION_MINOR));
|
||||||
sentry_set_extra("version_patch", sentry_value_new_int32(VERSION_PATCH));
|
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()));
|
||||||
|
|
||||||
|
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 *)
|
void sentry_logger(sentry_level_e level, const char * message, va_list args, void *)
|
||||||
@ -98,6 +108,7 @@ void SentryWriter::initialize(Poco::Util::LayeredConfiguration & config)
|
|||||||
}
|
}
|
||||||
if (enabled)
|
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::filesystem::path & default_tmp_path = std::filesystem::path(config.getString("tmp_path", Poco::Path::temp())) / "sentry";
|
||||||
const std::string & endpoint
|
const std::string & endpoint
|
||||||
= config.getString("send_crash_reports.endpoint");
|
= config.getString("send_crash_reports.endpoint");
|
||||||
|
Loading…
Reference in New Issue
Block a user