otel-profiling-agent icon indicating copy to clipboard operation
otel-profiling-agent copied to clipboard

vc: missing information

Open florianl opened this issue 6 months ago • 4 comments

Package vc is supposed to provide Revision(), BuildTimestmap() and Version() information.

Unfortunatly this information is only available, if the executable was compiled with the Makefile of the project:

https://github.com/open-telemetry/opentelemetry-ebpf-profiler/blob/a243f85bdb8559071e7bccb1ec545f19075df5a6/Makefile#L36-L43

In cases, where this project is just a dependency, like in the OTel Collector, these Make flags or targets are not used. Consequently vc.Revision(), vc.BuildTimestmap() and vc.Version() return empty strings.

Use debug.ParseBuildInfo(..) to dynamically get this information from the Go build system, if they are not set in other ways.

florianl avatar Jun 13 '25 15:06 florianl

If these flags are not used then this information (e.g. timestamp, revision) won't be present so debug.ParsebuildInfo won't be able to retrieve it.

For the case where the profiling agent is running as part of OTel Collector, we should either use a method specific to OTel collector to capture this information or use the versioning of the OTel Collector itself which should also unambiguously specify which eBPF profiler library version was used.

christos68k avatar Jun 13 '25 15:06 christos68k

If OTel collector, that includes eBPF profiler, is build with Go 1.18, then these information are available via debug.ParseBuildInfo(..). They are added by Go by default in BuildInfo.Settings with the following keys:

vcs: the version control system for the source tree where the build ran
vcs.revision: the revision identifier for the current commit or checkout
vcs.time: the modification time associated with vcs.revision, in RFC3339 format
vcs.modified: true or false indicating whether the source tree had local modifications

florianl avatar Jun 13 '25 15:06 florianl

But are these for eBPF profiler or for OTel collector? I'm assuming the latter.

christos68k avatar Jun 13 '25 15:06 christos68k

They are vcs information from the latter. But as the latter does have a go.mod file, one can point to a specific dependency commit.

florianl avatar Jun 13 '25 15:06 florianl