Commit 364b07cf authored by Yorick Peterse's avatar Yorick Peterse

Removed UUIDs from metrics transactions

While useful for finding out what methods/views belong to a transaction
this might result in too much data being stored in InfluxDB.
parent da912c8f
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
class Transaction class Transaction
THREAD_KEY = :_gitlab_metrics_transaction THREAD_KEY = :_gitlab_metrics_transaction
attr_reader :uuid, :tags attr_reader :tags
def self.current def self.current
Thread.current[THREAD_KEY] Thread.current[THREAD_KEY]
...@@ -12,7 +12,6 @@ module Gitlab ...@@ -12,7 +12,6 @@ module Gitlab
def initialize def initialize
@metrics = [] @metrics = []
@uuid = SecureRandom.uuid
@started_at = nil @started_at = nil
@finished_at = nil @finished_at = nil
...@@ -38,7 +37,6 @@ module Gitlab ...@@ -38,7 +37,6 @@ module Gitlab
end end
def add_metric(series, values, tags = {}) def add_metric(series, values, tags = {})
tags = tags.merge(transaction_id: @uuid)
prefix = sidekiq? ? 'sidekiq_' : 'rails_' prefix = sidekiq? ? 'sidekiq_' : 'rails_'
@metrics << Metric.new("#{prefix}#{series}", values, tags) @metrics << Metric.new("#{prefix}#{series}", values, tags)
......
...@@ -30,9 +30,9 @@ describe Gitlab::Metrics::Transaction do ...@@ -30,9 +30,9 @@ describe Gitlab::Metrics::Transaction do
end end
describe '#add_metric' do describe '#add_metric' do
it 'adds a metric tagged with the transaction UUID' do it 'adds a metric to the transaction' do
expect(Gitlab::Metrics::Metric).to receive(:new). expect(Gitlab::Metrics::Metric).to receive(:new).
with('rails_foo', { number: 10 }, { transaction_id: transaction.uuid }) with('rails_foo', { number: 10 }, {})
transaction.add_metric('foo', number: 10) transaction.add_metric('foo', number: 10)
end end
......
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