Skip to content

Commit 12b7786

Browse files
committed
Add service.instance.id with Pod name
1 parent dab898f commit 12b7786

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
@@ -445,7 +445,8 @@ func (i *sdkInjector) createResourceMap(ctx context.Context, otelinst v1alpha1.I
445445
k8sResources[semconv.K8SPodNameKey] = pod.Name
446446
k8sResources[semconv.K8SPodUIDKey] = string(pod.UID)
447447
k8sResources[semconv.K8SNodeNameKey] = pod.Spec.NodeName
448-
k8sResources[semconv.ServiceInstanceIDKey] = createServiceInstanceId(ns.Name, pod.Name, pod.Spec.Containers[index].Name)
448+
k8sResources[semconv.ServiceNameKey] = fmt.Sprintf("$(%s)", constants.EnvOTELServiceName)
449+
k8sResources[semconv.ServiceInstanceIDKey] = createServiceInstanceId(ns.Name, fmt.Sprintf("$(%s)", constants.EnvPodName), pod.Spec.Containers[index].Name)
449450
i.addParentResourceLabels(ctx, otelinst.Spec.Resource.AddK8sUIDAttributes, ns, pod.ObjectMeta, k8sResources)
450451
for k, v := range k8sResources {
451452
if !existingRes[string(k)] && v != "" {

0 commit comments

Comments
 (0)