Commit 54438ad0 authored by Ben Kochie's avatar Ben Kochie Committed by Ben Kochie

Clean up unicorn sampler metric labels

Change `type` and `address` labels to be less generic to avoid conflicts
with other systems.
parent 3f3067fc
---
title: Clean up unicorn sampler metric labels
merge_request: 24626
author: bjk-gitlab
type: fixed
...@@ -23,13 +23,13 @@ module Gitlab ...@@ -23,13 +23,13 @@ module Gitlab
def sample def sample
Raindrops::Linux.tcp_listener_stats(tcp_listeners).each do |addr, stats| Raindrops::Linux.tcp_listener_stats(tcp_listeners).each do |addr, stats|
unicorn_active_connections.set({ type: 'tcp', address: addr }, stats.active) unicorn_active_connections.set({ socket_type: 'tcp', socket_address: addr }, stats.active)
unicorn_queued_connections.set({ type: 'tcp', address: addr }, stats.queued) unicorn_queued_connections.set({ socket_type: 'tcp', socket_address: addr }, stats.queued)
end end
Raindrops::Linux.unix_listener_stats(unix_listeners).each do |addr, stats| Raindrops::Linux.unix_listener_stats(unix_listeners).each do |addr, stats|
unicorn_active_connections.set({ type: 'unix', address: addr }, stats.active) unicorn_active_connections.set({ socket_type: 'unix', socket_address: addr }, stats.active)
unicorn_queued_connections.set({ type: 'unix', address: addr }, stats.queued) unicorn_queued_connections.set({ socket_type: 'unix', socket_address: addr }, stats.queued)
end end
end end
......
...@@ -37,7 +37,7 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do ...@@ -37,7 +37,7 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do
end end
it 'updates metrics type unix and with addr' do it 'updates metrics type unix and with addr' do
labels = { type: 'unix', address: socket_address } labels = { socket_type: 'unix', socket_address: socket_address }
expect(subject).to receive_message_chain(:unicorn_active_connections, :set).with(labels, 'active') expect(subject).to receive_message_chain(:unicorn_active_connections, :set).with(labels, 'active')
expect(subject).to receive_message_chain(:unicorn_queued_connections, :set).with(labels, 'queued') expect(subject).to receive_message_chain(:unicorn_queued_connections, :set).with(labels, 'queued')
...@@ -69,7 +69,7 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do ...@@ -69,7 +69,7 @@ describe Gitlab::Metrics::Samplers::UnicornSampler do
end end
it 'updates metrics type unix and with addr' do it 'updates metrics type unix and with addr' do
labels = { type: 'tcp', address: tcp_socket_address } labels = { socket_type: 'tcp', socket_address: tcp_socket_address }
expect(subject).to receive_message_chain(:unicorn_active_connections, :set).with(labels, 'active') expect(subject).to receive_message_chain(:unicorn_active_connections, :set).with(labels, 'active')
expect(subject).to receive_message_chain(:unicorn_queued_connections, :set).with(labels, 'queued') expect(subject).to receive_message_chain(:unicorn_queued_connections, :set).with(labels, 'queued')
......
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