Skip to content

Commit

Permalink
[receiver/awsfirehose] Use component.UseLocalHostAsDefaultHost featur…
Browse files Browse the repository at this point in the history
…e gate (#30826)

**Description:** Fixes #30825
  • Loading branch information
mx-psi authored Jan 30, 2024
1 parent c302fba commit 2f55fec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions .chloggen/mx-psi_internal-localhostgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ subtext: |
- receiver/loki
- receiver/opencensus
- receiver/zipkin
- receiver/awsfirehose
# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
Expand Down
2 changes: 2 additions & 0 deletions receiver/awsfirehosereceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ The address:port to bind the listener to.
default: `0.0.0.0:4433`

The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:4433. This will become the default in a future release.

### tls:
See [documentation](https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configtls/README.md#server-configuration) for more details.

Expand Down
4 changes: 3 additions & 1 deletion receiver/awsfirehosereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"go.opentelemetry.io/collector/receiver"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/localhostgate"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/metadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream"
Expand All @@ -21,6 +22,7 @@ import (
const (
defaultRecordType = cwmetricstream.TypeStr
defaultEndpoint = "0.0.0.0:4433"
defaultPort = 4433
)

var (
Expand Down Expand Up @@ -63,7 +65,7 @@ func createDefaultConfig() component.Config {
return &Config{
RecordType: defaultRecordType,
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: localhostgate.EndpointForPort(defaultPort),
},
}
}
Expand Down
3 changes: 3 additions & 0 deletions receiver/awsfirehosereceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfir
go 1.20

require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.0.0-00010101000000-000000000000
github.com/stretchr/testify v1.8.4
go.opentelemetry.io/collector/component v0.93.1-0.20240129215828-1ed45ec12569
go.opentelemetry.io/collector/config/confighttp v0.93.1-0.20240129215828-1ed45ec12569
Expand Down Expand Up @@ -82,3 +83,5 @@ retract (
v0.76.1
v0.65.0
)

replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/common => ../../internal/common

0 comments on commit 2f55fec

Please sign in to comment.