Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d1b9fddb
Unverified
Commit
d1b9fddb
authored
Feb 10, 2021
by
Carl Bergquist
Committed by
GitHub
Feb 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Usage stats: Adds source/distributor setting (#31039)
Signed-off-by: bergquist <carl.bergquist@gmail.com>
parent
d6e8e476
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
1 deletions
+16
-1
conf/defaults.ini
+3
-0
conf/sample.ini
+3
-0
pkg/infra/usagestats/usage_stats.go
+1
-0
pkg/infra/usagestats/usage_stats_test.go
+2
-0
pkg/setting/setting.go
+7
-1
No files found.
conf/defaults.ini
View file @
d1b9fddb
...
...
@@ -162,6 +162,9 @@ send_user_header = false
# Change this option to false to disable reporting.
reporting_enabled
=
true
# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs
reporting_distributor
=
grafana-labs
# Set to false to disable all checks to https://grafana.com
# for new versions (grafana itself and plugins), check is used
# in some UI views to notify that grafana or plugin update exists
...
...
conf/sample.ini
View file @
d1b9fddb
...
...
@@ -168,6 +168,9 @@
# Change this option to false to disable reporting.
;reporting_enabled = true
# The name of the distributor of the Grafana instance. Ex hosted-grafana, grafana-labs
;reporting_distributor = grafana-labs
# Set to false to disable all checks to https://grafana.net
# for new versions (grafana itself and plugins), check is used
# in some UI views to notify that grafana or plugin update exists
...
...
pkg/infra/usagestats/usage_stats.go
View file @
d1b9fddb
...
...
@@ -103,6 +103,7 @@ func (uss *UsageStatsService) GetUsageReport(ctx context.Context) (UsageReport,
metrics
[
"stats.ds.other.count"
]
=
dsOtherCount
metrics
[
"stats.packaging."
+
setting
.
Packaging
+
".count"
]
=
1
metrics
[
"stats.distributor."
+
setting
.
ReportingDistributor
+
".count"
]
=
1
// Alerting stats
alertingUsageStats
,
err
:=
uss
.
AlertingUsageStats
.
QueryUsageStats
()
...
...
pkg/infra/usagestats/usage_stats_test.go
View file @
d1b9fddb
...
...
@@ -212,6 +212,7 @@ func TestMetrics(t *testing.T) {
setting
.
LDAPEnabled
=
true
setting
.
AuthProxyEnabled
=
true
setting
.
Packaging
=
"deb"
setting
.
ReportingDistributor
=
"hosted-grafana"
wg
.
Add
(
1
)
err
:=
uss
.
sendUsageStats
(
context
.
Background
())
...
...
@@ -293,6 +294,7 @@ func TestMetrics(t *testing.T) {
assert
.
Equal
(
t
,
1
,
metrics
.
Get
(
"stats.auth_enabled.oauth_grafana_com.count"
)
.
MustInt
())
assert
.
Equal
(
t
,
1
,
metrics
.
Get
(
"stats.packaging.deb.count"
)
.
MustInt
())
assert
.
Equal
(
t
,
1
,
metrics
.
Get
(
"stats.distributor.hosted-grafana.count"
)
.
MustInt
())
assert
.
Equal
(
t
,
1
,
metrics
.
Get
(
"stats.auth_token_per_user_le_3"
)
.
MustInt
())
assert
.
Equal
(
t
,
2
,
metrics
.
Get
(
"stats.auth_token_per_user_le_6"
)
.
MustInt
())
...
...
pkg/setting/setting.go
View file @
d1b9fddb
...
...
@@ -141,7 +141,9 @@ var (
appliedCommandLineProperties
[]
string
appliedEnvOverrides
[]
string
// analytics
ReportingEnabled
bool
ReportingDistributor
string
CheckForUpdates
bool
GoogleAnalyticsId
string
GoogleTagManagerId
string
...
...
@@ -815,10 +817,14 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
cfg
.
MetricsEndpointDisableTotalStats
=
iniFile
.
Section
(
"metrics"
)
.
Key
(
"disable_total_stats"
)
.
MustBool
(
false
)
analytics
:=
iniFile
.
Section
(
"analytics"
)
ReportingEnabled
=
analytics
.
Key
(
"reporting_enabled"
)
.
MustBool
(
true
)
CheckForUpdates
=
analytics
.
Key
(
"check_for_updates"
)
.
MustBool
(
true
)
GoogleAnalyticsId
=
analytics
.
Key
(
"google_analytics_ua_id"
)
.
String
()
GoogleTagManagerId
=
analytics
.
Key
(
"google_tag_manager_id"
)
.
String
()
ReportingEnabled
=
analytics
.
Key
(
"reporting_enabled"
)
.
MustBool
(
true
)
ReportingDistributor
=
analytics
.
Key
(
"reporting_distributor"
)
.
MustString
(
"grafana-labs"
)
if
len
(
ReportingDistributor
)
>=
100
{
ReportingDistributor
=
ReportingDistributor
[
:
100
]
}
if
err
:=
readAlertingSettings
(
iniFile
);
err
!=
nil
{
return
err
...
...
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