Skip to content
Draft
Changes from 1 commit
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
11 changes: 9 additions & 2 deletions comp/trace/config/impl/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,15 @@ func prepareConfig(c corecompcfg.Component, tagger tagger.Component, ipc ipc.Com
cfg.ContainerTags = func(cid string) ([]string, error) {
return tagger.Tag(types.NewEntityID(types.ContainerID, cid), types.HighCardinality)
}
cfg.ContainerIDFromOriginInfo = func(originInfo origindetection.OriginInfo) (string, error) {
return tagger.GenerateContainerIDFromOriginInfo(originInfo)
if env.IsContainerized() {
cfg.ContainerIDFromOriginInfo = func(originInfo origindetection.OriginInfo) (string, error) {
return tagger.GenerateContainerIDFromOriginInfo(originInfo)
}
} else {
// In non-containerized environments, we will never be able to generate a container ID from the origin info, so don't bother the remote tagger.
cfg.ContainerIDFromOriginInfo = func(originInfo origindetection.OriginInfo) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this would work, but maybe we can even create a noop ID Provider for situations where IsContainerized() is false? The current one would not use the origin info features, but would still look into headers for container info: https://github.com/DataDog/datadog-agent/blob/main/pkg/trace/api/container_linux.go#L136-L181

return "", nil
}
}
cfg.ContainerProcRoot = coreConfigObject.GetString("container_proc_root")
cfg.AuthToken = ipc.GetAuthToken()
Expand Down
Loading