mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
UsageInsights: Disable frontend features when backend is disabled (#77772)
* UsageInsights: Disable frontend features when backend is disabled * Disable DS insights * Update doc * fix linter issue * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> --------- Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
This commit is contained in:
parent
ba51c371ec
commit
bb12fe7d82
@ -518,8 +518,7 @@ Sets a custom value for the `User-Agent` header for outgoing data proxy requests
|
|||||||
|
|
||||||
### enabled
|
### enabled
|
||||||
|
|
||||||
This option is also known as _usage analytics_. When `false`, this option disables the writers that read/write from and to the Grafana databases. The default
|
This option is also known as _usage analytics_. When `false`, this option disables the writers that write to the Grafana database and the associated features, such as dashboard and data source insights, presence indicators, and advanced dashboard search. The default value is `true`.
|
||||||
value is `true`.
|
|
||||||
|
|
||||||
### reporting_enabled
|
### reporting_enabled
|
||||||
|
|
||||||
|
@ -143,6 +143,9 @@ export class GrafanaBootConfig implements GrafanaConfig {
|
|||||||
reporting = {
|
reporting = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
};
|
};
|
||||||
|
analytics = {
|
||||||
|
enabled: true,
|
||||||
|
};
|
||||||
googleAnalyticsId: undefined;
|
googleAnalyticsId: undefined;
|
||||||
googleAnalytics4Id: undefined;
|
googleAnalytics4Id: undefined;
|
||||||
googleAnalytics4SendManualPageViews = false;
|
googleAnalytics4SendManualPageViews = false;
|
||||||
|
@ -62,6 +62,10 @@ type FrontendSettingsReportingDTO struct {
|
|||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FrontendSettingsAnalyticsDTO struct {
|
||||||
|
Enabled bool `json:"enabled"`
|
||||||
|
}
|
||||||
|
|
||||||
type FrontendSettingsUnifiedAlertingDTO struct {
|
type FrontendSettingsUnifiedAlertingDTO struct {
|
||||||
MinInterval string `json:"minInterval"`
|
MinInterval string `json:"minInterval"`
|
||||||
AlertStateHistoryBackend string `json:"alertStateHistoryBackend,omitempty"`
|
AlertStateHistoryBackend string `json:"alertStateHistoryBackend,omitempty"`
|
||||||
@ -209,6 +213,7 @@ type FrontendSettingsDTO struct {
|
|||||||
Caching FrontendSettingsCachingDTO `json:"caching"`
|
Caching FrontendSettingsCachingDTO `json:"caching"`
|
||||||
RecordedQueries FrontendSettingsRecordedQueriesDTO `json:"recordedQueries"`
|
RecordedQueries FrontendSettingsRecordedQueriesDTO `json:"recordedQueries"`
|
||||||
Reporting FrontendSettingsReportingDTO `json:"reporting"`
|
Reporting FrontendSettingsReportingDTO `json:"reporting"`
|
||||||
|
Analytics FrontendSettingsAnalyticsDTO `json:"analytics"`
|
||||||
UnifiedAlertingEnabled bool `json:"unifiedAlertingEnabled"`
|
UnifiedAlertingEnabled bool `json:"unifiedAlertingEnabled"`
|
||||||
UnifiedAlerting FrontendSettingsUnifiedAlertingDTO `json:"unifiedAlerting"`
|
UnifiedAlerting FrontendSettingsUnifiedAlertingDTO `json:"unifiedAlerting"`
|
||||||
Oauth map[string]any `json:"oauth"`
|
Oauth map[string]any `json:"oauth"`
|
||||||
|
@ -223,6 +223,9 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro
|
|||||||
Reporting: dtos.FrontendSettingsReportingDTO{
|
Reporting: dtos.FrontendSettingsReportingDTO{
|
||||||
Enabled: hs.Cfg.SectionWithEnvOverrides("reporting").Key("enabled").MustBool(true),
|
Enabled: hs.Cfg.SectionWithEnvOverrides("reporting").Key("enabled").MustBool(true),
|
||||||
},
|
},
|
||||||
|
Analytics: dtos.FrontendSettingsAnalyticsDTO{
|
||||||
|
Enabled: hs.Cfg.SectionWithEnvOverrides("analytics").Key("enabled").MustBool(true),
|
||||||
|
},
|
||||||
|
|
||||||
UnifiedAlerting: dtos.FrontendSettingsUnifiedAlertingDTO{
|
UnifiedAlerting: dtos.FrontendSettingsUnifiedAlertingDTO{
|
||||||
MinInterval: hs.Cfg.UnifiedAlerting.MinInterval.String(),
|
MinInterval: hs.Cfg.UnifiedAlerting.MinInterval.String(),
|
||||||
|
@ -78,29 +78,31 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const analyticsExperimentId = 'feature-highlights-data-source-insights-badge';
|
if (config.analytics?.enabled) {
|
||||||
const analytics: NavModelItem = {
|
const analyticsExperimentId = 'feature-highlights-data-source-insights-badge';
|
||||||
active: false,
|
const analytics: NavModelItem = {
|
||||||
icon: 'info-circle',
|
active: false,
|
||||||
id: `datasource-insights-${dataSource.uid}`,
|
icon: 'info-circle',
|
||||||
text: 'Insights',
|
id: `datasource-insights-${dataSource.uid}`,
|
||||||
url: `datasources/edit/${dataSource.uid}/insights`,
|
text: 'Insights',
|
||||||
};
|
url: `datasources/edit/${dataSource.uid}/insights`,
|
||||||
|
};
|
||||||
|
|
||||||
if (highlightTrial() && !isLoadingNav) {
|
if (highlightTrial() && !isLoadingNav) {
|
||||||
analytics.tabSuffix = () => ProBadge({ experimentId: analyticsExperimentId, eventVariant: 'trial' });
|
analytics.tabSuffix = () => ProBadge({ experimentId: analyticsExperimentId, eventVariant: 'trial' });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (featureEnabled('analytics')) {
|
if (featureEnabled('analytics')) {
|
||||||
if (contextSrv.hasPermission(AccessControlAction.DataSourcesInsightsRead)) {
|
if (contextSrv.hasPermission(AccessControlAction.DataSourcesInsightsRead)) {
|
||||||
navModel.children!.push(analytics);
|
navModel.children!.push(analytics);
|
||||||
|
}
|
||||||
|
} else if (highlightsEnabled && !isLoadingNav) {
|
||||||
|
navModel.children!.push({
|
||||||
|
...analytics,
|
||||||
|
url: analytics.url + '/upgrade',
|
||||||
|
tabSuffix: () => ProBadge({ experimentId: analyticsExperimentId }),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} else if (highlightsEnabled && !isLoadingNav) {
|
|
||||||
navModel.children!.push({
|
|
||||||
...analytics,
|
|
||||||
url: analytics.url + '/upgrade',
|
|
||||||
tabSuffix: () => ProBadge({ experimentId: analyticsExperimentId }),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cachingExperimentId = 'feature-highlights-query-caching-badge';
|
const cachingExperimentId = 'feature-highlights-query-caching-badge';
|
||||||
|
Loading…
Reference in New Issue
Block a user