Skip to content
Snippets Groups Projects
Commit cafc784e authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Removed tracking of hostnames for metrics

This isn't hugely useful and mostly wastes InfluxDB space. We can re-add
this whenever needed (but only once we really need it).
parent bd9f86bb
No related branches found
No related tags found
No related merge requests found
if Gitlab::Metrics.enabled? if Gitlab::Metrics.enabled?
require 'influxdb' require 'influxdb'
require 'socket'
require 'connection_pool' require 'connection_pool'
require 'method_source' require 'method_source'
   
Loading
Loading
Loading
@@ -38,10 +38,6 @@ module Gitlab
Loading
@@ -38,10 +38,6 @@ module Gitlab
@pool @pool
end end
   
def self.hostname
@hostname
end
# Returns a relative path and line number based on the last application call # Returns a relative path and line number based on the last application call
# frame. # frame.
def self.last_relative_application_frame def self.last_relative_application_frame
Loading
@@ -89,8 +85,6 @@ module Gitlab
Loading
@@ -89,8 +85,6 @@ module Gitlab
value.to_s.gsub('=', '\\=') value.to_s.gsub('=', '\\=')
end end
   
@hostname = Socket.gethostname
# When enabled this should be set before being used as the usual pattern # When enabled this should be set before being used as the usual pattern
# "@foo ||= bar" is _not_ thread-safe. # "@foo ||= bar" is _not_ thread-safe.
if enabled? if enabled?
Loading
Loading
Loading
@@ -17,10 +17,8 @@ module Gitlab
Loading
@@ -17,10 +17,8 @@ module Gitlab
# Returns a Hash in a format that can be directly written to InfluxDB. # Returns a Hash in a format that can be directly written to InfluxDB.
def to_hash def to_hash
{ {
series: @series, series: @series,
tags: @tags.merge( tags: @tags,
hostname: Metrics.hostname
),
values: @values, values: @values,
timestamp: @created_at.to_i * 1_000_000_000 timestamp: @created_at.to_i * 1_000_000_000
} }
Loading
Loading
Loading
@@ -37,8 +37,6 @@ describe Gitlab::Metrics::Metric do
Loading
@@ -37,8 +37,6 @@ describe Gitlab::Metrics::Metric do
   
it 'includes the tags' do it 'includes the tags' do
expect(hash[:tags]).to be_an_instance_of(Hash) expect(hash[:tags]).to be_an_instance_of(Hash)
expect(hash[:tags][:hostname]).to be_an_instance_of(String)
end end
   
it 'includes the values' do it 'includes the values' do
Loading
Loading
Loading
@@ -13,12 +13,6 @@ describe Gitlab::Metrics do
Loading
@@ -13,12 +13,6 @@ describe Gitlab::Metrics do
end end
end end
   
describe '.hostname' do
it 'returns a String containing the hostname' do
expect(described_class.hostname).to eq(Socket.gethostname)
end
end
describe '.last_relative_application_frame' do describe '.last_relative_application_frame' do
it 'returns an Array containing a file path and line number' do it 'returns an Array containing a file path and line number' do
file, line = described_class.last_relative_application_frame file, line = described_class.last_relative_application_frame
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment