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>
pull/76960/head
William Assis 2 years ago committed by GitHub
parent 51bc84673d
commit 65a7bddcee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      conf/defaults.ini
  2. 3
      conf/sample.ini
  3. 6
      docs/sources/setup-grafana/configure-grafana/_index.md
  4. 1
      packages/grafana-data/src/types/config.ts
  5. 1
      packages/grafana-runtime/src/config.ts
  6. 9
      pkg/api/dtos/frontend_settings.go
  7. 1
      pkg/api/frontendsettings.go
  8. 2
      pkg/setting/setting.go
  9. 1
      public/app/app.ts
  10. 6
      public/app/core/services/echo/backends/analytics/RudderstackBackend.ts

@ -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 =

@ -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 =

@ -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.

@ -219,6 +219,7 @@ export interface GrafanaConfig {
rudderstackDataPlaneUrl: string | undefined;
rudderstackSdkUrl: string | undefined;
rudderstackConfigUrl: string | undefined;
rudderstackIntegrationsUrl: string | undefined;
sqlConnectionLimits: SqlConnectionLimits;
}

@ -150,6 +150,7 @@ export class GrafanaBootConfig implements GrafanaConfig {
rudderstackDataPlaneUrl: undefined;
rudderstackSdkUrl: undefined;
rudderstackConfigUrl: undefined;
rudderstackIntegrationsUrl: undefined;
sqlConnectionLimits = {
maxOpenConns: 100,
maxIdleConns: 100,

@ -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"`

@ -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,

@ -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)

@ -325,6 +325,7 @@ function initEchoSrv() {
user: config.bootData.user,
sdkUrl: config.rudderstackSdkUrl,
configUrl: config.rudderstackConfigUrl,
integrationsUrl: config.rudderstackIntegrationsUrl,
buildInfo: config.buildInfo,
})
);

@ -34,6 +34,7 @@ export interface RudderstackBackendOptions {
user?: CurrentUserDTO;
sdkUrl?: string;
configUrl?: string;
integrationsUrl?: string;
}
export class RudderstackBackend implements EchoBackend<PageviewEchoEvent, RudderstackBackendOptions> {
@ -68,7 +69,10 @@ export class RudderstackBackend implements EchoBackend<PageviewEchoEvent, Rudder
})(method);
}
window.rudderanalytics?.load?.(options.writeKey, options.dataPlaneUrl, { configUrl: options.configUrl });
window.rudderanalytics?.load?.(options.writeKey, options.dataPlaneUrl, {
configUrl: options.configUrl,
destSDKBaseURL: options.integrationsUrl,
});
if (options.user) {
const { identifier, intercomIdentifier } = options.user.analytics;

Loading…
Cancel
Save