@@ -63,6 +63,32 @@ func DefaultEnv(cfg *config.Config) []corev1.EnvVar {
6363}
6464
6565func WorkspaceTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
66+ var tracing * experimental.Tracing
67+
68+ _ = context .WithExperimental (func (cfg * experimental.Config ) error {
69+ if cfg .Workspace != nil {
70+ tracing = cfg .Workspace .Tracing
71+ }
72+ return nil
73+ })
74+
75+ return tracingEnv (context , tracing )
76+ }
77+
78+ func WebappTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
79+ var tracing * experimental.Tracing
80+
81+ _ = context .WithExperimental (func (cfg * experimental.Config ) error {
82+ if cfg .WebApp != nil {
83+ tracing = cfg .WebApp .Tracing
84+ }
85+ return nil
86+ })
87+
88+ return tracingEnv (context , tracing )
89+ }
90+
91+ func tracingEnv (context * RenderContext , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
6692 if context .Config .Observability .Tracing == nil {
6793 res = append (res , corev1.EnvVar {Name : "JAEGER_DISABLED" , Value : "true" })
6894 return
@@ -81,17 +107,14 @@ func WorkspaceTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
81107 samplerType := experimental .TracingSampleTypeConst
82108 samplerParam := "1"
83109
84- _ = context .WithExperimental (func (ucfg * experimental.Config ) error {
85- if ucfg .Workspace != nil && ucfg .Workspace .Tracing != nil {
86- if ucfg .Workspace .Tracing .SamplerType != nil {
87- samplerType = * ucfg .Workspace .Tracing .SamplerType
88- }
89- if ucfg .Workspace .Tracing .SamplerParam != nil {
90- samplerParam = strconv .FormatFloat (* ucfg .Workspace .Tracing .SamplerParam , 'f' , - 1 , 64 )
91- }
110+ if tracing != nil {
111+ if tracing .SamplerType != nil {
112+ samplerType = * tracing .SamplerType
92113 }
93- return nil
94- })
114+ if tracing .SamplerParam != nil {
115+ samplerParam = strconv .FormatFloat (* tracing .SamplerParam , 'f' , - 1 , 64 )
116+ }
117+ }
95118
96119 res = append (res ,
97120 corev1.EnvVar {Name : "JAEGER_SAMPLER_TYPE" , Value : string (samplerType )},
0 commit comments