diff --git a/cli/cmd/resources/odiglet.go b/cli/cmd/resources/odiglet.go index 5c962e8a7..50fd3a8f1 100644 --- a/cli/cmd/resources/odiglet.go +++ b/cli/cmd/resources/odiglet.go @@ -2,6 +2,7 @@ package resources import ( "context" + "slices" "k8s.io/apimachinery/pkg/api/resource" @@ -709,9 +710,18 @@ func (a *odigletResourceManager) InstallFromScratch(ctx context.Context) error { resources = append(resources, NewResourceQuota(a.ns)) } + // temporary hack - check if the profiles named "code-attributes" or "kratos" are enabled. + // in the future, the go code attribute collection should be handled on an otel-sdk level + // instead of setting a global environment variable. + // once this is done, we can remove this check. + goAutoIncludeCodeAttributes := a.config.GoAutoIncludeCodeAttributes + if slices.Contains(a.config.Profiles, "code-attributes") || slices.Contains(a.config.Profiles, "kratos") { + goAutoIncludeCodeAttributes = true + } + // before creating the daemonset, we need to create the service account, cluster role and cluster role binding resources = append(resources, - NewOdigletDaemonSet(a.ns, a.odigosVersion, a.config.ImagePrefix, odigletImage, a.odigosTier, a.config.OpenshiftEnabled, a.config.GoAutoIncludeCodeAttributes)) + NewOdigletDaemonSet(a.ns, a.odigosVersion, a.config.ImagePrefix, odigletImage, a.odigosTier, a.config.OpenshiftEnabled, goAutoIncludeCodeAttributes)) return a.client.ApplyResources(ctx, a.config.ConfigVersion, resources) } diff --git a/cli/cmd/resources/profiles.go b/cli/cmd/resources/profiles.go index 5f5f32ab8..6e8bf8b96 100644 --- a/cli/cmd/resources/profiles.go +++ b/cli/cmd/resources/profiles.go @@ -51,11 +51,15 @@ var ( ShortDescription: "Instrument Java applications using native instrumentation and eBPF enterprise processing", ClientObject: &odigosv1alpha1.InstrumentationRule{}, } + codeAttributesProfile = Profile{ + ProfileName: common.ProfileName("code-attributes"), + ShortDescription: "Record span attributes in 'code' namespace where supported", + } kratosProfile = Profile{ ProfileName: common.ProfileName("kratos"), - ShortDescription: "Bundle profile that includes full-payload-collection, semconv, category-attributes, copy-scope, hostname-as-podname, java-native-instrumentations", - Dependencies: []common.ProfileName{"full-payload-collection", "semconv", "category-attributes", "copy-scope", "hostname-as-podname", "java-native-instrumentations"}, + ShortDescription: "Bundle profile that includes full-payload-collection, semconv, category-attributes, copy-scope, hostname-as-podname, java-native-instrumentations, code-attributes", + Dependencies: []common.ProfileName{"full-payload-collection", "semconv", "category-attributes", "copy-scope", "hostname-as-podname", "java-native-instrumentations", "code-attributes"}, } ) @@ -87,6 +91,7 @@ func GetResourcesForProfileName(profileName common.ProfileName, tier common.Odig } return allResources, nil } + return nil, nil // a profile might not be implemented as a resource necessarily } }