Add option to remove metrics in logs

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Proposal

As of writing, the format of *_json logs include considerable amount of metrics like redis_calls, gitaly_duration_s, db_duration_s, etc). It would be useful for some customers who stream these logs to have reduced information being generated.

For example:

{
  "method":"GET",
  "path":"/gitlab/gitlab-foss/issues/1234",
  "format":"html",
  "controller":"Projects::IssuesController",
  "action":"show",
  "status":200,
  "time":"2017-08-08T20:15:54.821Z",
  "params":[{"key":"param_key","value":"param_value"}],
  "remote_ip":"18.245.0.1",
  "user_id":1,
  "username":"admin",
  "queue_duration_s":0.0,
  "gitaly_calls":16,
  "gitaly_duration_s":0.16,
  "redis_calls":115,
  "redis_duration_s":0.13,
  "redis_read_bytes":1507378,
  "redis_write_bytes":2920,
  "correlation_id":"O1SdybnnIq7",
  "cpu_s":17.50,
  "db_duration_s":0.08,
  "view_duration_s":2.39,
  "duration_s":20.54,
  "pid": 81836,
  "worker_id":"puma_0"
}

Can be reduced to:

{
  "method":"GET",
  "path":"/gitlab/gitlab-foss/issues/1234",
  "format":"html",
  "controller":"Projects::IssuesController",
  "action":"show",
  "status":200,
  "time":"2017-08-08T20:15:54.821Z",
  "params":[{"key":"param_key","value":"param_value"}],
  "remote_ip":"18.245.0.1",
  "user_id":1,
  "username":"admin",
  "correlation_id":"O1SdybnnIq7",
  "pid": 81836,
  "worker_id":"puma_0"
}

We can consider adding a new gitlab.rb parameter that can control this.

logging['metrics']
Edited by 🤖 GitLab Bot 🤖