Skip to content

Commit

Permalink
Analytics: Enable grafana and plugin update checks to be operated ind…
Browse files Browse the repository at this point in the history
…ependently (grafana#46352)

* add separate cfg for controlling plugin update checks

* https

* add specific version note to docs

* pr feedback

* fixup
  • Loading branch information
wbrowne authored Apr 6, 2022
1 parent 9a6fd85 commit f3c1448
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
13 changes: 10 additions & 3 deletions conf/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,19 @@ reporting_enabled = true
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
# for new versions of grafana. The check is used
# in some UI views to notify that a grafana update exists.
# This option does not cause any auto updates, nor send any information
# only a GET request to https://grafana.com to get latest versions
# only a GET request to https://raw.githubusercontent.com/grafana/grafana/main/latest.json to get the latest version.
check_for_updates = true

# Set to false to disable all checks to https://grafana.com
# for new versions of plugins. The check is used
# in some UI views to notify that a plugin update exists.
# This option does not cause any auto updates, nor send any information
# only a GET request to https://grafana.com to get the latest versions.
check_for_plugin_updates = true

# Google Analytics universal tracking code, only enabled if you specify an id here
google_analytics_ua_id =

Expand Down
15 changes: 11 additions & 4 deletions conf/sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,20 @@
# 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
# Set to false to disable all checks to https://grafana.com
# for new versions of grafana. The check is used
# in some UI views to notify that a grafana update exists.
# This option does not cause any auto updates, nor send any information
# only a GET request to http://grafana.com to get latest versions
# only a GET request to https://raw.githubusercontent.com/grafana/grafana/main/latest.json to get the latest version.
;check_for_updates = true

# Set to false to disable all checks to https://grafana.com
# for new versions of plugins. The check is used
# in some UI views to notify that a plugin update exists.
# This option does not cause any auto updates, nor send any information
# only a GET request to https://grafana.com to get the latest versions.
;check_for_plugin_updates = true

# Google Analytics universal tracking code, only enabled if you specify an id here
;google_analytics_ua_id =

Expand Down
8 changes: 7 additions & 1 deletion docs/sources/administration/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,13 @@ value is `true`.

### check_for_updates

Set to false to disable all checks to https://grafana.com for new versions of installed plugins and to the Grafana GitHub repository to check for a newer version of Grafana. The version information is used in some UI views to notify that a new Grafana update or a plugin update exists. This option does not cause any auto updates, nor send any sensitive information. The check is run every 10 minutes.
Set to false, disables checking for new versions of Grafana from Grafana's GitHub repository. When enabled, the check for a new version runs every 10 minutes. It will notify, via the UI, when a new version is available. The check itself will not prompt any auto-updates of the Grafana software, nor will it send any sensitive information.

### check_for_plugin_updates

> **Note**: Available in Grafana v8.5.0 and later versions.
Set to false disables checking for new versions of installed plugins from https://grafana.com. When enabled, the check for a new plugin runs every 10 minutes. It will notify, via the UI, when a new plugin update exists. The check itself will not prompt any auto-updates of the plugin, nor will it send any sensitive information.

### google_analytics_ua_id

Expand Down
2 changes: 1 addition & 1 deletion pkg/services/updatechecker/grafana.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type GrafanaService struct {

func ProvideGrafanaService(cfg *setting.Cfg) *GrafanaService {
return &GrafanaService{
enabled: cfg.CheckForUpdates,
enabled: cfg.CheckForGrafanaUpdates,
grafanaVersion: cfg.BuildVersion,
httpClient: http.Client{Timeout: 10 * time.Second},
log: log.New("grafana.update.checker"),
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/updatechecker/plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type PluginsService struct {

func ProvidePluginsService(cfg *setting.Cfg, pluginStore plugins.Store) *PluginsService {
return &PluginsService{
enabled: cfg.CheckForUpdates,
enabled: cfg.CheckForPluginUpdates,
grafanaVersion: cfg.BuildVersion,
httpClient: &http.Client{Timeout: 10 * time.Second},
log: log.New("plugins.update.checker"),
Expand Down
6 changes: 4 additions & 2 deletions pkg/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ type Cfg struct {
Env string

// Analytics
CheckForUpdates bool
CheckForGrafanaUpdates bool
CheckForPluginUpdates bool
ReportingDistributor string
ReportingEnabled bool
ApplicationInsightsConnectionString string
Expand Down Expand Up @@ -929,7 +930,8 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
cfg.MetricsEndpointDisableTotalStats = iniFile.Section("metrics").Key("disable_total_stats").MustBool(false)

analytics := iniFile.Section("analytics")
cfg.CheckForUpdates = analytics.Key("check_for_updates").MustBool(true)
cfg.CheckForGrafanaUpdates = analytics.Key("check_for_updates").MustBool(true)
cfg.CheckForPluginUpdates = analytics.Key("check_for_plugin_updates").MustBool(true)
GoogleAnalyticsId = analytics.Key("google_analytics_ua_id").String()
GoogleTagManagerId = analytics.Key("google_tag_manager_id").String()
RudderstackWriteKey = analytics.Key("rudderstack_write_key").String()
Expand Down

0 comments on commit f3c1448

Please sign in to comment.