vc: missing information
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.
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.
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
But are these for eBPF profiler or for OTel collector? I'm assuming the latter.
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.