Skip to content

Commit

Permalink
[receiver/opencensus] Use component.UseLocalHostAsDefaultHost featu…
Browse files Browse the repository at this point in the history
…re gate (#30817)

**Description:** Fixes #30816

---------

Co-authored-by: Alex Boten <[email protected]>
  • Loading branch information
mx-psi and Alex Boten committed Jan 30, 2024
1 parent 1dc6c52 commit c302fba
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 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 @@ -18,6 +18,7 @@ issues: [30702]
subtext: |
This change affects the following components:
- receiver/loki
- receiver/opencensus
- receiver/zipkin
# If your change doesn't affect end users or the exported elements of any package,
Expand Down
1 change: 1 addition & 0 deletions exporter/logzioexporter/example/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
receivers:
opencensus:
endpoint: :55678
zipkin:
endpoint: :9411
jaeger:
Expand Down
4 changes: 3 additions & 1 deletion receiver/opencensusreceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ The following settings are configurable:

- `endpoint` (default = 0.0.0.0:55678): host:port to which the receiver is
going to receive data. The valid syntax is described at
https://github.com/grpc/grpc/blob/master/doc/naming.md.
https://github.com/grpc/grpc/blob/master/doc/naming.md. The
`component.UseLocalHostAsDefaultHost` feature gate changes this to localhost:55678. This will become the default in a future release.


## Advanced Configuration

Expand Down
5 changes: 4 additions & 1 deletion receiver/opencensusreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import (
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/receiver"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/localhostgate"
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/sharedcomponent"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/opencensusreceiver/internal/metadata"
)

const grpcPort = 55678

// NewFactory creates a new OpenCensus receiver factory.
func NewFactory() receiver.Factory {
return receiver.NewFactory(
Expand All @@ -29,7 +32,7 @@ func createDefaultConfig() component.Config {
return &Config{
GRPCServerSettings: configgrpc.GRPCServerSettings{
NetAddr: confignet.NetAddr{
Endpoint: "0.0.0.0:55678",
Endpoint: localhostgate.EndpointForPort(grpcPort),
Transport: "tcp",
},
// We almost write 0 bytes, so no need to tune WriteBufferSize.
Expand Down

0 comments on commit c302fba

Please sign in to comment.