Commit bdf0f246 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'normalize-actioncable-empty-logging-params' into 'master'

Normalize empty params in ActionCable logging

See merge request gitlab-org/gitlab!42804
parents 6d625f98 bbc16e2c
...@@ -17,6 +17,13 @@ unless Gitlab::Runtime.sidekiq? ...@@ -17,6 +17,13 @@ unless Gitlab::Runtime.sidekiq?
data[:duration_s] = Gitlab::Utils.ms_to_round_sec(data.delete(:duration)) if data[:duration] data[:duration_s] = Gitlab::Utils.ms_to_round_sec(data.delete(:duration)) if data[:duration]
data.merge!(::Gitlab::Metrics::Subscribers::ActiveRecord.db_counter_payload) data.merge!(::Gitlab::Metrics::Subscribers::ActiveRecord.db_counter_payload)
# Remove empty hashes to prevent type mismatches
# These are set to empty hashes in Lograge's ActionCable subscriber
# https://github.com/roidrage/lograge/blob/v0.11.2/lib/lograge/log_subscribers/action_cable.rb#L14-L16
%i(method path format).each do |key|
data[key] = nil if data[key] == {}
end
data data
end end
......
...@@ -100,9 +100,9 @@ The ActionCable connection or channel class is used as the `controller`. ...@@ -100,9 +100,9 @@ The ActionCable connection or channel class is used as the `controller`.
```json ```json
{ {
"method":{}, "method":null,
"path":{}, "path":null,
"format":{}, "format":null,
"controller":"IssuesChannel", "controller":"IssuesChannel",
"action":"subscribe", "action":"subscribe",
"status":200, "status":200,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment