@@ -46,6 +46,13 @@ const (
4646
4747 envPromPort = "CL_PROMETHEUS_PORT"
4848
49+ envPyroscopeAuthToken = "CL_PYROSCOPE_AUTH_TOKEN"
50+ envPyroscopeServerAddress = "CL_PYROSCOPE_SERVER_ADDRESS"
51+ envPyroscopeEnvironment = "CL_PYROSCOPE_ENVIRONMENT"
52+ envPyroscopeLinkTracesToProfiles = "CL_PYROSCOPE_LINK_TRACES_TO_PROFILES"
53+ envPyroscopePPROFBlockProfileRate = "CL_PYROSCOPE_PPROF_BLOCK_PROFILE_RATE"
54+ envPyroscopePPROFMutexProfileFraction = "CL_PYROSCOPE_PPROF_MUTEX_PROFILE_FRACTION"
55+
4956 envTracingEnabled = "CL_TRACING_ENABLED"
5057 envTracingCollectorTarget = "CL_TRACING_COLLECTOR_TARGET"
5158 envTracingSamplingRatio = "CL_TRACING_SAMPLING_RATIO"
@@ -89,6 +96,12 @@ const (
8996type EnvConfig struct {
9097 AppID string
9198
99+ ChipIngressEndpoint string
100+ ChipIngressInsecureConnection bool
101+
102+ CRESettings string
103+ CRESettingsDefault string
104+
92105 DatabaseURL * config.SecretURL
93106 DatabaseIdleInTxSessionTimeout time.Duration
94107 DatabaseLockTimeout time.Duration
@@ -115,13 +128,14 @@ type EnvConfig struct {
115128 MercuryTransmitterReaperMaxAge time.Duration
116129 MercuryVerboseLogging bool
117130
118- PrometheusPort int //TODO more than just prom
131+ PrometheusPort int // also serves pprof routes
119132
120- TracingEnabled bool
121- TracingCollectorTarget string
122- TracingSamplingRatio float64
123- TracingTLSCertPath string
124- TracingAttributes map [string ]string
133+ PyroscopeAuthToken string
134+ PyroscopeServerAddress string
135+ PyroscopeEnvironment string
136+ PyroscopeLinkTracesToProfiles bool
137+ PyroscopePPROFBlockProfileRate int
138+ PyroscopePPROFMutexProfileFraction int
125139
126140 TelemetryEnabled bool
127141 TelemetryEndpoint string
@@ -148,11 +162,11 @@ type EnvConfig struct {
148162 TelemetryMetricCompressor string
149163 TelemetryLogCompressor string
150164
151- ChipIngressEndpoint string
152- ChipIngressInsecureConnection bool
153-
154- CRESettings string
155- CRESettingsDefault string
165+ TracingEnabled bool
166+ TracingCollectorTarget string
167+ TracingSamplingRatio float64
168+ TracingTLSCertPath string
169+ TracingAttributes map [ string ] string
156170}
157171
158172// AsCmdEnv returns a slice of environment variable key/value pairs for an exec.Cmd.
@@ -193,6 +207,13 @@ func (e *EnvConfig) AsCmdEnv() (env []string) {
193207
194208 add (envPromPort , strconv .Itoa (e .PrometheusPort ))
195209
210+ add (envPyroscopeAuthToken , e .PyroscopeAuthToken )
211+ add (envPyroscopeServerAddress , e .PyroscopeServerAddress )
212+ add (envPyroscopeEnvironment , e .PyroscopeEnvironment )
213+ add (envPyroscopeLinkTracesToProfiles , strconv .FormatBool (e .PyroscopeLinkTracesToProfiles ))
214+ add (envPyroscopePPROFBlockProfileRate , strconv .Itoa (e .PyroscopePPROFBlockProfileRate ))
215+ add (envPyroscopePPROFMutexProfileFraction , strconv .Itoa (e .PyroscopePPROFMutexProfileFraction ))
216+
196217 add (envTracingEnabled , strconv .FormatBool (e .TracingEnabled ))
197218 add (envTracingCollectorTarget , e .TracingCollectorTarget )
198219 add (envTracingSamplingRatio , strconv .FormatFloat (e .TracingSamplingRatio , 'f' , - 1 , 64 ))
@@ -352,6 +373,19 @@ func (e *EnvConfig) parse() error {
352373 return fmt .Errorf ("failed to parse %s = %q: %w" , envPromPort , promPortStr , err )
353374 }
354375
376+ e .PyroscopeAuthToken = os .Getenv (envPyroscopeAuthToken )
377+ e .PyroscopeServerAddress = os .Getenv (envPyroscopeServerAddress )
378+ e .PyroscopeEnvironment = os .Getenv (envPyroscopeEnvironment )
379+ e .PyroscopeLinkTracesToProfiles , err = getBool (envPyroscopeLinkTracesToProfiles )
380+ e .PyroscopePPROFBlockProfileRate , err = getInt (envPyroscopePPROFBlockProfileRate )
381+ if err != nil {
382+ return fmt .Errorf ("failed to parse %s: %w" , envPyroscopePPROFBlockProfileRate , err )
383+ }
384+ e .PyroscopePPROFMutexProfileFraction , err = getInt (envPyroscopePPROFMutexProfileFraction )
385+ if err != nil {
386+ return fmt .Errorf ("failed to parse %s: %w" , envPyroscopePPROFMutexProfileFraction , err )
387+ }
388+
355389 e .TracingEnabled , err = getBool (envTracingEnabled )
356390 if err != nil {
357391 return fmt .Errorf ("failed to parse %s: %w" , envTracingEnabled , err )
0 commit comments