Skip to content

Commit a2f5aa4

Browse files
committed
fix rebase
1 parent 0a23100 commit a2f5aa4

File tree

2 files changed

+0
-115
lines changed

2 files changed

+0
-115
lines changed

pkg/instrumentation/sdk.go

-9
Original file line numberDiff line numberDiff line change
@@ -513,15 +513,6 @@ func (i *sdkInjector) createResourceMap(ctx context.Context, otelinst v1alpha1.I
513513
res[string(k)] = v
514514
}
515515
}
516-
517-
for k, v := range pod.GetAnnotations() {
518-
if strings.HasPrefix(k, constants.OtelAnnotationNamespace) {
519-
key := strings.TrimSpace(strings.TrimPrefix(k, constants.OtelAnnotationNamespace))
520-
if _, ok := res[key]; !ok {
521-
res[key] = v
522-
}
523-
}
524-
}
525516
return res
526517
}
527518

pkg/instrumentation/sdk_test.go

-106
Original file line numberDiff line numberDiff line change
@@ -659,112 +659,6 @@ func TestSDKInjection(t *testing.T) {
659659
},
660660
},
661661
},
662-
{
663-
name: "Resource attribute propagate",
664-
inst: v1alpha1.Instrumentation{
665-
Spec: v1alpha1.InstrumentationSpec{
666-
Exporter: v1alpha1.Exporter{
667-
Endpoint: "https://collector:4317",
668-
},
669-
Resource: v1alpha1.Resource{
670-
Attributes: map[string]string{
671-
"fromcr": "val",
672-
},
673-
},
674-
Propagators: []v1alpha1.Propagator{"jaeger"},
675-
Sampler: v1alpha1.Sampler{
676-
Type: "parentbased_traceidratio",
677-
Argument: "0.25",
678-
},
679-
},
680-
},
681-
pod: corev1.Pod{
682-
ObjectMeta: metav1.ObjectMeta{
683-
Annotations: map[string]string{
684-
"resource.opentelemetry.io/fromtest": "val",
685-
"resource.opentelemetry.io/foo": "test",
686-
},
687-
Namespace: "project1",
688-
Name: "app",
689-
},
690-
Spec: corev1.PodSpec{
691-
Containers: []corev1.Container{
692-
{
693-
Image: "app:latest",
694-
Env: []corev1.EnvVar{
695-
{
696-
Name: "OTEL_SERVICE_NAME",
697-
Value: "explicitly_set",
698-
},
699-
{
700-
Name: "OTEL_EXPORTER_OTLP_ENDPOINT",
701-
Value: "explicitly_set",
702-
},
703-
{
704-
Name: "OTEL_PROPAGATORS",
705-
Value: "b3",
706-
},
707-
{
708-
Name: "OTEL_TRACES_SAMPLER",
709-
Value: "always_on",
710-
},
711-
{
712-
Name: "OTEL_RESOURCE_ATTRIBUTES",
713-
Value: "foo=bar,k8s.container.name=other,service.version=explicitly_set,",
714-
},
715-
},
716-
},
717-
},
718-
},
719-
},
720-
expected: corev1.Pod{
721-
ObjectMeta: metav1.ObjectMeta{
722-
Namespace: "project1",
723-
Name: "app",
724-
Annotations: map[string]string{
725-
"resource.opentelemetry.io/fromtest": "val",
726-
"resource.opentelemetry.io/foo": "test",
727-
},
728-
},
729-
Spec: corev1.PodSpec{
730-
Containers: []corev1.Container{
731-
{
732-
Image: "app:latest",
733-
Env: []corev1.EnvVar{
734-
{
735-
Name: "OTEL_SERVICE_NAME",
736-
Value: "explicitly_set",
737-
},
738-
{
739-
Name: "OTEL_EXPORTER_OTLP_ENDPOINT",
740-
Value: "explicitly_set",
741-
},
742-
{
743-
Name: "OTEL_PROPAGATORS",
744-
Value: "b3",
745-
},
746-
{
747-
Name: "OTEL_TRACES_SAMPLER",
748-
Value: "always_on",
749-
},
750-
{
751-
Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME",
752-
ValueFrom: &corev1.EnvVarSource{
753-
FieldRef: &corev1.ObjectFieldSelector{
754-
FieldPath: "spec.nodeName",
755-
},
756-
},
757-
},
758-
{
759-
Name: "OTEL_RESOURCE_ATTRIBUTES",
760-
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",
761-
},
762-
},
763-
},
764-
},
765-
},
766-
},
767-
},
768662
}
769663

770664
for _, test := range tests {

0 commit comments

Comments
 (0)