From a256d2b7c7f7fe626770f5f7e1e29cdb973f2eea Mon Sep 17 00:00:00 2001 From: Romain Marcadier Date: Mon, 6 Jan 2025 11:52:44 +0100 Subject: [PATCH] fix: workaround for otel agent dependency causes orchestrion failure Moved the blank import of `go.opentelemetry.io/collector/pdata/pprofile`` which was introduced to avoid `go mod tidy` from failing to resolve a coherent dependency closure into a new file guarded by a build tag so that it is not present in builds uder normal circumstances. This removes a dependency cycle caused by the `pprofile` package having a transitive dependency on `net/http`, while the `gopkg.in/DataDog/dd-trace-go.v1/internal` package is imported some code that is injected by orchestrion into `net/http` itself (resulting in a cycle, breaking builds). --- internal/agent-otel-workaround.go | 18 ++++++++++++++++++ internal/agent.go | 8 -------- internal/version/version.go | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 internal/agent-otel-workaround.go diff --git a/internal/agent-otel-workaround.go b/internal/agent-otel-workaround.go new file mode 100644 index 0000000000..f7b02edb0b --- /dev/null +++ b/internal/agent-otel-workaround.go @@ -0,0 +1,18 @@ +// Unless explicitly stated otherwise all files in this repository are licensed +// under the Apache License Version 2.0. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2022 Datadog, Inc. + +//go:build otel_workaround + +package internal + +import ( + // OTel did a breaking change to the module go.opentelemetry.io/collector/pdata which is imported by the agent + // and go.opentelemetry.io/collector/pdata/pprofile depends on it and is breaking because of it + // For some reason the dependency closure won't let use upgrade this module past the point where it does not break anymore + // So we are forced to add a blank import of this module to give us back the control over its version + // + // TODO: remove this once github.com/datadog-agent/pkg/trace has upgraded both modules past the breaking change + _ "go.opentelemetry.io/collector/pdata/pprofile" +) diff --git a/internal/agent.go b/internal/agent.go index 8b0023274a..f4bcdce8b0 100644 --- a/internal/agent.go +++ b/internal/agent.go @@ -11,14 +11,6 @@ import ( "os" "gopkg.in/DataDog/dd-trace-go.v1/internal/log" - - // OTel did a breaking change to the module go.opentelemetry.io/collector/pdata which is imported by the agent - // and go.opentelemetry.io/collector/pdata/pprofile depends on it and is breaking because of it - // For some reason the dependency closure won't let use upgrade this module past the point where it does not break anymore - // So we are forced to add a blank import of this module to give us back the control over its version - // - // TODO: remove this once github.com/datadog-agent/pkg/trace has upgraded both modules past the breaking change - _ "go.opentelemetry.io/collector/pdata/pprofile" ) const ( diff --git a/internal/version/version.go b/internal/version/version.go index 4d66f50ca4..5e8317b4fe 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -13,7 +13,7 @@ import ( // Tag specifies the current release tag. It needs to be manually // updated. A test checks that the value of Tag never points to a // git tag that is older than HEAD. -const Tag = "v1.70.2" +const Tag = "v1.70.3" // Dissected version number. Filled during init() var (