fix(beyla): Inject Beyla version into binary via ldflags#5735
Merged
Conversation
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief description of Pull Request
When Beyla is used as a library inside Alloy, the
beyla_build_infometric was reportingversion="unset"because Beyla's build-time version flags were never passed during Alloy's build process.This PR injects the Beyla version into the Alloy binary via
-ldflagsat compile time, so the correct version is exposed via thebeyla_build_infometric.Pull Request Details
Alloy builds Beyla as a Go library dependency. Unlike standalone Beyla builds, Alloy's build system was not passing the
ldflagsneeded to setpkg/buildinfo.Version, causing it to fall back to its default value of"unset".The fix retrieves the Beyla version directly from
go.modusinggo list -mand injects it at build time.Issue fixed by this Pull Request
Fixes grafana/beyla#2584
Fixes #4385
Changes are minimal and focused:
Makefile— fetch Beyla version fromgo.modand inject via ldflagscommon/metric.go— addVersionfield to parse the version labelbeyla_test.go— add test to verify version is not"unset"PR Checklist