From 58a3a4fb29c5e2233e955744bf6e5a6834a4db04 Mon Sep 17 00:00:00 2001 From: Alan Wang Date: Thu, 8 Aug 2024 20:50:30 +0800 Subject: [PATCH] fix: unit test: TestSDKInjection/Resource_attribute_propagate (#3207) --- pkg/instrumentation/sdk_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/instrumentation/sdk_test.go b/pkg/instrumentation/sdk_test.go index 4a42184513..96346963dc 100644 --- a/pkg/instrumentation/sdk_test.go +++ b/pkg/instrumentation/sdk_test.go @@ -596,6 +596,14 @@ func TestSDKInjection(t *testing.T) { Name: "OTEL_TRACES_SAMPLER", Value: "always_on", }, + { + Name: "OTEL_RESOURCE_ATTRIBUTES_POD_NAME", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.name", + }, + }, + }, { Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME", ValueFrom: &corev1.EnvVarSource{ @@ -606,7 +614,7 @@ func TestSDKInjection(t *testing.T) { }, { Name: "OTEL_RESOURCE_ATTRIBUTES", - Value: "foo=bar,k8s.container.name=other,service.version=explicitly_set,foo=test,fromcr=val,fromtest=val,k8s.namespace.name=project1,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=app", + Value: "foo=bar,k8s.container.name=other,service.version=explicitly_set,foo=test,fromcr=val,fromtest=val,k8s.namespace.name=project1,k8s.node.name=$(OTEL_RESOURCE_ATTRIBUTES_NODE_NAME),k8s.pod.name=$(OTEL_RESOURCE_ATTRIBUTES_POD_NAME)", }, }, },