@@ -112,7 +112,7 @@ func DefaultEnv(cfg *config.Config) []corev1.EnvVar {
112
112
)
113
113
}
114
114
115
- func WorkspaceTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
115
+ func WorkspaceTracingEnv (context * RenderContext , component string ) (res []corev1.EnvVar ) {
116
116
var tracing * experimental.Tracing
117
117
118
118
_ = context .WithExperimental (func (cfg * experimental.Config ) error {
@@ -122,10 +122,10 @@ func WorkspaceTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
122
122
return nil
123
123
})
124
124
125
- return tracingEnv (context , tracing )
125
+ return tracingEnv (context , component , tracing )
126
126
}
127
127
128
- func WebappTracingEnv (context * RenderContext ) (res []corev1.EnvVar ) {
128
+ func WebappTracingEnv (context * RenderContext , component string ) (res []corev1.EnvVar ) {
129
129
var tracing * experimental.Tracing
130
130
131
131
_ = context .WithExperimental (func (cfg * experimental.Config ) error {
@@ -135,10 +135,10 @@ func WebappTracingEnv(context *RenderContext) (res []corev1.EnvVar) {
135
135
return nil
136
136
})
137
137
138
- return tracingEnv (context , tracing )
138
+ return tracingEnv (context , component , tracing )
139
139
}
140
140
141
- func tracingEnv (context * RenderContext , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
141
+ func tracingEnv (context * RenderContext , component string , tracing * experimental.Tracing ) (res []corev1.EnvVar ) {
142
142
if context .Config .Observability .Tracing == nil {
143
143
res = append (res , corev1.EnvVar {Name : "JAEGER_DISABLED" , Value : "true" })
144
144
return
@@ -154,6 +154,23 @@ func tracingEnv(context *RenderContext, tracing *experimental.Tracing) (res []co
154
154
// but would make env var composition more cumbersome.
155
155
}
156
156
157
+ res = append (res , corev1.EnvVar {Name : "JAEGER_SERVICE_NAME" , Value : component })
158
+
159
+ jaegerTags := []string {}
160
+ if context .Config .Metadata .InstallationShortname != "" {
161
+ jaegerTags = append (jaegerTags , fmt .Sprintf ("cluster=%v" , context .Config .Metadata .InstallationShortname ))
162
+ }
163
+
164
+ if context .Config .Metadata .Region != "" {
165
+ jaegerTags = append (jaegerTags , fmt .Sprintf ("region=%v" , context .Config .Metadata .Region ))
166
+ }
167
+
168
+ if len (jaegerTags ) > 0 {
169
+ res = append (res ,
170
+ corev1.EnvVar {Name : "JAEGER_TAGS" , Value : strings .Join (jaegerTags , "," )},
171
+ )
172
+ }
173
+
157
174
samplerType := experimental .TracingSampleTypeConst
158
175
samplerParam := "1"
159
176
@@ -164,6 +181,24 @@ func tracingEnv(context *RenderContext, tracing *experimental.Tracing) (res []co
164
181
if tracing .SamplerParam != nil {
165
182
samplerParam = strconv .FormatFloat (* tracing .SamplerParam , 'f' , - 1 , 64 )
166
183
}
184
+
185
+ if tracing .SecretName != nil {
186
+ res = append (res , corev1.EnvVar {
187
+ Name : "JAEGER_USER" ,
188
+ ValueFrom : & corev1.EnvVarSource {SecretKeyRef : & corev1.SecretKeySelector {
189
+ LocalObjectReference : corev1.LocalObjectReference {Name : * tracing .SecretName },
190
+ Key : "JAEGER_USER" ,
191
+ }},
192
+ })
193
+
194
+ res = append (res , corev1.EnvVar {
195
+ Name : "JAEGER_PASSWORD" ,
196
+ ValueFrom : & corev1.EnvVarSource {SecretKeyRef : & corev1.SecretKeySelector {
197
+ LocalObjectReference : corev1.LocalObjectReference {Name : * tracing .SecretName },
198
+ Key : "JAEGER_PASSWORD" ,
199
+ }},
200
+ })
201
+ }
167
202
}
168
203
169
204
res = append (res ,
0 commit comments