SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat(web): add sentry, posthog, appcues and pylon settings to web config (#11912)
Pandeye00f47c81248
diff --git a/conf/example.yaml b/conf/example.yamlindex e0bce3567c..e70696a3b9 100644--- a/conf/example.yaml+++ b/conf/example.yaml@@ -65,15 +65,31 @@ web:posthog:# Whether to enable PostHog in web.enabled: false+ # The PostHog project API key.+ key: ""+ # The PostHog API host. Defaults to https://us.i.posthog.com when empty.+ api_host: ""+ # The PostHog UI host. Used when api_host points at a reverse proxy.+ ui_host: ""appcues:# Whether to enable Appcues in web.enabled: false+ # The Appcues account/app ID.+ app_id: ""sentry:# Whether to enable Sentry in web.enabled: false+ # The Sentry DSN.+ dsn: ""+ # The Sentry tunnel URL.+ tunnel: ""pylon:# Whether to enable Pylon in web.enabled: false+ # The Pylon app ID.+ app_id: ""+ # The Pylon identity verification secret.+ identity_secret: ""##################### Cache #####################cache:diff --git a/frontend/src/schemas/generated/webSettings.schema.json b/frontend/src/schemas/generated/webSettings.schema.jsonindex e48f88ca45..a14271b32a 100644--- a/frontend/src/schemas/generated/webSettings.schema.json+++ b/frontend/src/schemas/generated/webSettings.schema.json@@ -14,6 +14,9 @@],"additionalProperties": false,"properties": {+ "appId": {+ "type": "string"+ },"enabled": {"type": "boolean"}@@ -26,8 +29,17 @@],"additionalProperties": false,"properties": {+ "apiHost": {+ "type": "string"+ },"enabled": {"type": "boolean"+ },+ "key": {+ "type": "string"+ },+ "uiHost": {+ "type": "string"}},"type": "object"@@ -38,8 +50,14 @@],"additionalProperties": false,"properties": {+ "appId": {+ "type": "string"+ },"enabled": {"type": "boolean"+ },+ "identitySecret": {+ "type": "string"}},"type": "object"@@ -50,8 +68,14 @@],"additionalProperties": false,"properties": {+ "dsn": {+ "type": "string"+ },"enabled": {"type": "boolean"+ },+ "tunnel": {+ "type": "string"}},"type": "object"diff --git a/frontend/src/types/generated/webSettings.ts b/frontend/src/types/generated/webSettings.tsindex 115e05edbb..6b3580e50b 100644--- a/frontend/src/types/generated/webSettings.ts+++ b/frontend/src/types/generated/webSettings.ts@@ -7,14 +7,22 @@ export interface WebSettings {sentry: Sentry;}export interface Appcues {+ appId?: string;enabled: boolean;}export interface Posthog {+ apiHost?: string;enabled: boolean;+ key?: string;+ uiHost?: string;}export interface Pylon {+ appId?: string;enabled: boolean;+ identitySecret?: string;}export interface Sentry {+ dsn?: string;enabled: boolean;+ tunnel?: string;}diff --git a/pkg/web/config.go b/pkg/web/config.goindex 4fa3c428e0..a2807a7a09 100644--- a/pkg/web/config.go+++ b/pkg/web/config.go@@ -28,19 +28,27 @@ type SettingsConfig struct {}type PosthogConfig struct {- Enabled bool `mapstructure:"enabled"`+ Enabled bool `mapstructure:"enabled"`+ Key string `mapstructure:"key"`+ APIHost string `mapstructure:"api_host"`+ UIHost string `mapstructure:"ui_host"`}type AppcuesConfig struct {- Enabled bool `mapstructure:"enabled"`+ Enabled bool `mapstructure:"enabled"`+ AppID string `mapstructure:"app_id"`}type SentryConfig struct {- Enabled bool `mapstructure:"enabled"`+ Enabled bool `mapstructure:"enabled"`+ DSN string `mapstructure:"dsn"`+ Tunnel string `mapstructure:"tunnel"`}type PylonConfig struct {- Enabled bool `mapstructure:"enabled"`+ Enabled bool `mapstructure:"enabled"`+ AppID string `mapstructure:"app_id"`+ IdentitySecret string `mapstructure:"identity_secret"`}func NewConfigFactory() factory.ConfigFactory {diff --git a/pkg/web/config_test.go b/pkg/web/config_test.goindex f131e9622b..e71150d60b 100644--- a/pkg/web/config_test.go+++ b/pkg/web/config_test.go@@ -48,17 +48,26 @@ func TestSettingsConfigWithEnvProvider(t *testing.T) {testCases := []struct {name stringenv string+ value stringexpected SettingsConfig}{- {name: "posthog", env: "SIGNOZ_WEB_SETTINGS_POSTHOG_ENABLED", expected: SettingsConfig{Posthog: PosthogConfig{Enabled: true}}},- {name: "appcues", env: "SIGNOZ_WEB_SETTINGS_APPCUES_ENABLED", expected: SettingsConfig{Appcues: AppcuesConfig{Enabled: true}}},- {name: "sentry", env: "SIGNOZ_WEB_SETTINGS_SENTRY_ENABLED", expected: SettingsConfig{Sentry: SentryConfig{Enabled: true}}},- {name: "pylon", env: "SIGNOZ_WEB_SETTINGS_PYLON_ENABLED", expected: SettingsConfig{Pylon: PylonConfig{Enabled: true}}},+ {name: "posthog_enabled", env: "SIGNOZ_WEB_SETTINGS_POSTHOG_ENABLED", value: "true", expected: SettingsConfig{Posthog: PosthogConfig{Enabled: true}}},+ {name: "posthog_key", env: "SIGNOZ_WEB_SETTINGS_POSTHOG_KEY", value: "phc_examplekey", expected: SettingsConfig{Posthog: PosthogConfig{Key: "phc_examplekey"}}},+ {name: "posthog_api_host", env: "SIGNOZ_WEB_SETTINGS_POSTHOG_API__HOST", value: "https://eu.i.posthog.com", expected: SettingsConfig{Posthog: PosthogConfig{APIHost: "https://eu.i.posthog.com"}}},+ {name: "posthog_ui_host", env: "SIGNOZ_WEB_SETTINGS_POSTHOG_UI__HOST", value: "https://eu.posthog.com", expected: SettingsConfig{Posthog: PosthogConfig{UIHost: "https://eu.posthog.com"}}},+ {name: "appcues_enabled", env: "SIGNOZ_WEB_SETTINGS_APPCUES_ENABLED", value: "true", expected: SettingsConfig{Appcues: AppcuesConfig{Enabled: true}}},+ {name: "appcues_app_id", env: "SIGNOZ_WEB_SETTINGS_APPCUES_APP__ID", value: "12345-abcde", expected: SettingsConfig{Appcues: AppcuesConfig{AppID: "12345-abcde"}}},+ {name: "sentry_enabled", env: "SIGNOZ_WEB_SETTINGS_SENTRY_ENABLED", value: "true", expected: SettingsConfig{Sentry: SentryConfig{Enabled: true}}},+ {name: "sentry_dsn", env: "SIGNOZ_WEB_SETTINGS_SENTRY_DSN", value: "https://[email protected]/0", expected: SettingsConfig{Sentry: SentryConfig{DSN: "https://[email protected]/0"}}},+ {name: "sentry_tunnel", env: "SIGNOZ_WEB_SETTINGS_SENTRY_TUNNEL", value: "https://example.com/tunnel", expected: SettingsConfig{Sentry: SentryConfig{Tunnel: "https://example.com/tunnel"}}},+ {name: "pylon_enabled", env: "SIGNOZ_WEB_SETTINGS_PYLON_ENABLED", value: "true", expected: SettingsConfig{Pylon: PylonConfig{Enabled: true}}},+ {name: "pylon_app_id", env: "SIGNOZ_WEB_SETTINGS_PYLON_APP__ID", value: "pylon-app-id", expected: SettingsConfig{Pylon: PylonConfig{AppID: "pylon-app-id"}}},+ {name: "pylon_identity_secret", env: "SIGNOZ_WEB_SETTINGS_PYLON_IDENTITY__SECRET", value: "pylon-secret", expected: SettingsConfig{Pylon: PylonConfig{IdentitySecret: "pylon-secret"}}},}for _, testCase := range testCases {t.Run(testCase.name, func(t *testing.T) {- t.Setenv(testCase.env, "true")+ t.Setenv(testCase.env, testCase.value)conf, err := config.New(context.Background(),diff --git a/pkg/web/routerweb/provider_test.go b/pkg/web/routerweb/provider_test.goindex 6436b6c9ae..72ccd54396 100644--- a/pkg/web/routerweb/provider_test.go+++ b/pkg/web/routerweb/provider_test.go@@ -119,13 +119,49 @@ func TestServeTemplatedIndex(t *testing.T) {Index: "valid_template.html",Directory: "testdata",Settings: web.SettingsConfig{- Posthog: web.PosthogConfig{Enabled: true},- Appcues: web.AppcuesConfig{Enabled: true},+ Posthog: web.PosthogConfig{+ Enabled: true,+ Key: "phc_examplekey",+ APIHost: "https://us.i.posthog.com",+ UIHost: "https://us.posthog.com",+ },+ Appcues: web.AppcuesConfig{+ Enabled: true,+ AppID: "12345-abcde",+ },+ Sentry: web.SentryConfig{+ Enabled: true,+ DSN: "https://[email protected]/0",+ Tunnel: "https://example.com/tunnel",+ },+ Pylon: web.PylonConfig{+ Enabled: true,+ AppID: "pylon-app-id",+ IdentitySecret: "pylon-secret",+ },},},expected: expectedHTML("/", web.Settings{- Posthog: web.Posthog{Enabled: true},- Appcues: web.Appcues{Enabled: true},+ Posthog: web.Posthog{+ Enabled: true,+ Key: "phc_examplekey",+ APIHost: "https://us.i.posthog.com",+ UIHost: "https://us.posthog.com",+ },+ Appcues: web.Appcues{+ Enabled: true,+ AppID: "12345-abcde",+ },+ Sentry: web.Sentry{+ Enabled: true,+ DSN: "https://[email protected]/0",+ Tunnel: "https://example.com/tunnel",+ },+ Pylon: web.Pylon{+ Enabled: true,+ AppID: "pylon-app-id",+ IdentitySecret: "pylon-secret",+ },}),},}diff --git a/pkg/web/settings.go b/pkg/web/settings.goindex 9195eae32d..2b5f6b49cb 100644--- a/pkg/web/settings.go+++ b/pkg/web/settings.go@@ -8,34 +8,50 @@ type Settings struct {}type Posthog struct {- Enabled bool `json:"enabled" required:"true"`+ Enabled bool `json:"enabled" required:"true"`+ Key string `json:"key"`+ APIHost string `json:"apiHost"`+ UIHost string `json:"uiHost"`}type Appcues struct {- Enabled bool `json:"enabled" required:"true"`+ Enabled bool `json:"enabled" required:"true"`+ AppID string `json:"appId"`}type Sentry struct {- Enabled bool `json:"enabled" required:"true"`+ Enabled bool `json:"enabled" required:"true"`+ DSN string `json:"dsn"`+ Tunnel string `json:"tunnel"`}type Pylon struct {- Enabled bool `json:"enabled" required:"true"`+ Enabled bool `json:"enabled" required:"true"`+ AppID string `json:"appId"`+ IdentitySecret string `json:"identitySecret"`}func NewSettings(config Config) Settings {return Settings{Posthog: Posthog{Enabled: config.Settings.Posthog.Enabled,+ Key: config.Settings.Posthog.Key,+ APIHost: config.Settings.Posthog.APIHost,+ UIHost: config.Settings.Posthog.UIHost,},Appcues: Appcues{Enabled: config.Settings.Appcues.Enabled,+ AppID: config.Settings.Appcues.AppID,},Sentry: Sentry{Enabled: config.Settings.Sentry.Enabled,+ DSN: config.Settings.Sentry.DSN,+ Tunnel: config.Settings.Sentry.Tunnel,},Pylon: Pylon{- Enabled: config.Settings.Pylon.Enabled,+ Enabled: config.Settings.Pylon.Enabled,+ AppID: config.Settings.Pylon.AppID,+ IdentitySecret: config.Settings.Pylon.IdentitySecret,},}}