Skip to content

Commit 76b851b

Browse files
Merge pull request ClickHouse#79838 from ClickHouse/send-crash-reports-by-default
Send crash reports by default
2 parents b3a683b + b65f225 commit 76b851b

File tree

4 files changed

+10
-24
lines changed

4 files changed

+10
-24
lines changed

programs/server/config.xml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,17 +1690,14 @@
16901690
-->
16911691

16921692
<send_crash_reports>
1693-
<!-- Changing <enabled> to true allows sending crash reports to -->
1693+
<!-- Setting <enabled> to true allows sending crash reports to -->
16941694
<!-- the ClickHouse core developers team via Sentry https://sentry.io -->
16951695
<!-- Doing so at least in pre-production environments is highly appreciated -->
1696-
<enabled>false</enabled>
1697-
<!-- Change <anonymize> to true if you don't feel comfortable attaching the server hostname to the crash report -->
1698-
<anonymize>false</anonymize>
1699-
<!-- Default endpoint should be changed to different Sentry DSN only if you have -->
1700-
<!-- some in-house engineers or hired consultants who're going to debug ClickHouse issues for you -->
1696+
<enabled>true</enabled>
1697+
<send_logical_errors>true</send_logical_errors>
1698+
<!-- The reports are anonymized by default -->
1699+
<anonymize>true</anonymize>
17011700
<endpoint>https://[email protected]/5226277</endpoint>
1702-
<!-- Send LOGICAL_ERRORs as well (default: false) -->
1703-
<send_logical_errors>false</send_logical_errors>
17041701
</send_crash_reports>
17051702

17061703
<!-- Uncomment to disable ClickHouse internal DNS caching. -->

src/Daemon/BaseDaemon.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,13 @@ extern const char * GIT_HASH;
414414
void BaseDaemon::initializeTerminationAndSignalProcessing()
415415
{
416416
SentryWriter::initializeInstance(config());
417-
if (config().getBool("send_crash_reports.send_logical_errors", false))
417+
if (config().getBool("send_crash_reports.enabled", false)
418+
&& config().getBool("send_crash_reports.send_logical_errors", false))
418419
{
419420
/// In release builds send it to sentry (if it is configured)
420421
if (auto * sentry = SentryWriter::getInstance())
421422
{
422-
LOG_DEBUG(&logger(), "Enable sending LOGICAL_ERRORs to sentry");
423+
LOG_DEBUG(&logger(), "Sending logical errors to sentry is enabled");
423424
Exception::callback = [sentry](const std::string & msg, int code, bool remote, const Exception::FramePointers & trace)
424425
{
425426
if (!remote && code == ErrorCodes::LOGICAL_ERROR)

src/Daemon/SentryWriter.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,9 @@ void SentryWriter::resetInstance()
7979

8080
SentryWriter::SentryWriter(Poco::Util::LayeredConfiguration & config)
8181
{
82-
bool enabled = false;
83-
bool debug = config.getBool("send_crash_reports.debug", false);
8482
auto logger = getLogger("SentryWriter");
8583

8684
if (config.getBool("send_crash_reports.enabled", false))
87-
{
88-
if (debug || (strlen(VERSION_OFFICIAL) > 0))
89-
enabled = true;
90-
}
91-
92-
if (enabled)
9385
{
9486
server_data_path = config.getString("path", DB::DBMS_DEFAULT_PATH);
9587
const std::filesystem::path & default_tmp_path = fs::path(config.getString("tmp_path", fs::temp_directory_path())) / "sentry";
@@ -101,10 +93,6 @@ SentryWriter::SentryWriter(Poco::Util::LayeredConfiguration & config)
10193

10294
sentry_options_t * options = sentry_options_new(); /// will be freed by sentry_init or sentry_shutdown
10395
sentry_options_set_release(options, VERSION_STRING_SHORT);
104-
if (debug)
105-
{
106-
sentry_options_set_debug(options, 1);
107-
}
10896
sentry_options_set_dsn(options, endpoint.c_str());
10997
sentry_options_set_database_path(options, temp_folder_path.c_str());
11098

tests/integration/test_temporary_data/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ def test_tmp_data_no_leftovers(start_cluster):
5555
node.restart_clickhouse(kill=True)
5656
path_to_data = "/var/lib/clickhouse/"
5757

58-
# Check that there are no temporary files left
59-
result = node.exec_in_container(["ls", path_to_data + "tmp/"])
58+
# Check that there are no temporary files left. Other than from the Sentry library.
59+
result = node.exec_in_container(["bash", "-c", f"ls -1 {path_to_data}tmp/ | grep -v 'sentry' ||:"])
6060
assert result == ""

0 commit comments

Comments
 (0)