Skip to content

Commit

Permalink
[receiver/loki] Use component.UseLocalHostAsDefaultHost feature gate (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi authored and cparkins committed Feb 1, 2024
1 parent 05f2a46 commit 0bfce27
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .chloggen/mx-psi_internal-localhostgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ issues: [30702]
# Use pipe (|) for multiline entries.
subtext: |
This change affects the following components:
- TBF
- receiver/loki
# 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: 1 addition & 1 deletion receiver/lokireceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This receiver runs HTTP and GRPC servers to ingest log entries in Loki format.

The settings are:

- `endpoint` (required, default = 0.0.0.0:3500 for HTTP protocol, 0.0.0.0:3600 gRPC protocol): host:port to which the receiver is going to receive data.
- `endpoint` (required, default = 0.0.0.0:3500 for HTTP protocol, 0.0.0.0:3600 gRPC protocol): host:port to which the receiver is going to receive data. The `component.UseLocalHostAsDefaultHost` feature gate changes these to localhost:3500 and localhost:3600. These will become the default in a future release.
- `use_incoming_timestamp` (optional, default = false) if set `true` the timestamp from Loki log entry is used

Example:
Expand Down
7 changes: 5 additions & 2 deletions receiver/lokireceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,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/receiver/lokireceiver/internal/metadata"
)

const (
defaultGRPCPort = 3600
defaultHTTPPort = 3500
defaultGRPCBindEndpoint = "0.0.0.0:3600"
defaultHTTPBindEndpoint = "0.0.0.0:3500"
)
Expand All @@ -36,12 +39,12 @@ func createDefaultConfig() component.Config {
Protocols: Protocols{
GRPC: &configgrpc.GRPCServerSettings{
NetAddr: confignet.NetAddr{
Endpoint: defaultGRPCBindEndpoint,
Endpoint: localhostgate.EndpointForPort(defaultGRPCPort),
Transport: "tcp",
},
},
HTTP: &confighttp.HTTPServerSettings{
Endpoint: defaultHTTPBindEndpoint,
Endpoint: localhostgate.EndpointForPort(defaultHTTPPort),
},
},
}
Expand Down

0 comments on commit 0bfce27

Please sign in to comment.