Skip to content

Commit 760d320

Browse files
authored
fix: Use correct profiler version for symbol upload (#55)
serviceversion was incorrectly being used for the profiler version when uploading symbols. This change removes serviceversion as it was not used anywhere else and use profiler version instead. It also removes the "v" prefix from the profiler version.
1 parent c64b8cc commit 760d320

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

cli_flags.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ type arguments struct {
5151
pprofPrefix string
5252
sendErrorFrames bool
5353
serviceName string
54-
serviceVersion string
5554
environment string
5655
uploadSymbols bool
5756
uploadDynamicSymbols bool
@@ -73,7 +72,7 @@ func parseArgs() (*arguments, error) {
7372
versionInfo := version.GetVersionInfo()
7473

7574
cli.VersionPrinter = func(_ *cli.Command) {
76-
fmt.Printf("dd-otel-host-profiler, version %s (revision: %s, date: %s), arch: %v\n",
75+
fmt.Printf("dd-otel-host-profiler, version v%s (revision: %s, date: %s), arch: %v\n",
7776
versionInfo.Version, versionInfo.VcsRevision, versionInfo.VcsTime, runtime.GOARCH)
7877
}
7978

helpers.go

-3
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ func addTagsFromArgs(tags *reporter.Tags, args *arguments) {
5555
if args.serviceName != "" {
5656
*tags = append(*tags, reporter.MakeTag("service", args.serviceName))
5757
}
58-
if args.serviceVersion != "" {
59-
*tags = append(*tags, reporter.MakeTag("version", args.serviceVersion))
60-
}
6158
}
6259

6360
// isAPIKeyValid reports whether the given string is a structurally valid API key

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func mainWithExitCode() exitCode {
137137
unix.SIGINT, unix.SIGTERM, unix.SIGABRT)
138138
defer mainCancel()
139139

140-
log.Infof("Starting Datadog OTEL host profiler %s (revision: %s, date: %s), arch: %v",
140+
log.Infof("Starting Datadog OTEL host profiler v%s (revision: %s, date: %s), arch: %v",
141141
versionInfo.Version, versionInfo.VcsRevision, versionInfo.VcsTime, runtime.GOARCH)
142142

143143
if err = tracer.ProbeBPFSyscall(); err != nil {
@@ -214,7 +214,7 @@ func mainWithExitCode() exitCode {
214214
APIKey: args.apiKey,
215215
APPKey: args.appKey,
216216
Site: args.site,
217-
Version: args.serviceVersion,
217+
Version: versionInfo.Version,
218218
},
219219
}, containerMetadataProvider)
220220
if err != nil {

version/version.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55

66
package version
77

8-
import "runtime/debug"
8+
import (
9+
"runtime/debug"
10+
"strings"
11+
)
912

1013
var (
1114
// Version is the current version of the profiler
@@ -22,7 +25,7 @@ type Info struct {
2225
func GetVersionInfo() Info {
2326
buildInfo, ok := debug.ReadBuildInfo()
2427
versionInfo := Info{
25-
Version: version,
28+
Version: strings.TrimLeft(version, "v"),
2629
}
2730

2831
if !ok {

0 commit comments

Comments
 (0)