gitlab-org--gitlab-foss/spec/lib/gitlab/metrics/subscribers/action_view_spec.rb
Yorick Peterse 355c341fe7 Stop tracking call stacks for instrumented views
Where a vew is called from doesn't matter as much. We already know what
action they belong to and this is more than enough information. By
removing the file/line number from the list of tags we should also be
able to reduce the number of series stored in InfluxDB.
2016-01-12 15:41:22 +01:00

33 lines
846 B
Ruby

require 'spec_helper'
describe Gitlab::Metrics::Subscribers::ActionView do
let(:transaction) { Gitlab::Metrics::Transaction.new }
let(:subscriber) { described_class.new }
let(:event) do
root = Rails.root.to_s
double(:event, duration: 2.1,
payload: { identifier: "#{root}/app/views/x.html.haml" })
end
before do
allow(subscriber).to receive(:current_transaction).and_return(transaction)
end
describe '#render_template' do
it 'tracks rendering of a template' do
values = { duration: 2.1 }
tags = { view: 'app/views/x.html.haml' }
expect(transaction).to receive(:increment).
with(:view_duration, 2.1)
expect(transaction).to receive(:add_metric).
with(described_class::SERIES, values, tags)
subscriber.render_template(event)
end
end
end