Skip to content

Commit

Permalink
[processor/remotetap] remotetapprocessor adopts `component.UseLocalHo…
Browse files Browse the repository at this point in the history
…stAsDefaultHost` feature gate (open-telemetry#30905)

**Description:**
remotetapprocessor adopts `component.UseLocalHostAsDefaultHost` feature
gate

**Link to tracking Issue:** <Issue number if applicable>

open-telemetry#30702

**Documentation:**
Updated docs.
  • Loading branch information
atoulme authored and cparkins committed Feb 1, 2024
1 parent bc495bc commit fd18481
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .chloggen/mx-psi_internal-localhostgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ subtext: |
- receiver/opencensus
- receiver/zipkin
- receiver/awsfirehose
- processor/remotetap
# 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 processor/remotetapprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The WebSocket processor has two configurable fields: `port` and `limit`:

- `port`: The port on which the WebSocket processor listens. Optional. Defaults
to `12001`.
The `component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:12001. This will become the default in a future release.

- `limit`: The rate limit over the WebSocket in messages per second. Can be a
float or an integer. Optional. Defaults to `1`.

Expand Down
6 changes: 4 additions & 2 deletions processor/remotetapprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"golang.org/x/time/rate"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/localhostgate"
)

const defaultEndpoint = ":12001"
const defaultPort = 12001

type Config struct {
confighttp.HTTPServerConfig `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
Expand All @@ -22,7 +24,7 @@ type Config struct {
func createDefaultConfig() component.Config {
return &Config{
HTTPServerConfig: confighttp.HTTPServerConfig{
Endpoint: defaultEndpoint,
Endpoint: localhostgate.EndpointForPort(defaultPort),
},
Limit: 1,
}
Expand Down
2 changes: 1 addition & 1 deletion processor/remotetapprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ import (

func TestCreateDefaultConfig(t *testing.T) {
cfg := createDefaultConfig().(*Config)
assert.Equal(t, ":12001", cfg.Endpoint)
assert.Equal(t, "0.0.0.0:12001", cfg.Endpoint)
assert.EqualValues(t, 1, cfg.Limit)
}
3 changes: 3 additions & 0 deletions processor/remotetapprocessor/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/processor/remot
go 1.20

require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.93.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.93.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent v0.93.0
github.com/stretchr/testify v1.8.4
Expand Down Expand Up @@ -80,3 +81,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest => ../../pkg/pdatatest

replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden => ../../pkg/golden

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

0 comments on commit fd18481

Please sign in to comment.