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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Main (unreleased)

- Mark `pyroscope.receive_http` and `pyroscope.relabel` components as GA. (@marcsanmi)

- Upgrade `otelcol` components from OpenTelemetry v0.126.0 to v0.127.0 (@korniltsev)
- Upgrade `otelcol` components from OpenTelemetry v0.126.0 to v0.128.0 (@korniltsev)

v1.9.1
-----------------
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ description: Grafana Alloy is a vendor-neutral distribution of the OTel Collecto
weight: 350
cascade:
ALLOY_RELEASE: v1.10.0
OTEL_VERSION: v0.125.0
OTEL_VERSION: v0.128.0
PROM_WIN_EXP_VERSION: v0.30.7
SNMP_VERSION: v0.29.0
BEYLA_VERSION: v2.1
BEYLA_VERSION: v2.2.5
FULL_PRODUCT_NAME: Grafana Alloy
PRODUCT_NAME: Alloy
hero:
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/_index.md.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ description: Grafana Alloy is a vendor-neutral distribution of the OTel Collecto
weight: 350
cascade:
ALLOY_RELEASE: $ALLOY_VERSION
OTEL_VERSION: v0.125.0
OTEL_VERSION: v0.128.0
PROM_WIN_EXP_VERSION: v0.30.7
SNMP_VERSION: v0.29.0
BEYLA_VERSION: v2.1
BEYLA_VERSION: v2.2.5
FULL_PRODUCT_NAME: Grafana Alloy
PRODUCT_NAME: Alloy
hero:
Expand Down
565 changes: 281 additions & 284 deletions go.mod

Large diffs are not rendered by default.

1,252 changes: 638 additions & 614 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions internal/component/otelcol/auth/oauth2/oauth2.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type Arguments struct {
TokenURL string `alloy:"token_url,attr"`
EndpointParams url.Values `alloy:"endpoint_params,attr,optional"`
Scopes []string `alloy:"scopes,attr,optional"`
TLSSetting otelcol.TLSClientArguments `alloy:"tls,block,optional"`
TLS otelcol.TLSClientArguments `alloy:"tls,block,optional"`
Timeout time.Duration `alloy:"timeout,attr,optional"`
// DebugMetrics configures component internal metrics. Optional.
DebugMetrics otelcolCfg.DebugMetricsArguments `alloy:"debug_metrics,block,optional"`
Expand All @@ -62,7 +62,7 @@ func (args Arguments) ConvertClient() (otelcomponent.Config, error) {
TokenURL: args.TokenURL,
EndpointParams: args.EndpointParams,
Scopes: args.Scopes,
TLSSetting: *args.TLSSetting.Convert(),
TLS: *args.TLS.Convert(),
Timeout: args.Timeout,
}, nil
}
Expand Down
6 changes: 3 additions & 3 deletions internal/component/otelcol/config_grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (args *GRPCServerArguments) Convert() (*otelconfiggrpc.ServerConfig, error)
Transport: confignet.TransportType(args.Transport),
},

TLSSetting: args.TLS.Convert(),
TLS: args.TLS.Convert(),

MaxRecvMsgSizeMiB: int(args.MaxRecvMsgSize / units.Mebibyte),
MaxConcurrentStreams: args.MaxConcurrentStreams,
Expand Down Expand Up @@ -208,8 +208,8 @@ func (args *GRPCClientArguments) Convert() (*otelconfiggrpc.ClientConfig, error)

Compression: args.Compression.Convert(),

TLSSetting: *args.TLS.Convert(),
Keepalive: args.Keepalive.Convert(),
TLS: *args.TLS.Convert(),
Keepalive: args.Keepalive.Convert(),

ReadBufferSize: int(args.ReadBufferSize),
WriteBufferSize: int(args.WriteBufferSize),
Expand Down
12 changes: 7 additions & 5 deletions internal/component/otelcol/config_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (args *HTTPServerArguments) Convert() (*otelconfighttp.ServerConfig, error)

return &otelconfighttp.ServerConfig{
Endpoint: args.Endpoint,
TLSSetting: args.TLS.Convert(),
TLS: args.TLS.Convert(),
CORS: args.CORS.Convert(),
MaxRequestBodySize: int64(args.MaxRequestBodySize),
IncludeMetadata: args.IncludeMetadata,
Expand Down Expand Up @@ -170,7 +170,7 @@ func (args *HTTPClientArguments) Convert() (*otelconfighttp.ClientConfig, error)

Compression: args.Compression.Convert(),

TLSSetting: *args.TLS.Convert(),
TLS: *args.TLS.Convert(),

ReadBufferSize: int(args.ReadBufferSize),
WriteBufferSize: int(args.WriteBufferSize),
Expand Down Expand Up @@ -213,12 +213,14 @@ type Cookies struct {
Enabled bool `alloy:"enabled,attr,optional"`
}

func (c *Cookies) Convert() *otelconfighttp.CookiesConfig {
func (c *Cookies) Convert() otelconfighttp.CookiesConfig {
if c == nil {
return nil
return otelconfighttp.CookiesConfig{
Enabled: false,
}
}

return &otelconfighttp.CookiesConfig{
return otelconfighttp.CookiesConfig{
Enabled: c.Enabled,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (args *DatadogClientArguments) Convert() *confighttp.ClientConfig {
MaxConnsPerHost: args.MaxConnsPerHost,
IdleConnTimeout: args.IdleConnTimeout,
DisableKeepAlives: args.DisableKeepAlives,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
InsecureSkipVerify: args.InsecureSkipVerify,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ func (args *GRPCClientArguments) Convert() (*otelconfiggrpc.ClientConfig, error)
return &otelconfiggrpc.ClientConfig{
Compression: args.Compression.Convert(),

TLSSetting: *args.TLS.Convert(),
Keepalive: args.Keepalive.Convert(),
TLS: *args.TLS.Convert(),
Keepalive: args.Keepalive.Convert(),

ReadBufferSize: int(args.ReadBufferSize),
WriteBufferSize: int(args.WriteBufferSize),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (args *SplunkHecClientArguments) Convert() *confighttp.ClientConfig {
MaxConnsPerHost: args.MaxConnsPerHost,
IdleConnTimeout: args.IdleConnTimeout,
DisableKeepAlives: args.DisableKeepAlives,
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
InsecureSkipVerify: args.InsecureSkipVerify,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestConfigConversion(t *testing.T) {
expectedCustomise := splunkhecexporter.Config{
ClientConfig: confighttp.ClientConfig{
Endpoint: "http://localhost:8088", ProxyURL: "",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Config: configtls.Config{
CAFile: "",
CAPem: "",
Expand Down Expand Up @@ -50,7 +50,7 @@ func TestConfigConversion(t *testing.T) {
DisableKeepAlives: false,
HTTP2ReadIdleTimeout: 0,
HTTP2PingTimeout: 0,
Cookies: (*confighttp.CookiesConfig)(nil),
Cookies: confighttp.CookiesConfig{},
},
QueueSettings: exporterhelper.QueueBatchConfig{
Enabled: true,
Expand Down Expand Up @@ -110,7 +110,7 @@ func TestConfigConversion(t *testing.T) {
ClientConfig: confighttp.ClientConfig{
Endpoint: "http://localhost:8088",
ProxyURL: "",
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Config: configtls.Config{
CAFile: "",
CAPem: "",
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestConfigConversion(t *testing.T) {
DisableKeepAlives: false,
HTTP2ReadIdleTimeout: 0,
HTTP2PingTimeout: 0,
Cookies: (*confighttp.CookiesConfig)(nil)},
Cookies: confighttp.CookiesConfig{}},
QueueSettings: exporterhelper.QueueBatchConfig{
Enabled: true,
NumConsumers: 10,
Expand Down
2 changes: 1 addition & 1 deletion internal/component/otelcol/exporter/syslog/syslog.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {
Port: args.Port,
Network: args.Network,
Protocol: string(args.Protocol),
TLSSetting: *args.TLS.Convert(),
TLS: *args.TLS.Convert(),
EnableOctetCounting: args.EnableOctetCounting,
}, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import (
"testing"
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/metadata"

"github.com/jaegertracing/jaeger-idl/proto-gen/api_v2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/config/configtls"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)

func TestNewExtension(t *testing.T) {
Expand Down Expand Up @@ -102,7 +103,7 @@ func TestRemote(t *testing.T) {
cfg.Source.ReloadInterval = tc.reloadInterval
cfg.Source.Remote = &configgrpc.ClientConfig{
Endpoint: fmt.Sprintf("127.0.0.1:%d", lis.Addr().(*net.TCPAddr).Port),
TLSSetting: configtls.ClientConfig{
TLS: configtls.ClientConfig{
Insecure: true, // test only
},
WaitForReady: true,
Expand Down
12 changes: 10 additions & 2 deletions internal/component/otelcol/receiver/otlp/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/grafana/alloy/internal/component/otelcol/receiver"
"github.com/grafana/alloy/internal/featuregate"
otelcomponent "go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/receiver/otlpreceiver"
)
Expand Down Expand Up @@ -97,8 +98,8 @@ func (args Arguments) Convert() (otelcomponent.Config, error) {

return &otlpreceiver.Config{
Protocols: otlpreceiver.Protocols{
GRPC: grpcProtocolArgs,
HTTP: httpProtocolArgs,
GRPC: convertOptional(grpcProtocolArgs),
HTTP: convertOptional(httpProtocolArgs),
},
}, nil
}
Expand Down Expand Up @@ -200,3 +201,10 @@ func (args *HTTPConfigArguments) SetToDefault() {
func (args Arguments) DebugMetricsConfig() otelcolCfg.DebugMetricsArguments {
return args.DebugMetrics
}

func convertOptional[T any](it *T) configoptional.Optional[T] {
if it == nil {
return configoptional.None[T]()
}
return configoptional.Some[T](*it)
}
12 changes: 7 additions & 5 deletions internal/component/otelcol/receiver/otlp/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"testing"
"time"

"gotest.tools/assert"

"github.com/grafana/alloy/internal/component/otelcol"
otelcolCfg "github.com/grafana/alloy/internal/component/otelcol/config"
"github.com/grafana/alloy/internal/component/otelcol/internal/fakeconsumer"
Expand All @@ -21,9 +23,9 @@ import (
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/confignet"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/receiver/otlpreceiver"
"gotest.tools/assert"
)

// Test performs a basic integration test which runs the otelcol.receiver.otlp
Expand Down Expand Up @@ -133,7 +135,7 @@ func TestUnmarshalDefault(t *testing.T) {

expected := otlpreceiver.Config{
Protocols: otlpreceiver.Protocols{
GRPC: &configgrpc.ServerConfig{
GRPC: configoptional.Some[configgrpc.ServerConfig](configgrpc.ServerConfig{
NetAddr: confignet.AddrConfig{
Endpoint: "0.0.0.0:4317",
Transport: "tcp",
Expand All @@ -143,8 +145,8 @@ func TestUnmarshalDefault(t *testing.T) {
ServerParameters: &configgrpc.KeepaliveServerParameters{},
EnforcementPolicy: &configgrpc.KeepaliveEnforcementPolicy{},
},
},
HTTP: &otlpreceiver.HTTPConfig{
}),
HTTP: configoptional.Some[otlpreceiver.HTTPConfig](otlpreceiver.HTTPConfig{
ServerConfig: confighttp.ServerConfig{
Endpoint: "0.0.0.0:4318",
CompressionAlgorithms: []string{"", "gzip", "zstd", "zlib", "snappy", "deflate", "lz4"},
Expand All @@ -153,7 +155,7 @@ func TestUnmarshalDefault(t *testing.T) {
TracesURLPath: "/v1/traces",
MetricsURLPath: "/v1/metrics",
LogsURLPath: "/v1/logs",
},
}),
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func toDatadogHTTPClientArguments(cfg confighttp.ClientConfig) datadog_config.Da
MaxConnsPerHost: cfg.MaxConnsPerHost,
IdleConnTimeout: cfg.IdleConnTimeout,
DisableKeepAlives: cfg.DisableKeepAlives,
InsecureSkipVerify: cfg.TLSSetting.Insecure,
InsecureSkipVerify: cfg.TLS.Insecure,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func toProtocol(cfg loadbalancingexporter.Protocol) loadbalancing.Protocol {
Client: loadbalancing.GRPCClientArguments{
Compression: otelcol.CompressionType(cfg.OTLP.ClientConfig.Compression),

TLS: toTLSClientArguments(cfg.OTLP.ClientConfig.TLSSetting),
TLS: toTLSClientArguments(cfg.OTLP.ClientConfig.TLS),
Keepalive: toKeepaliveClientArguments(cfg.OTLP.ClientConfig.Keepalive),

ReadBufferSize: units.Base2Bytes(cfg.OTLP.ClientConfig.ReadBufferSize),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func toOAuth2ClientAuthExtension(cfg *oauth2clientauthextension.Config) *oauth2.
TokenURL: cfg.TokenURL,
EndpointParams: cfg.EndpointParams,
Scopes: cfg.Scopes,
TLSSetting: toTLSClientArguments(cfg.TLSSetting),
TLS: toTLSClientArguments(cfg.TLS),
Timeout: cfg.Timeout,
DebugMetrics: common.DefaultValue[oauth2.Arguments]().DebugMetrics,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func toGRPCClientArguments(cfg configgrpc.ClientConfig) otelcol.GRPCClientArgume

Compression: otelcol.CompressionType(cfg.Compression),

TLS: toTLSClientArguments(cfg.TLSSetting),
TLS: toTLSClientArguments(cfg.TLS),
Keepalive: toKeepaliveClientArguments(cfg.Keepalive),

ReadBufferSize: units.Base2Bytes(cfg.ReadBufferSize),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func toHTTPClientArguments(cfg confighttp.ClientConfig) otelcol.HTTPClientArgume
Endpoint: cfg.Endpoint,
ProxyUrl: cfg.ProxyURL,
Compression: otelcol.CompressionType(cfg.Compression),
TLS: toTLSClientArguments(cfg.TLSSetting),
TLS: toTLSClientArguments(cfg.TLS),
ReadBufferSize: units.Base2Bytes(cfg.ReadBufferSize),
WriteBufferSize: units.Base2Bytes(cfg.WriteBufferSize),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"go.opentelemetry.io/collector/component/componentstatus"
"go.opentelemetry.io/collector/config/configgrpc"
"go.opentelemetry.io/collector/config/confighttp"
"go.opentelemetry.io/collector/config/configoptional"
"go.opentelemetry.io/collector/config/configtls"
"go.opentelemetry.io/collector/pipeline"
"go.opentelemetry.io/collector/receiver/otlpreceiver"
Expand Down Expand Up @@ -53,7 +54,7 @@ func toOtelcolReceiverOTLP(state *State, id componentstatus.InstanceID, cfg *otl
)

return &otlp.Arguments{
GRPC: (*otlp.GRPCServerArguments)(toGRPCServerArguments(cfg.GRPC)),
GRPC: (*otlp.GRPCServerArguments)(toGRPCServerArguments(cfg.GRPC.Get())),
HTTP: toHTTPConfigArguments(cfg.HTTP),

DebugMetrics: common.DefaultValue[otlp.Arguments]().DebugMetrics,
Expand All @@ -75,7 +76,7 @@ func toGRPCServerArguments(cfg *configgrpc.ServerConfig) *otelcol.GRPCServerArgu
Endpoint: cfg.NetAddr.Endpoint,
Transport: string(cfg.NetAddr.Transport),

TLS: toTLSServerArguments(cfg.TLSSetting),
TLS: toTLSServerArguments(cfg.TLS),

MaxRecvMsgSize: units.Base2Bytes(cfg.MaxRecvMsgSizeMiB) * units.MiB,
MaxConcurrentStreams: cfg.MaxConcurrentStreams,
Expand Down Expand Up @@ -153,10 +154,11 @@ func toKeepaliveEnforcementPolicy(cfg *configgrpc.KeepaliveEnforcementPolicy) *o
}
}

func toHTTPConfigArguments(cfg *otlpreceiver.HTTPConfig) *otlp.HTTPConfigArguments {
if cfg == nil {
func toHTTPConfigArguments(ocfg configoptional.Optional[otlpreceiver.HTTPConfig]) *otlp.HTTPConfigArguments {
if !ocfg.HasValue() {
return nil
}
cfg := ocfg.Get()

return &otlp.HTTPConfigArguments{
HTTPServerArguments: toHTTPServerArguments(&cfg.ServerConfig),
Expand All @@ -182,7 +184,7 @@ func toHTTPServerArguments(cfg *confighttp.ServerConfig) *otelcol.HTTPServerArgu
return &otelcol.HTTPServerArguments{
Endpoint: cfg.Endpoint,

TLS: toTLSServerArguments(cfg.TLSSetting),
TLS: toTLSServerArguments(cfg.TLS),

CORS: toCORSArguments(cfg.CORS),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ func convertMetrics(_ *builder.File, tel otel_tel.MetricsConfig) diag.Diagnostic
diags.Add(diag.SeverityLevelWarn, "the service/telemetry/metrics/readers configuration is not supported - to gather Alloy's own telemetry refer to: https://grafana.com/docs/alloy/latest/collect/metamonitoring/")
}

if len(tel.Address) > 0 { //nolint:staticcheck //TODO: remove this check once the field is removed from upstream.
diags.Add(diag.SeverityLevelWarn, "the service/telemetry/metrics/address configuration is not supported - use the `--server.http.listen-addr` cmd argument or the `prometheus.exporter.self` component instead")
}

return diags
}

Expand Down
Loading