Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
90c51c30
Commit
90c51c30
authored
Jul 31, 2021
by
Felipe Artur
Committed by
Michael Kozono
Jul 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitlab::Json to record action cable payload size
parent
60909276
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
lib/gitlab/metrics/subscribers/action_cable.rb
lib/gitlab/metrics/subscribers/action_cable.rb
+1
-1
spec/lib/gitlab/metrics/subscribers/action_cable_spec.rb
spec/lib/gitlab/metrics/subscribers/action_cable_spec.rb
+1
-1
No files found.
lib/gitlab/metrics/subscribers/action_cable.rb
View file @
90c51c30
...
@@ -28,7 +28,7 @@ module Gitlab
...
@@ -28,7 +28,7 @@ module Gitlab
if
event
.
payload
.
present?
if
event
.
payload
.
present?
channel
=
event
.
payload
[
:channel_class
]
channel
=
event
.
payload
[
:channel_class
]
operation
=
operation_name_from
(
event
.
payload
)
operation
=
operation_name_from
(
event
.
payload
)
data_size
=
::
ActiveSupport
::
JSON
.
encod
e
(
event
.
payload
[
:data
]).
bytesize
data_size
=
Gitlab
::
Json
.
generat
e
(
event
.
payload
[
:data
]).
bytesize
transmitted_bytes_histogram
.
observe
({
channel:
channel
,
operation:
operation
},
data_size
)
transmitted_bytes_histogram
.
observe
({
channel:
channel
,
operation:
operation
},
data_size
)
end
end
...
...
spec/lib/gitlab/metrics/subscribers/action_cable_spec.rb
View file @
90c51c30
...
@@ -40,7 +40,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActionCable, :request_store do
...
@@ -40,7 +40,7 @@ RSpec.describe Gitlab::Metrics::Subscribers::ActionCable, :request_store do
allow
(
::
Gitlab
::
Metrics
).
to
receive
(
:histogram
).
with
(
allow
(
::
Gitlab
::
Metrics
).
to
receive
(
:histogram
).
with
(
:action_cable_transmitted_bytes
,
/transmit/
:action_cable_transmitted_bytes
,
/transmit/
).
and_return
(
counter
)
).
and_return
(
counter
)
message_size
=
::
ActiveSupport
::
JSON
.
encod
e
(
data
).
bytesize
message_size
=
::
Gitlab
::
Json
.
generat
e
(
data
).
bytesize
expect
(
counter
).
to
receive
(
:observe
).
with
({
channel:
channel_class
,
operation:
'event'
},
message_size
)
expect
(
counter
).
to
receive
(
:observe
).
with
({
channel:
channel_class
,
operation:
'event'
},
message_size
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment