diff --git a/CHANGELOG.md b/CHANGELOG.md index 8af2963346b..24e316c0ab7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -107,7 +107,7 @@ v1.12.0-rc.0 - `prometheus.exporter.postgres` dependency has been updated to v0.18.1. This includes new `stat_progress_vacuum` and `buffercache_summary` collectors, as well as other bugfixes and enhancements. (@cristiangreco) -- Update Beyla component to 2.7.4. (@grcevski) +- Update Beyla component to 2.7.8. (@grcevski) - Support delimiters in `stage.luhn`. (@dehaansa) diff --git a/docs/sources/_index.md b/docs/sources/_index.md index 16cb8d68981..77335389dee 100644 --- a/docs/sources/_index.md +++ b/docs/sources/_index.md @@ -8,7 +8,7 @@ cascade: OTEL_VERSION: v0.139.0 PROM_WIN_EXP_VERSION: v0.31.3 SNMP_VERSION: v0.29.0 - BEYLA_VERSION: v2.5.8 + BEYLA_VERSION: v2.7.8 FULL_PRODUCT_NAME: Grafana Alloy PRODUCT_NAME: Alloy hero: diff --git a/docs/sources/_index.md.t b/docs/sources/_index.md.t index d0f86588baf..d97d73ec3fd 100644 --- a/docs/sources/_index.md.t +++ b/docs/sources/_index.md.t @@ -8,7 +8,7 @@ cascade: OTEL_VERSION: v0.139.0 PROM_WIN_EXP_VERSION: v0.31.3 SNMP_VERSION: v0.29.0 - BEYLA_VERSION: v2.5.8 + BEYLA_VERSION: v2.7.8 FULL_PRODUCT_NAME: Grafana Alloy PRODUCT_NAME: Alloy hero: diff --git a/docs/sources/reference/components/beyla/beyla.ebpf.md b/docs/sources/reference/components/beyla/beyla.ebpf.md index 1cd1ec237ac..012f43315d6 100644 --- a/docs/sources/reference/components/beyla/beyla.ebpf.md +++ b/docs/sources/reference/components/beyla/beyla.ebpf.md @@ -534,6 +534,8 @@ The `metrics` block configures which metrics Beyla collects. | `allow_service_graph_self_references` | `bool` | Allow service graph metrics to reference the same service. | `false` | no | | `features` | `list(string)` | List of features to enable for the metrics. | `["application"]` | no | | `instrumentations` | `list(string)` | List of instrumentations to enable for the metrics. | `["*"]` | no | +| `extra_resource_labels` | `list(string)` | List of OTEL resource labels to include on `target_info`. | `[]` | no | +| `extra_span_resource_labels` | `list(string)` | List of OTEL resource labels to include on span metrics. | `["k8s.cluster.name", "k8s.namespace.name", "service.version", "deployment.environment"]` | no | `features` is a list of features to enable for the metrics. The following features are available: @@ -558,6 +560,20 @@ The `metrics` block configures which metrics Beyla collects. * `redis` enables the collection of Redis client/server database metrics. * `sql` enables the collection of SQL database client call metrics. +`extra_resource_labels` is a list of OTEL resource labels, supplied through the `OTEL_RESOURCE_ATTRIBUTES` environment variable +on the service, that you want to include on the `target_info` metric. + +`extra_span_resource_labels` is a list of OTEL resource labels, supplied through the `OTEL_RESOURCE_ATTRIBUTES` environment variable +on the service, that you want to include on the span metrics. The default list includes: + +* `k8s.cluster.name` +* `k8s.namespace.name` +* `service.version` +* `deployment.environment` + +The default list of `extra_span_resource_labels` is set to match the defaults chosen by Application Observability plugin in +Grafana Cloud. + #### `network` metrics The `network` block configures network metrics options for Beyla. You must append `network` to the `features` list in the `metrics` block to enable network metrics. diff --git a/go.mod b/go.mod index 0da1f43ede2..93cd05a9dab 100644 --- a/go.mod +++ b/go.mod @@ -63,7 +63,7 @@ require ( github.com/gorilla/mux v1.8.1 github.com/grafana/alloy-remote-config v0.0.12 github.com/grafana/alloy/syntax v0.1.0 - github.com/grafana/beyla/v2 v2.7.6 + github.com/grafana/beyla/v2 v2.7.8 github.com/grafana/catchpoint-prometheus-exporter v0.0.0-20250218151502-6e97feaee761 github.com/grafana/ckit v0.0.0-20251024151910-87043f5a3cf7 github.com/grafana/cloudflare-go v0.0.0-20230110200409-c627cf6792f2 @@ -1082,8 +1082,8 @@ exclude ( k8s.io/client-go v12.0.0+incompatible ) -// replace go.opentelemetry.io/obi => github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.7 -replace go.opentelemetry.io/obi => github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.7 +// replace go.opentelemetry.io/obi => github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.9 +replace go.opentelemetry.io/obi => github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.10 replace go.opentelemetry.io/ebpf-profiler => github.com/grafana/opentelemetry-ebpf-profiler v0.0.202546-0.20251106085643-a00a0ef2a84c diff --git a/go.sum b/go.sum index 824fb67b9e2..47ff4c03be9 100644 --- a/go.sum +++ b/go.sum @@ -1129,8 +1129,8 @@ github.com/gosnmp/gosnmp v1.41.0 h1:6RI78g2ZsbLvpvJegcV98LapszRQnbvYNKSa5WbCll4= github.com/gosnmp/gosnmp v1.41.0/go.mod h1:CxVS6bXqmWZlafUj9pZUnQX5e4fAltqPcijxWpCitDo= github.com/grafana/alloy-remote-config v0.0.12 h1:zyuDgWaXBITD3OFY/LDh0iShDb3ye4Av39u2xY1JY1s= github.com/grafana/alloy-remote-config v0.0.12/go.mod h1:kHE1usYo2WAVCikQkIXuoG1Clz8BSdiz3kF+DZSCQ4k= -github.com/grafana/beyla/v2 v2.7.6 h1:fqkFSzBpuo81Udn9n2viphAM52LGXl3vXq8eUEqvhAA= -github.com/grafana/beyla/v2 v2.7.6/go.mod h1:isxApXkKInJ+itgn4lDqEfCb0a97TjxWzp1tf+fpWOE= +github.com/grafana/beyla/v2 v2.7.8 h1:GSfv09nOhhbIBP9uR5rEEAwPEpCn9Gq83HR9x2woDfU= +github.com/grafana/beyla/v2 v2.7.8/go.mod h1:isxApXkKInJ+itgn4lDqEfCb0a97TjxWzp1tf+fpWOE= github.com/grafana/cadvisor v0.0.0-20240729082359-1f04a91701e2 h1:ju6EcY2aEobeBg185ETtFCKj5WzaQ48qfkbsSRRQrF4= github.com/grafana/cadvisor v0.0.0-20240729082359-1f04a91701e2/go.mod h1:8sLW/G7rcFe1CKMaA4pYT4mX3P1xQVGqM6luzEzx/2g= github.com/grafana/catchpoint-prometheus-exporter v0.0.0-20250218151502-6e97feaee761 h1:dPJOIEwtQ8uR3Qa79pb/lsSFJQ6j4P9vpCUQ4fKimG4= @@ -1173,8 +1173,8 @@ github.com/grafana/opentelemetry-collector-contrib/processor/k8sattributesproces github.com/grafana/opentelemetry-collector-contrib/processor/k8sattributesprocessor v0.0.0-20251021125353-73458b01ab23/go.mod h1:7+xyIHr2PJNE9kic/D91c9SMxACdGIGCJykzTcqsYv0= github.com/grafana/opentelemetry-collector/featuregate v0.0.0-20240325174506-2fd1623b2ca0 h1:i/Ne0XwoRokYj52ZcSmnvuyID3h/uA91n0Ycg/grHU8= github.com/grafana/opentelemetry-collector/featuregate v0.0.0-20240325174506-2fd1623b2ca0/go.mod h1:mm8+xyQfgDmqhyegZRNIQmoKsNnDTwWKFLsdMoXAb7A= -github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.7 h1:1BIaJoHYtFNCCxW/JCOCAnWR+HyR5ISGkYwtzRb1d8I= -github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.7/go.mod h1:/O9nceaQ+yhwDdosHsQrs1AilAJWAZf2Laa2DssrjJk= +github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.10 h1:35vEGwoeJ379F7J1QejAeqVvD/8KHD5Jhw6/8+wSFJ0= +github.com/grafana/opentelemetry-ebpf-instrumentation v1.3.10/go.mod h1:/O9nceaQ+yhwDdosHsQrs1AilAJWAZf2Laa2DssrjJk= github.com/grafana/opentelemetry-ebpf-profiler v0.0.202546-0.20251106085643-a00a0ef2a84c h1:I9KB024eev8z9NRJZTcmTw0V0+txKLC6RqPUX3ADO2s= github.com/grafana/opentelemetry-ebpf-profiler v0.0.202546-0.20251106085643-a00a0ef2a84c/go.mod h1:eXOwk9x2rmJZ9+Ov5ot7NitRWNmF0jynNEeuIDRnK/Q= github.com/grafana/otel-profiling-go v0.5.1 h1:stVPKAFZSa7eGiqbYuG25VcqYksR6iWvF3YH66t4qL8= diff --git a/internal/component/beyla/ebpf/args.go b/internal/component/beyla/ebpf/args.go index a9c9063376a..4d27b87b97b 100644 --- a/internal/component/beyla/ebpf/args.go +++ b/internal/component/beyla/ebpf/args.go @@ -117,6 +117,8 @@ type Metrics struct { Instrumentations []string `alloy:"instrumentations,attr,optional"` AllowServiceGraphSelfReferences bool `alloy:"allow_service_graph_self_references,attr,optional"` Network Network `alloy:"network,block,optional"` + ExtraResourceLabels []string `alloy:"extra_resource_labels,attr,optional"` + ExtraSpanResourceLabels []string `alloy:"extra_span_resource_labels,attr,optional"` } type Traces struct { diff --git a/internal/component/beyla/ebpf/beyla_linux.go b/internal/component/beyla/ebpf/beyla_linux.go index f9f660c7100..da0c0d69c78 100644 --- a/internal/component/beyla/ebpf/beyla_linux.go +++ b/internal/component/beyla/ebpf/beyla_linux.go @@ -444,6 +444,12 @@ func (args Metrics) Convert() prom.PrometheusConfig { p.Instrumentations = args.Instrumentations } p.AllowServiceGraphSelfReferences = args.AllowServiceGraphSelfReferences + if args.ExtraResourceLabels != nil { + p.ExtraResourceLabels = args.ExtraResourceLabels + } + if args.ExtraSpanResourceLabels != nil { + p.ExtraSpanResourceLabels = args.ExtraSpanResourceLabels + } return p } diff --git a/internal/component/beyla/ebpf/beyla_linux_test.go b/internal/component/beyla/ebpf/beyla_linux_test.go index 1ecc021250c..f654c83543e 100644 --- a/internal/component/beyla/ebpf/beyla_linux_test.go +++ b/internal/component/beyla/ebpf/beyla_linux_test.go @@ -821,16 +821,37 @@ func TestConvert_Prometheus(t *testing.T) { Features: []string{"application", "network"}, Instrumentations: []string{"redis", "sql"}, AllowServiceGraphSelfReferences: true, + ExtraResourceLabels: nil, + ExtraSpanResourceLabels: []string{"service.version"}, } expectedConfig := beyla.DefaultConfig.Prometheus expectedConfig.Features = args.Features expectedConfig.Instrumentations = args.Instrumentations expectedConfig.AllowServiceGraphSelfReferences = true + expectedConfig.ExtraSpanResourceLabels = args.ExtraSpanResourceLabels config := args.Convert() require.Equal(t, expectedConfig, config) + + args = Metrics{ + Features: []string{"application", "network"}, + Instrumentations: []string{"redis", "sql"}, + AllowServiceGraphSelfReferences: true, + ExtraResourceLabels: []string{"service.version"}, + } + + expectedConfig = beyla.DefaultConfig.Prometheus + expectedConfig.Features = args.Features + expectedConfig.Instrumentations = args.Instrumentations + expectedConfig.AllowServiceGraphSelfReferences = true + expectedConfig.ExtraResourceLabels = args.ExtraResourceLabels + expectedConfig.ExtraSpanResourceLabels = []string{"k8s.cluster.name", "k8s.namespace.name", "service.version", "deployment.environment"} + + config = args.Convert() + + require.Equal(t, expectedConfig, config) } func TestConvert_Network(t *testing.T) {