Skip to content

Commit 66cf88b

Browse files
committed
Add service.instance.id with Pod name
1 parent fb23fde commit 66cf88b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/instrumentation/sdk.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ func (i *sdkInjector) createResourceMap(ctx context.Context, otelinst v1alpha1.I
473473
k8sResources[semconv.K8SPodNameKey] = pod.Name
474474
k8sResources[semconv.K8SPodUIDKey] = string(pod.UID)
475475
k8sResources[semconv.K8SNodeNameKey] = pod.Spec.NodeName
476-
k8sResources[semconv.ServiceInstanceIDKey] = createServiceInstanceId(ns.Name, pod.Name, pod.Spec.Containers[index].Name)
476+
k8sResources[semconv.ServiceNameKey] = fmt.Sprintf("$(%s)", constants.EnvOTELServiceName)
477+
k8sResources[semconv.ServiceInstanceIDKey] = createServiceInstanceId(ns.Name, fmt.Sprintf("$(%s)", constants.EnvPodName), pod.Spec.Containers[index].Name)
477478
i.addParentResourceLabels(ctx, otelinst.Spec.Resource.AddK8sUIDAttributes, ns, pod.ObjectMeta, k8sResources)
478479
for k, v := range k8sResources {
479480
if !existingRes[string(k)] && v != "" {

0 commit comments

Comments
 (0)