Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger committed Aug 7, 2024
1 parent 0a23100 commit a2f5aa4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 115 deletions.
9 changes: 0 additions & 9 deletions pkg/instrumentation/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,6 @@ func (i *sdkInjector) createResourceMap(ctx context.Context, otelinst v1alpha1.I
res[string(k)] = v
}
}

for k, v := range pod.GetAnnotations() {
if strings.HasPrefix(k, constants.OtelAnnotationNamespace) {
key := strings.TrimSpace(strings.TrimPrefix(k, constants.OtelAnnotationNamespace))
if _, ok := res[key]; !ok {
res[key] = v
}
}
}
return res
}

Expand Down
106 changes: 0 additions & 106 deletions pkg/instrumentation/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,112 +659,6 @@ func TestSDKInjection(t *testing.T) {
},
},
},
{
name: "Resource attribute propagate",
inst: v1alpha1.Instrumentation{
Spec: v1alpha1.InstrumentationSpec{
Exporter: v1alpha1.Exporter{
Endpoint: "https://collector:4317",
},
Resource: v1alpha1.Resource{
Attributes: map[string]string{
"fromcr": "val",
},
},
Propagators: []v1alpha1.Propagator{"jaeger"},
Sampler: v1alpha1.Sampler{
Type: "parentbased_traceidratio",
Argument: "0.25",
},
},
},
pod: corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{
"resource.opentelemetry.io/fromtest": "val",
"resource.opentelemetry.io/foo": "test",
},
Namespace: "project1",
Name: "app",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Image: "app:latest",
Env: []corev1.EnvVar{
{
Name: "OTEL_SERVICE_NAME",
Value: "explicitly_set",
},
{
Name: "OTEL_EXPORTER_OTLP_ENDPOINT",
Value: "explicitly_set",
},
{
Name: "OTEL_PROPAGATORS",
Value: "b3",
},
{
Name: "OTEL_TRACES_SAMPLER",
Value: "always_on",
},
{
Name: "OTEL_RESOURCE_ATTRIBUTES",
Value: "foo=bar,k8s.container.name=other,service.version=explicitly_set,",
},
},
},
},
},
},
expected: corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Namespace: "project1",
Name: "app",
Annotations: map[string]string{
"resource.opentelemetry.io/fromtest": "val",
"resource.opentelemetry.io/foo": "test",
},
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Image: "app:latest",
Env: []corev1.EnvVar{
{
Name: "OTEL_SERVICE_NAME",
Value: "explicitly_set",
},
{
Name: "OTEL_EXPORTER_OTLP_ENDPOINT",
Value: "explicitly_set",
},
{
Name: "OTEL_PROPAGATORS",
Value: "b3",
},
{
Name: "OTEL_TRACES_SAMPLER",
Value: "always_on",
},
{
Name: "OTEL_RESOURCE_ATTRIBUTES_NODE_NAME",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{
FieldPath: "spec.nodeName",
},
},
},
{
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",
},
},
},
},
},
},
},
}

for _, test := range tests {
Expand Down

0 comments on commit a2f5aa4

Please sign in to comment.