Commit 17caf47b authored by rpereira2's avatar rpereira2

Do not use value arg to hold chart type

According to snowplow docs, value has to be an Int or Float.
parent 5f6eabd1
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
def track_panel_type(panel) def track_panel_type(panel)
panel_type = panel[:type] 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 end
end end
......
...@@ -14,10 +14,14 @@ RSpec.describe Gitlab::Metrics::Dashboard::Stages::TrackPanelType do ...@@ -14,10 +14,14 @@ RSpec.describe Gitlab::Metrics::Dashboard::Stages::TrackPanelType do
let(:dashboard) { load_sample_dashboard.deep_symbolize_keys } let(:dashboard) { load_sample_dashboard.deep_symbolize_keys }
it 'creates tracking event' do it 'creates tracking event' do
expect(Gitlab::Tracking).to receive(:event).with('MetricsDashboard::Chart', 'chart_rendered', stub_application_setting(snowplow_enabled: true, snowplow_collector_hostname: 'localhost')
{ label: 'Chart Type', value: 'area-chart' }).at_least(:once) allow(Gitlab::Tracking).to receive(:event).and_call_original
subject.transform! subject.transform!
expect(Gitlab::Tracking).to have_received(:event)
.with('MetricsDashboard::Chart', 'chart_rendered', { label: 'area-chart' })
.at_least(:once)
end end
end end
end end
...@@ -58,11 +58,13 @@ RSpec.describe Metrics::Dashboard::CustomDashboardService, :use_clean_rails_memo ...@@ -58,11 +58,13 @@ RSpec.describe Metrics::Dashboard::CustomDashboardService, :use_clean_rails_memo
end end
it 'tracks panel type' do it 'tracks panel type' do
expect(::Gitlab::Tracking).to receive(:event).with( allow(::Gitlab::Tracking).to receive(:event).and_call_original
'MetricsDashboard::Chart', 'chart_rendered', { label: 'Chart Type', value: 'area-chart' }
).at_least(:once)
described_class.new(*service_params).get_dashboard 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 end
context 'and the dashboard is then deleted' do 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