Skip to content

Commit 36a7f56

Browse files
authored
DOC-13396 Product Change- PR #144414 - structlogging: conditionally log hot ranges if the node is burdened (#19759)
* In logging-use-cases.md, added Hot ranges stats example. * Incorporated Brian’s feedback. * Incorporated Mike’s feedback.
1 parent b31bf17 commit 36a7f56

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/current/v25.2/logging-use-cases.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ I210517 17:38:20.403619 586 2@util/log/event_log.go:32 ⋮ [n1] 168 ={"Timestamp
9494
`runtime_stats` events are typically used for troubleshooting. To monitor your cluster's health, see [Monitoring and Alerting]({% link {{ page.version.version }}/monitoring-and-alerting.md %}).
9595
{{site.data.alerts.end}}
9696
97+
#### Example: Hot ranges stats
98+
99+
Each node checks for [hot ranges]({% link {{ page.version.version }}/understand-hotspots.md %}#hot-range) every minute. If a single [replica]({% link {{ page.version.version }}/architecture/overview.md %}#replica) exceeds 250 ms of CPU time per second, a [`hot_ranges_stats`]({% link {{ page.version.version }}/eventlog.md %}#hot_ranges_stats) event is recorded. In [virtual clusters]({% link {{ page.version.version }}/cluster-virtualization-overview.md %}) and [CockroachDB Standard and Basic deployments]({% link cockroachcloud/index.md %}), nodes perform this check every 5 minutes at the cluster level. In addition to these conditional logs, `hot_ranges_stats` logs are automatically emitted every 4 hours.
100+
101+
~~~
102+
I250602 04:46:54.752464 2023 2@util/log/event_log.go:39 ⋮ [T1,Vsystem,n5] 31977 ={"Timestamp":1748839613749807000,"EventType":"hot_ranges_stats","RangeID":1115,"Qps":0,"LeaseholderNodeID":5,"WritesPerSecond":0.0012048123820978134,"CPUTimePerSecond":251.30338109510822,"Databases":["kv"],"Tables":["kv"],"Indexes":["kv_pkey"]}
103+
~~~
104+
105+
- Preceding the `=` character is the `crdb-v2` event metadata. See the [reference documentation]({% link {{ page.version.version }}/log-formats.md %}#format-crdb-v2) for details on the fields.
106+
107+
{{site.data.alerts.callout_info}}
108+
`hot_ranges_stats` events are typically used for troubleshooting [hotspots]({% link {{ page.version.version }}/understand-hotspots.md %}).
109+
{{site.data.alerts.end}}
110+
97111
### SQL_SCHEMA
98112
99113
The [`SQL_SCHEMA`]({% link {{ page.version.version }}/logging.md %}#sql_schema) channel logs changes to the SQL logical schema resulting from DDL operations.

src/current/v25.3/logging-use-cases.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ I210517 17:38:20.403619 586 2@util/log/event_log.go:32 ⋮ [n1] 168 ={"Timestamp
9494
`runtime_stats` events are typically used for troubleshooting. To monitor your cluster's health, see [Monitoring and Alerting]({% link {{ page.version.version }}/monitoring-and-alerting.md %}).
9595
{{site.data.alerts.end}}
9696
97+
#### Example: Hot ranges stats
98+
99+
Each node checks for [hot ranges]({% link {{ page.version.version }}/understand-hotspots.md %}#hot-range) every minute. If a single [replica]({% link {{ page.version.version }}/architecture/overview.md %}#replica) exceeds 250 ms of CPU time per second, a [`hot_ranges_stats`]({% link {{ page.version.version }}/eventlog.md %}#hot_ranges_stats) event is recorded. In [virtual clusters]({% link {{ page.version.version }}/cluster-virtualization-overview.md %}) and [CockroachDB Standard and Basic deployments]({% link cockroachcloud/index.md %}), nodes perform this check every 5 minutes at the cluster level. In addition to these conditional logs, `hot_ranges_stats` logs are automatically emitted every 4 hours.
100+
101+
~~~
102+
I250602 04:46:54.752464 2023 2@util/log/event_log.go:39 ⋮ [T1,Vsystem,n5] 31977 ={"Timestamp":1748839613749807000,"EventType":"hot_ranges_stats","RangeID":1115,"Qps":0,"LeaseholderNodeID":5,"WritesPerSecond":0.0012048123820978134,"CPUTimePerSecond":251.30338109510822,"Databases":["kv"],"Tables":["kv"],"Indexes":["kv_pkey"]}
103+
~~~
104+
105+
- Preceding the `=` character is the `crdb-v2` event metadata. See the [reference documentation]({% link {{ page.version.version }}/log-formats.md %}#format-crdb-v2) for details on the fields.
106+
107+
{{site.data.alerts.callout_info}}
108+
`hot_ranges_stats` events are typically used for troubleshooting [hotspots]({% link {{ page.version.version }}/understand-hotspots.md %}).
109+
{{site.data.alerts.end}}
110+
97111
### SQL_SCHEMA
98112
99113
The [`SQL_SCHEMA`]({% link {{ page.version.version }}/logging.md %}#sql_schema) channel logs changes to the SQL logical schema resulting from DDL operations.

0 commit comments

Comments
 (0)