@@ -59,7 +59,7 @@ const (
59
59
6) Inject mounting of volumes / files into appropriate directories in application container
60
60
*/
61
61
62
- func injectApacheHttpdagent (_ logr.Logger , apacheSpec v1alpha1.ApacheHttpd , pod corev1.Pod , index int , otlpEndpoint string , resourceMap map [string ]string ) corev1.Pod {
62
+ func injectApacheHttpdagent (_ logr.Logger , apacheSpec v1alpha1.ApacheHttpd , pod corev1.Pod , useLabelsForResourceAttributes bool , index int , otlpEndpoint string , resourceMap map [string ]string ) corev1.Pod {
63
63
64
64
// caller checks if there is at least one container
65
65
container := & pod .Spec .Containers [index ]
@@ -95,7 +95,7 @@ func injectApacheHttpdagent(_ logr.Logger, apacheSpec v1alpha1.ApacheHttpd, pod
95
95
MountPath : apacheAgentConfDirFull ,
96
96
})
97
97
// remove resource requirements since those are then reserved for the lifetime of a pod
98
- // and we definitely do not need them for the init container for cp command
98
+ // ] and we definitely do not need them for the init container for cp command
99
99
cloneContainer .Resources = apacheSpec .Resources
100
100
// remove livenessProbe, readinessProbe, and startupProbe, since not supported on init containers
101
101
cloneContainer .LivenessProbe = nil
@@ -162,7 +162,7 @@ func injectApacheHttpdagent(_ logr.Logger, apacheSpec v1alpha1.ApacheHttpd, pod
162
162
Env : []corev1.EnvVar {
163
163
{
164
164
Name : apacheAttributesEnvVar ,
165
- Value : getApacheOtelConfig (pod , apacheSpec , index , otlpEndpoint , resourceMap ),
165
+ Value : getApacheOtelConfig (pod , useLabelsForResourceAttributes , apacheSpec , index , otlpEndpoint , resourceMap ),
166
166
},
167
167
{Name : apacheServiceInstanceIdEnvVar ,
168
168
ValueFrom : & corev1.EnvVarSource {
@@ -201,7 +201,7 @@ func isApacheInitContainerMissing(pod corev1.Pod, containerName string) bool {
201
201
202
202
// Calculate Apache HTTPD agent configuration file based on attributes provided by the injection rules
203
203
// and by the pod values.
204
- func getApacheOtelConfig (pod corev1.Pod , apacheSpec v1alpha1.ApacheHttpd , index int , otelEndpoint string , resourceMap map [string ]string ) string {
204
+ func getApacheOtelConfig (pod corev1.Pod , useLabelsForResourceAttributes bool , apacheSpec v1alpha1.ApacheHttpd , index int , otelEndpoint string , resourceMap map [string ]string ) string {
205
205
template := `
206
206
#Load the Otel Webserver SDK
207
207
LoadFile %[1]s/sdk_lib/lib/libopentelemetry_common.so
@@ -222,7 +222,7 @@ LoadModule otel_apache_module %[1]s/WebServerModule/Apache/libmod_apache_otel%[2
222
222
if otelEndpoint == "" {
223
223
otelEndpoint = "http://localhost:4317/"
224
224
}
225
- serviceName := chooseServiceName (pod , resourceMap , index )
225
+ serviceName := chooseServiceName (pod , useLabelsForResourceAttributes , resourceMap , index )
226
226
serviceNamespace := pod .GetNamespace ()
227
227
if len (serviceNamespace ) == 0 {
228
228
serviceNamespace = resourceMap [string (semconv .K8SNamespaceNameKey )]
0 commit comments