Commit 90c51c30 authored by Felipe Artur's avatar Felipe Artur Committed by Michael Kozono

Use Gitlab::Json to record action cable payload size

parent 60909276
......@@ -28,7 +28,7 @@ module Gitlab
if event.payload.present?
channel = event.payload[:channel_class]
operation = operation_name_from(event.payload)
data_size = ::ActiveSupport::JSON.encode(event.payload[:data]).bytesize
data_size = Gitlab::Json.generate(event.payload[:data]).bytesize
transmitted_bytes_histogram.observe({ channel: channel, operation: operation }, data_size)
end
......
......@@ -40,7 +40,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActionCable, :request_store do
allow(::Gitlab::Metrics).to receive(:histogram).with(
:action_cable_transmitted_bytes, /transmit/
).and_return(counter)
message_size = ::ActiveSupport::JSON.encode(data).bytesize
message_size = ::Gitlab::Json.generate(data).bytesize
expect(counter).to receive(:observe).with({ channel: channel_class, operation: 'event' }, message_size)
......
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