-
Notifications
You must be signed in to change notification settings - Fork 462
feat(ddtrace): implement version detection for dd-trace-go v1 non-transitional #3381
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
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 4475 Passed, 64 Skipped, 3m 40.55s Total Time |
internal/version/version.go
Outdated
minor, _ := strconv.Atoi(captures["mi"]) | ||
patch, _ := strconv.Atoi(captures["pa"]) | ||
rc, _ := strconv.Atoi(captures["rc"]) | ||
return major, minor, patch, rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an unrelated refactoring? Or was the plan to use parseVersion in v1.go
? If yes, why didn't this pan out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixge I pushed and left behind a change I wanted to introduce to replace the Tag
with the v1 transitional version, so logs show the version that users can see in their go.mod
as direct dependency (to avoid confusions).
You can see the change at 31564a3.
I'm also wondering if it's the right time to replace this ad hoc code with semver
instead. WDYT?
Update: I woke up with an idea about how to refactor it so we check debuginfo
once, and also warn on tracer's start: 59b5ceb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@felixge I rebased this against main
. Please, can you review it again? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for using semver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kakkoyun PR is going to have lots of changed go.mod
files due to adding a new dependency 😁 But worth it, it looks cleaner.
BenchmarksBenchmark execution time: 2025-04-10 08:47:54 Comparing candidate commit ef705e9 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 55 metrics, 1 unstable metrics. |
5b36869
to
63b79ab
Compare
internal/version/version.go
Outdated
minor, _ := strconv.Atoi(captures["mi"]) | ||
patch, _ := strconv.Atoi(captures["pa"]) | ||
rc, _ := strconv.Atoi(captures["rc"]) | ||
return major, minor, patch, rc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for using semver
internal/version/version.go
Outdated
|
||
func parseVersion(version string) (int, int, int, int) { | ||
var ( | ||
v = semver.MustParse(version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to go with MustParse
because this shouldn't fail ever. I consider this a canary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, left a refactor suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
a1c8934
to
757ae2d
Compare
…nsitional Co-authored-by: Kemal Akkoyun <[email protected]>
757ae2d
to
ef705e9
Compare
What does this PR do?
Adds v1 non-transitional versions of dd-trace-go present in the compiled binary.
It also sets the v1 transitional version as the tag version so logging for services instrumented with
v1.74.0
and higher show a v1 version, following the principle of least surprise.Motivation
v1.73.0 and below are not compatible with v2. They can't coexist.
Reviewer's Checklist
v2-dev
branch and reviewed by @DataDog/apm-go.Unsure? Have a question? Request a review!