Commit 78dc6025 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rp/fix-tracking-event-call' into 'master'

Do not use value arg to hold chart type

See merge request gitlab-org/gitlab!39725
parents 4cf93146 17caf47b
......@@ -18,7 +18,7 @@ module Gitlab
def track_panel_type(panel)
panel_type = panel[:type]
Gitlab::Tracking.event('MetricsDashboard::Chart', 'chart_rendered', label: 'Chart Type', value: panel_type)
Gitlab::Tracking.event('MetricsDashboard::Chart', 'chart_rendered', label: panel_type)
end
end
end
......
......@@ -14,10 +14,14 @@ RSpec.describe Gitlab::Metrics::Dashboard::Stages::TrackPanelType do
let(:dashboard) { load_sample_dashboard.deep_symbolize_keys }
it 'creates tracking event' do
expect(Gitlab::Tracking).to receive(:event).with('MetricsDashboard::Chart', 'chart_rendered',
{ label: 'Chart Type', value: 'area-chart' }).at_least(:once)
stub_application_setting(snowplow_enabled: true, snowplow_collector_hostname: 'localhost')
allow(Gitlab::Tracking).to receive(:event).and_call_original
subject.transform!
expect(Gitlab::Tracking).to have_received(:event)
.with('MetricsDashboard::Chart', 'chart_rendered', { label: 'area-chart' })
.at_least(:once)
end
end
end
......@@ -58,11 +58,13 @@ RSpec.describe Metrics::Dashboard::CustomDashboardService, :use_clean_rails_memo
end
it 'tracks panel type' do
expect(::Gitlab::Tracking).to receive(:event).with(
'MetricsDashboard::Chart', 'chart_rendered', { label: 'Chart Type', value: 'area-chart' }
).at_least(:once)
allow(::Gitlab::Tracking).to receive(:event).and_call_original
described_class.new(*service_params).get_dashboard
expect(::Gitlab::Tracking).to have_received(:event)
.with('MetricsDashboard::Chart', 'chart_rendered', { label: 'area-chart' })
.at_least(:once)
end
context 'and the dashboard is then deleted' do
......
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