Commit cafc784e authored by Yorick Peterse's avatar Yorick Peterse

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
if Gitlab::Metrics.enabled?
require 'influxdb'
require 'socket'
require 'connection_pool'
require 'method_source'
......
......@@ -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?
......
......@@ -18,9 +18,7 @@ module Gitlab
def to_hash
{
series: @series,
tags: @tags.merge(
hostname: Metrics.hostname
),
tags: @tags,
values: @values,
timestamp: @created_at.to_i * 1_000_000_000
}
......
......@@ -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
......
......@@ -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
......
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