Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ GO_ENV := GOEXPERIMENT=$(GOEXPERIMENT) GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOA
VERSION ?= $(shell bash ./tools/image-tag)
GIT_REVISION := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
BEYLA_MODULE := $(shell go list -m all | grep "^github.com/grafana/beyla" | head -1)
BEYLA_VERSION := $(shell echo $(BEYLA_MODULE) | cut -d' ' -f2)
BEYLA_PKG := $(shell echo $(BEYLA_MODULE) | cut -d' ' -f1)/pkg/buildinfo
VPREFIX := github.com/grafana/alloy/internal/build
VPREFIXSYNTAX := github.com/grafana/alloy/syntax/internal/stdlib
ifdef SOURCE_DATE_EPOCH
Expand All @@ -140,7 +143,8 @@ GO_LDFLAGS := -X $(VPREFIX).Branch=$(GIT_BRANCH) \
-X $(VPREFIXSYNTAX).Version=$(VERSION) \
-X $(VPREFIX).Revision=$(GIT_REVISION) \
-X $(VPREFIX).BuildUser=$(BUILDER_USER)@$(BUILDER_HOST) \
-X $(VPREFIX).BuildDate=$(shell date -u $(DATE_STAMP) +"%Y-%m-%dT%H:%M:%SZ")
-X $(VPREFIX).BuildDate=$(shell date -u $(DATE_STAMP) +"%Y-%m-%dT%H:%M:%SZ") \
-X $(BEYLA_PKG).Version=$(BEYLA_VERSION)

DEFAULT_FLAGS := $(GO_FLAGS)
DEBUG_GO_FLAGS := -ldflags "$(GO_LDFLAGS)" -tags "$(GO_TAGS)"
Expand Down
1 change: 1 addition & 0 deletions integration-tests/docker/common/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Value struct {
type Metric struct {
TestName string `json:"test_name"`
Name string `json:"__name__"`
Version string `json:"version"`
}

func (m *MetricResponse) Unmarshal(data []byte) error {
Expand Down
18 changes: 18 additions & 0 deletions integration-tests/docker/tests/beyla/beyla_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"testing"

"github.com/grafana/alloy/integration-tests/docker/common"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Comment on lines 8 to 11
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new imports are indented with spaces and are out of gofmt style (compare with other integration tests). This will likely fail formatting/lint checks; run gofmt so the import block uses tabs/standard alignment and ordering.

Copilot uses AI. Check for mistakes.

func TestBeylaMetrics(t *testing.T) {
Expand All @@ -23,3 +25,19 @@ func TestBeylaTraces(t *testing.T) {
}
common.TracesTest(t, tags, "beyla")
}

// Test that checks that the Beyla version is correctly injected into the binary.
func TestBeylaVersion(t *testing.T) {
var metricResponse common.MetricResponse
require.EventuallyWithT(t, func(c *assert.CollectT) {
_, err := common.FetchDataFromURL(
common.MetricQuery("beyla_internal_build_info", "beyla"),
&metricResponse,
)
// Ensure the version label is not the default "unset" value
assert.NoError(c, err)
if assert.NotEmpty(c, metricResponse.Data.Result) {
assert.NotEqual(c, "unset", metricResponse.Data.Result[0].Metric.Version)
}
}, common.TestTimeoutEnv(t), common.DefaultRetryInterval)
}
Loading