Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
db463818
Commit
db463818
authored
Dec 03, 2021
by
Rajendra Kadam
Committed by
Mikołaj Wawrzyniak
Dec 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add snowplow stats enabled metric
parent
fcb5d0dd
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
139 additions
and
1 deletion
+139
-1
config/metrics/settings/20211124061450_snowplow_enabled.yml
config/metrics/settings/20211124061450_snowplow_enabled.yml
+24
-0
config/metrics/settings/20211124085521_snowplow_configured_to_gitlab_collector_hostname.yml
...5521_snowplow_configured_to_gitlab_collector_hostname.yml
+24
-0
lib/gitlab/usage/metrics/instrumentations/snowplow_configured_to_gitlab_collector_metric.rb
...tations/snowplow_configured_to_gitlab_collector_metric.rb
+17
-0
lib/gitlab/usage/metrics/instrumentations/snowplow_enabled_metric.rb
...usage/metrics/instrumentations/snowplow_enabled_metric.rb
+15
-0
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+3
-1
spec/lib/gitlab/usage/metrics/instrumentations/snowplow_configured_to_gitlab_collector_metric_spec.rb
...ns/snowplow_configured_to_gitlab_collector_metric_spec.rb
+22
-0
spec/lib/gitlab/usage/metrics/instrumentations/snowplow_enabled_metric_spec.rb
.../metrics/instrumentations/snowplow_enabled_metric_spec.rb
+22
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+12
-0
No files found.
config/metrics/settings/20211124061450_snowplow_enabled.yml
0 → 100644
View file @
db463818
---
key_path
:
settings.snowplow_enabled
name
:
snowplow_enabled_gitlab_instance
description
:
Whether snowplow is enabled for the GitLab instance
product_section
:
growth
product_stage
:
growth
product_group
:
group::product intelligence
product_category
:
product intelligence
value_type
:
boolean
status
:
active
milestone
:
"
14.6"
introduced_by_url
:
'
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75184'
time_frame
:
none
data_source
:
system
instrumentation_class
:
SnowplowEnabledMetric
data_category
:
optional
performance_indicator_type
:
[]
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
config/metrics/settings/20211124085521_snowplow_configured_to_gitlab_collector_hostname.yml
0 → 100644
View file @
db463818
---
key_path
:
settings.snowplow_configured_to_gitlab_collector
name
:
snowplow_configured_to_gitlab_collector
description
:
Metric informs if currently configured Snowplow collector hostname points towards Gitlab Snowplow collection pipeline.
product_section
:
growth
product_stage
:
growth
product_group
:
group::product intelligence
product_category
:
product intelligence
value_type
:
boolean
status
:
active
milestone
:
"
14.6"
introduced_by_url
:
'
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75184'
time_frame
:
none
data_source
:
system
instrumentation_class
:
SnowplowConfiguredToGitlabCollectorMetric
data_category
:
optional
performance_indicator_type
:
[]
distribution
:
-
ce
-
ee
tier
:
-
free
-
premium
-
ultimate
lib/gitlab/usage/metrics/instrumentations/snowplow_configured_to_gitlab_collector_metric.rb
0 → 100644
View file @
db463818
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
SnowplowConfiguredToGitlabCollectorMetric
<
GenericMetric
GITLAB_SNOWPLOW_COLLECTOR_HOSTNAME
=
'snowplow.trx.gitlab.net'
def
value
Gitlab
::
CurrentSettings
.
snowplow_collector_hostname
==
GITLAB_SNOWPLOW_COLLECTOR_HOSTNAME
end
end
end
end
end
end
lib/gitlab/usage/metrics/instrumentations/snowplow_enabled_metric.rb
0 → 100644
View file @
db463818
# frozen_string_literal: true
module
Gitlab
module
Usage
module
Metrics
module
Instrumentations
class
SnowplowEnabledMetric
<
GenericMetric
def
value
Gitlab
::
CurrentSettings
.
snowplow_enabled?
end
end
end
end
end
end
lib/gitlab/usage_data.rb
View file @
db463818
...
...
@@ -228,7 +228,9 @@ module Gitlab
operating_system:
alt_usage_data
(
fallback:
nil
)
{
operating_system
},
gitaly_apdex:
alt_usage_data
{
gitaly_apdex
},
collected_data_categories:
add_metric
(
'CollectedDataCategoriesMetric'
,
time_frame:
'none'
),
service_ping_features_enabled:
add_metric
(
'ServicePingFeaturesMetric'
,
time_frame:
'none'
)
service_ping_features_enabled:
add_metric
(
'ServicePingFeaturesMetric'
,
time_frame:
'none'
),
snowplow_enabled:
add_metric
(
'SnowplowEnabledMetric'
,
time_frame:
'none'
),
snowplow_configured_to_gitlab_collector:
add_metric
(
'SnowplowConfiguredToGitlabCollectorMetric'
,
time_frame:
'none'
)
}
}
end
...
...
spec/lib/gitlab/usage/metrics/instrumentations/snowplow_configured_to_gitlab_collector_metric_spec.rb
0 → 100644
View file @
db463818
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
SnowplowConfiguredToGitlabCollectorMetric
do
using
RSpec
::
Parameterized
::
TableSyntax
context
'for collector_hostname option'
do
where
(
:collector_hostname
,
:expected_value
)
do
'snowplow.trx.gitlab.net'
|
true
'foo.bar.something.net'
|
false
end
with_them
do
before
do
stub_application_setting
(
snowplow_collector_hostname:
collector_hostname
)
end
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'none'
}
end
end
end
spec/lib/gitlab/usage/metrics/instrumentations/snowplow_enabled_metric_spec.rb
0 → 100644
View file @
db463818
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
Usage
::
Metrics
::
Instrumentations
::
SnowplowEnabledMetric
do
using
RSpec
::
Parameterized
::
TableSyntax
context
'for snowplow enabled option'
do
where
(
:snowplow_enabled
,
:expected_value
)
do
true
|
true
false
|
false
end
with_them
do
before
do
stub_application_setting
(
snowplow_enabled:
snowplow_enabled
)
end
it_behaves_like
'a correct instrumented metric value'
,
{
time_frame:
'none'
}
end
end
end
spec/lib/gitlab/usage_data_spec.rb
View file @
db463818
...
...
@@ -1045,6 +1045,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
describe
".system_usage_data_settings"
do
let
(
:prometheus_client
)
{
double
(
Gitlab
::
PrometheusClient
)
}
let
(
:snowplow_gitlab_host?
)
{
Gitlab
::
CurrentSettings
.
snowplow_collector_hostname
==
'snowplow.trx.gitlab.net'
}
before
do
allow
(
described_class
).
to
receive
(
:operating_system
).
and_return
(
'ubuntu-20.04'
)
...
...
@@ -1089,6 +1090,17 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
it
'gathers user_cap_feature_enabled'
do
expect
(
subject
[
:settings
][
:user_cap_feature_enabled
]).
to
eq
(
Gitlab
::
CurrentSettings
.
new_user_signups_cap
)
end
context
'snowplow stats'
do
before
do
stub_feature_flags
(
usage_data_instrumentation:
false
)
end
it
'gathers snowplow stats'
do
expect
(
subject
[
:settings
][
:snowplow_enabled
]).
to
eq
(
Gitlab
::
CurrentSettings
.
snowplow_enabled?
)
expect
(
subject
[
:settings
][
:snowplow_configured_to_gitlab_collector
]).
to
eq
(
snowplow_gitlab_host?
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment