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).
This commit is contained in:
Yorick Peterse 2015-12-31 17:55:10 +01:00
parent bd9f86bb8a
commit cafc784ee1
5 changed files with 2 additions and 19 deletions

View file

@ -1,6 +1,5 @@
if Gitlab::Metrics.enabled?
require 'influxdb'
require 'socket'
require 'connection_pool'
require 'method_source'

View file

@ -38,10 +38,6 @@ module Gitlab
@pool
end
def self.hostname
@hostname
end
# Returns a relative path and line number based on the last application call
# frame.
def self.last_relative_application_frame
@ -89,8 +85,6 @@ module Gitlab
value.to_s.gsub('=', '\\=')
end
@hostname = Socket.gethostname
# When enabled this should be set before being used as the usual pattern
# "@foo ||= bar" is _not_ thread-safe.
if enabled?

View file

@ -17,10 +17,8 @@ module Gitlab
# Returns a Hash in a format that can be directly written to InfluxDB.
def to_hash
{
series: @series,
tags: @tags.merge(
hostname: Metrics.hostname
),
series: @series,
tags: @tags,
values: @values,
timestamp: @created_at.to_i * 1_000_000_000
}

View file

@ -37,8 +37,6 @@ describe Gitlab::Metrics::Metric do
it 'includes the tags' do
expect(hash[:tags]).to be_an_instance_of(Hash)
expect(hash[:tags][:hostname]).to be_an_instance_of(String)
end
it 'includes the values' do

View file

@ -13,12 +13,6 @@ describe Gitlab::Metrics do
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
it 'returns an Array containing a file path and line number' do
file, line = described_class.last_relative_application_frame