Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add code-attributes profile for recording attributes from semconv 'code' ns #1500

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cli/cmd/resources/odiglet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resources

import (
"context"
"slices"

"k8s.io/apimachinery/pkg/api/resource"

Expand Down Expand Up @@ -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)
}
9 changes: 7 additions & 2 deletions cli/cmd/resources/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
}
)

Expand Down Expand Up @@ -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
}
}

Expand Down
Loading