Commit 8cfe7d61 authored by Mikołaj Wawrzyniak's avatar Mikołaj Wawrzyniak

Merge branch 'ali/update-ordering-of-standardcontext' into 'master'

Ensure that `gitlab_standard` comes first in the list of contexts

See merge request gitlab-org/gitlab!55920
parents a52f1b6f 1f1ace5e
......@@ -25,10 +25,10 @@ module Gitlab
end
def event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil) # rubocop:disable Metrics/ParameterLists
context += [Tracking::StandardContext.new(project: project, user: user, namespace: namespace).to_context]
contexts = [Tracking::StandardContext.new(project: project, user: user, namespace: namespace).to_context, *context]
snowplow.event(category, action, label: label, property: property, value: value, context: context)
product_analytics.event(category, action, label: label, property: property, value: value, context: context)
snowplow.event(category, action, label: label, property: property, value: value, context: contexts)
product_analytics.event(category, action, label: label, property: property, value: value, context: contexts)
end
def self_describing_event(schema_url, data:, context: nil)
......
......@@ -61,8 +61,8 @@ RSpec.describe Gitlab::Tracking do
expect(args[:property]).to eq('property')
expect(args[:value]).to eq(1.5)
expect(args[:context].length).to eq(2)
expect(args[:context].first).to eq(other_context)
expect(args[:context].last.to_json[:schema]).to eq(Gitlab::Tracking::StandardContext::GITLAB_STANDARD_SCHEMA_URL)
expect(args[:context].first.to_json[:schema]).to eq(Gitlab::Tracking::StandardContext::GITLAB_STANDARD_SCHEMA_URL)
expect(args[:context].last).to eq(other_context)
end
described_class.event('category', 'action', label: 'label', property: 'property', value: 1.5,
......
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