Skip to content

Commit 67546ef

Browse files
authored
Fix splunkhec auth registration (#3963)
1 parent 0cf797e commit 67546ef

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Main (unreleased)
5050
- Propagate the `-feature.community-components.enabled` flag for remote
5151
configuration components. (@tpaschalis)
5252

53+
- Fix extension registration for `otelcol.receiver.splunkhec` auth extensions. (@dehaansa)
54+
5355
### Other changes
5456

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

internal/component/otelcol/receiver/splunkhec/splunkhec.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/grafana/alloy/internal/component"
1313
"github.com/grafana/alloy/internal/component/otelcol"
14+
"github.com/grafana/alloy/internal/component/otelcol/auth"
1415
otelconfig "github.com/grafana/alloy/internal/component/otelcol/config"
1516
"github.com/grafana/alloy/internal/component/otelcol/receiver"
1617
"github.com/grafana/alloy/internal/featuregate"
@@ -164,7 +165,16 @@ func (a Arguments) Exporters() map[pipeline.Signal]map[otelcomponent.ID]otelcomp
164165
func (a Arguments) Extensions() map[otelcomponent.ID]otelcomponent.Component {
165166
// FIXME(kalleep): Add support for ack extension.
166167
// https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.122.0/extension/ackextension
167-
return nil
168+
m := make(map[otelcomponent.ID]otelcomponent.Component)
169+
if a.HTTPServer.Authentication != nil {
170+
ext, err := a.HTTPServer.Authentication.GetExtension(auth.Server)
171+
// Extension will not be registered if there was an error.
172+
if err != nil {
173+
return m
174+
}
175+
m[ext.ID] = ext.Extension
176+
}
177+
return m
168178
}
169179

170180
// NextConsumers implements receiver.Arguments.

0 commit comments

Comments
 (0)