Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-18 13:34:06 +0300
commit859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch)
treed7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /lib/gitlab/tracking
parent446d496a6d000c73a304be52587cd9bbc7493136 (diff)
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'lib/gitlab/tracking')
-rw-r--r--lib/gitlab/tracking/standard_context.rb36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/gitlab/tracking/standard_context.rb b/lib/gitlab/tracking/standard_context.rb
index 71dfe27dd5a..92fdd008249 100644
--- a/lib/gitlab/tracking/standard_context.rb
+++ b/lib/gitlab/tracking/standard_context.rb
@@ -3,38 +3,36 @@
module Gitlab
module Tracking
class StandardContext
- GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-1'.freeze
+ GITLAB_STANDARD_SCHEMA_URL = 'iglu:com.gitlab/gitlab_standard/jsonschema/1-0-3'.freeze
+ GITLAB_RAILS_SOURCE = 'gitlab-rails'.freeze
- def initialize(namespace: nil, project: nil, **data)
- @namespace = namespace
- @project = project
+ def initialize(namespace: nil, project: nil, user: nil, **data)
@data = data
end
- def namespace_id
- namespace&.id
+ def to_context
+ SnowplowTracker::SelfDescribingJson.new(GITLAB_STANDARD_SCHEMA_URL, to_h)
end
- def project_id
- @project&.id
+ def environment
+ return 'production' if Gitlab.com_and_canary?
+
+ return 'staging' if Gitlab.staging?
+
+ 'development'
end
- def to_context
- SnowplowTracker::SelfDescribingJson.new(GITLAB_STANDARD_SCHEMA_URL, to_h)
+ def source
+ GITLAB_RAILS_SOURCE
end
private
- def namespace
- @namespace || @project&.namespace
- end
-
def to_h
- public_methods(false).each_with_object({}) do |method, hash|
- next if method == :to_context
-
- hash[method] = public_send(method) # rubocop:disable GitlabSecurity/PublicSend
- end.merge(@data)
+ {
+ environment: environment,
+ source: source
+ }.merge(@data)
end
end
end