From 65a7bddcee52184ef5749e2b9743f704acfd748c Mon Sep 17 00:00:00 2001 From: William Assis <35489495+gassiss@users.noreply.github.com> Date: Mon, 23 Oct 2023 08:43:33 -0400 Subject: [PATCH] Analytics: Add option to pass destSDKBaseURL to rudderstack load method (#74926) * Add option to pass destSDKBaseURL to rudderstack load method * Update docs/sources/setup-grafana/configure-grafana/_index.md Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com> * 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> --- conf/defaults.ini | 3 +++ conf/sample.ini | 3 +++ docs/sources/setup-grafana/configure-grafana/_index.md | 6 ++++++ packages/grafana-data/src/types/config.ts | 1 + packages/grafana-runtime/src/config.ts | 1 + pkg/api/dtos/frontend_settings.go | 9 +++++---- pkg/api/frontendsettings.go | 1 + pkg/setting/setting.go | 2 ++ public/app/app.ts | 1 + .../echo/backends/analytics/RudderstackBackend.ts | 6 +++++- 10 files changed, 28 insertions(+), 5 deletions(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index d200015e520..f41d4c95cd2 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -279,6 +279,9 @@ rudderstack_sdk_url = # Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config rudderstack_config_url = +# Rudderstack Integrations URL, optional. Only valid if you pass the SDK version 1.1 or higher +rudderstack_integrations_url = + # Intercom secret, optional, used to hash user_id before passing to Intercom via Rudderstack intercom_secret = diff --git a/conf/sample.ini b/conf/sample.ini index 126a4aa594f..6b556b8144f 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -286,6 +286,9 @@ # Rudderstack Config url, optional, used by Rudderstack SDK to fetch source config ;rudderstack_config_url = +# Rudderstack Integrations URL, optional. Only valid if you pass the SDK version 1.1 or higher +;rudderstack_integrations_url = + # Intercom secret, optional, used to hash user_id before passing to Intercom via Rudderstack ;intercom_secret = diff --git a/docs/sources/setup-grafana/configure-grafana/_index.md b/docs/sources/setup-grafana/configure-grafana/_index.md index 597e6d67269..7f50adfce3d 100644 --- a/docs/sources/setup-grafana/configure-grafana/_index.md +++ b/docs/sources/setup-grafana/configure-grafana/_index.md @@ -575,6 +575,12 @@ URL to load the Rudderstack SDK. Optional. If tracking with Rudderstack is enabled, you can provide a custom URL to load the Rudderstack config. +### rudderstack_integrations_url + +Optional. If tracking with Rudderstack is enabled, you can provide a custom +URL to load the SDK for destinations running in device mode. This setting is only valid for +Rudderstack version 1.1 and higher. + ### application_insights_connection_string If you want to track Grafana usage via Azure Application Insights, then specify _your_ Application Insights connection string. Since the connection string contains semicolons, you need to wrap it in backticks (`). By default, tracking usage is disabled. diff --git a/packages/grafana-data/src/types/config.ts b/packages/grafana-data/src/types/config.ts index a9d55ee2e07..462eb6c9a6f 100644 --- a/packages/grafana-data/src/types/config.ts +++ b/packages/grafana-data/src/types/config.ts @@ -219,6 +219,7 @@ export interface GrafanaConfig { rudderstackDataPlaneUrl: string | undefined; rudderstackSdkUrl: string | undefined; rudderstackConfigUrl: string | undefined; + rudderstackIntegrationsUrl: string | undefined; sqlConnectionLimits: SqlConnectionLimits; } diff --git a/packages/grafana-runtime/src/config.ts b/packages/grafana-runtime/src/config.ts index 8ba941af6ab..ab29635bbe2 100644 --- a/packages/grafana-runtime/src/config.ts +++ b/packages/grafana-runtime/src/config.ts @@ -150,6 +150,7 @@ export class GrafanaBootConfig implements GrafanaConfig { rudderstackDataPlaneUrl: undefined; rudderstackSdkUrl: undefined; rudderstackConfigUrl: undefined; + rudderstackIntegrationsUrl: undefined; sqlConnectionLimits = { maxOpenConns: 100, maxIdleConns: 100, diff --git a/pkg/api/dtos/frontend_settings.go b/pkg/api/dtos/frontend_settings.go index 35d6ee53689..63389fe5c08 100644 --- a/pkg/api/dtos/frontend_settings.go +++ b/pkg/api/dtos/frontend_settings.go @@ -156,10 +156,11 @@ type FrontendSettingsDTO struct { GoogleAnalytics4Id string `json:"googleAnalytics4Id"` GoogleAnalytics4SendManualPageViews bool `json:"GoogleAnalytics4SendManualPageViews"` - RudderstackWriteKey string `json:"rudderstackWriteKey"` - RudderstackDataPlaneUrl string `json:"rudderstackDataPlaneUrl"` - RudderstackSdkUrl string `json:"rudderstackSdkUrl"` - RudderstackConfigUrl string `json:"rudderstackConfigUrl"` + RudderstackWriteKey string `json:"rudderstackWriteKey"` + RudderstackDataPlaneUrl string `json:"rudderstackDataPlaneUrl"` + RudderstackSdkUrl string `json:"rudderstackSdkUrl"` + RudderstackConfigUrl string `json:"rudderstackConfigUrl"` + RudderstackIntegrationsUrl string `json:"rudderstackIntegrationsUrl"` FeedbackLinksEnabled bool `json:"feedbackLinksEnabled"` ApplicationInsightsConnectionString string `json:"applicationInsightsConnectionString"` diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index f77079f53ec..cdf4268a0db 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -136,6 +136,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro RudderstackDataPlaneUrl: hs.Cfg.RudderstackDataPlaneURL, RudderstackSdkUrl: hs.Cfg.RudderstackSDKURL, RudderstackConfigUrl: hs.Cfg.RudderstackConfigURL, + RudderstackIntegrationsUrl: hs.Cfg.RudderstackIntegrationsURL, FeedbackLinksEnabled: hs.Cfg.FeedbackLinksEnabled, ApplicationInsightsConnectionString: hs.Cfg.ApplicationInsightsConnectionString, ApplicationInsightsEndpointUrl: hs.Cfg.ApplicationInsightsEndpointUrl, diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 1ea1b0bfe77..48e39f2f411 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -432,6 +432,7 @@ type Cfg struct { RudderstackWriteKey string RudderstackSDKURL string RudderstackConfigURL string + RudderstackIntegrationsURL string IntercomSecret string // AzureAD @@ -1113,6 +1114,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error { cfg.RudderstackDataPlaneURL = analytics.Key("rudderstack_data_plane_url").String() cfg.RudderstackSDKURL = analytics.Key("rudderstack_sdk_url").String() cfg.RudderstackConfigURL = analytics.Key("rudderstack_config_url").String() + cfg.RudderstackIntegrationsURL = analytics.Key("rudderstack_integrations_url").String() cfg.IntercomSecret = analytics.Key("intercom_secret").String() cfg.ReportingEnabled = analytics.Key("reporting_enabled").MustBool(true) diff --git a/public/app/app.ts b/public/app/app.ts index b910cf67af5..aa0332b20a7 100644 --- a/public/app/app.ts +++ b/public/app/app.ts @@ -325,6 +325,7 @@ function initEchoSrv() { user: config.bootData.user, sdkUrl: config.rudderstackSdkUrl, configUrl: config.rudderstackConfigUrl, + integrationsUrl: config.rudderstackIntegrationsUrl, buildInfo: config.buildInfo, }) ); diff --git a/public/app/core/services/echo/backends/analytics/RudderstackBackend.ts b/public/app/core/services/echo/backends/analytics/RudderstackBackend.ts index 697e486e849..c73b3788b11 100644 --- a/public/app/core/services/echo/backends/analytics/RudderstackBackend.ts +++ b/public/app/core/services/echo/backends/analytics/RudderstackBackend.ts @@ -34,6 +34,7 @@ export interface RudderstackBackendOptions { user?: CurrentUserDTO; sdkUrl?: string; configUrl?: string; + integrationsUrl?: string; } export class RudderstackBackend implements EchoBackend { @@ -68,7 +69,10 @@ export class RudderstackBackend implements EchoBackend