Skip to content

Commit

Permalink
log,allocatorimpl: log allocation messages to a separate log file
Browse files Browse the repository at this point in the history
The allocator logs are written to the main log file, which means that
those messages sometimes spam the main log, and also, we can't increase
verbosity much. Because of that most allocation logs are now under a
vlog and therefore rarely used.

This PR moves all allocation logs to a separate channel.

The next step would be to move some log messages from vlog to be
printed always, which should help debugging.

Note that some unit tests were relying on VEventf tracing, even when vmodule
is not enabled, instead we now explicitly set vmodule in those tests.

Step 1 for #82836.

Release note: None
  • Loading branch information
lidorcarmel committed Aug 9, 2022
1 parent 24906bd commit f5e8b0d
Show file tree
Hide file tree
Showing 18 changed files with 474 additions and 162 deletions.
4 changes: 4 additions & 0 deletions docs/generated/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,7 @@ The `TELEMETRY` channel reports telemetry events. Telemetry events describe
feature usage within CockroachDB and anonymizes any application-
specific data.

### `ALLOCATOR`

The `ALLOCATOR` channel is used to report allocation and rebalancing events.

1 change: 1 addition & 0 deletions pkg/cli/log_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ func addPredefinedLogFiles(c *logconfig.Config) {
const predefinedLogFiles = `
sinks:
file-groups:
allocator: { channels: ALLOCATOR }
default:
channels:
INFO: [DEV, OPS]
Expand Down
78 changes: 52 additions & 26 deletions pkg/cli/testdata/logflags
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ start
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -27,7 +28,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -49,7 +51,8 @@ start-single-node
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -61,7 +64,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand Down Expand Up @@ -148,7 +152,8 @@ start
config: {<stdFileDefaults(/pathA/logs)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],/pathA/logs,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -160,7 +165,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],/pathA/logs,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],/pathA/logs,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],/pathA/logs,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],/pathA/logs,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -184,7 +190,8 @@ start
config: {<stdFileDefaults(/mypath)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],/mypath,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -196,7 +203,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],/mypath,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],/mypath,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],/mypath,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],/mypath,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -221,7 +229,8 @@ start
config: {<stdFileDefaults(/pathA/logs)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],/pathA/logs,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -233,7 +242,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],/pathA/logs,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],/pathA/logs,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],/pathA/logs,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],/pathA/logs,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand Down Expand Up @@ -263,7 +273,8 @@ start
config: {<stdFileDefaults(/mypath)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],/mypath,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -275,7 +286,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],/mypath,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],/mypath,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],/mypath,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],/mypath,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -298,7 +310,8 @@ start
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -310,7 +323,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -334,7 +348,8 @@ start
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -346,7 +361,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand Down Expand Up @@ -379,7 +395,8 @@ start
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -391,7 +408,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand Down Expand Up @@ -447,7 +465,8 @@ start
config: {<stdFileDefaults(/mypath)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],/mypath,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -459,7 +478,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],/mypath,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],/mypath,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],/mypath,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],/mypath,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -484,7 +504,8 @@ start
config: {<stdFileDefaults(/pathA)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],/pathA,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -496,7 +517,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],/pathA,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],/pathA,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],/pathA,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],/pathA,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand Down Expand Up @@ -540,7 +562,8 @@ start
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -552,7 +575,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand All @@ -575,7 +599,8 @@ start
config: {<stdFileDefaults(<defaultLogDir>)>,
<fluentDefaults>,
<httpDefaults>,
sinks: {file-groups: {default: <fileCfg(INFO: [DEV,
sinks: {file-groups: {allocator: <fileCfg(INFO: [ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
default: <fileCfg(INFO: [DEV,
OPS],
WARNING: [HEALTH,
STORAGE,
Expand All @@ -587,7 +612,8 @@ SENSITIVE_ACCESS,
SQL_EXEC,
SQL_PERF,
SQL_INTERNAL_PERF,
TELEMETRY],<defaultLogDir>,true,crdb-v2)>,
TELEMETRY,
ALLOCATOR],<defaultLogDir>,true,crdb-v2)>,
health: <fileCfg(INFO: [HEALTH],<defaultLogDir>,true,crdb-v2)>,
pebble: <fileCfg(INFO: [STORAGE],<defaultLogDir>,true,crdb-v2)>,
security: <fileCfg(INFO: [USER_ADMIN,
Expand Down
Loading

0 comments on commit f5e8b0d

Please sign in to comment.