mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Feat: Extending report interaction with static context that can be appended to all interaction events (#88927)
* Extending report interaction with static context that can be appended to all requests
This commit is contained in:
@@ -366,6 +366,7 @@ type Cfg struct {
|
||||
ApplicationInsightsConnectionString string
|
||||
ApplicationInsightsEndpointUrl string
|
||||
FeedbackLinksEnabled bool
|
||||
ReportingStaticContext map[string]string
|
||||
|
||||
// Frontend analytics
|
||||
GoogleAnalyticsID string
|
||||
@@ -1156,6 +1157,15 @@ func (cfg *Cfg) parseINIFile(iniFile *ini.File) error {
|
||||
cfg.ApplicationInsightsEndpointUrl = analytics.Key("application_insights_endpoint_url").String()
|
||||
cfg.FeedbackLinksEnabled = analytics.Key("feedback_links_enabled").MustBool(true)
|
||||
|
||||
// parse reporting static context string of key=value, key=value pairs into an object
|
||||
cfg.ReportingStaticContext = make(map[string]string)
|
||||
for _, pair := range strings.Split(analytics.Key("reporting_static_context").String(), ",") {
|
||||
kv := strings.Split(pair, "=")
|
||||
if len(kv) == 2 {
|
||||
cfg.ReportingStaticContext[strings.TrimSpace("_static_context_"+kv[0])] = strings.TrimSpace(kv[1])
|
||||
}
|
||||
}
|
||||
|
||||
if err := cfg.readAlertingSettings(iniFile); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user