Skip to content

Commit

Permalink
Change OTLP/HTTP default port from 4317 to 4318 (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Oct 19, 2021
1 parent 096c08b commit bfab71a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/public/sdk/GettingStarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ OpenTelemetry offers six tracing exporters out of the box:
// otlp http exporter
opentelemetry::exporter::otlp::OtlpHttpExporterOptions opts;
opts.url = "http://localhost:4317/v1/traces";
opts.url = "http://localhost:4318/v1/traces";
auto otlp_http_exporter =
std::unique_ptr<sdktrace::SpanExporter>(new opentelemetry::exporter::otlp::OtlpHttpExporter(opts));
Expand Down
9 changes: 4 additions & 5 deletions examples/otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ OpenTelemetry Collector with an OTLP receiver by running:
- On Unix based systems use:

```console
docker run --rm -it -p 4317:4317 -p 55681:55681 -v $(pwd)/examples/otlp:/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
docker run --rm -it -p 4317:4317 -p 4318:4318 -v $(pwd)/examples/otlp:/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
```

- On Windows use:

```console
docker run --rm -it -p 4317:4317 -p 55681:55681 -v "%cd%/examples/otlp":/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
docker run --rm -it -p 4317:4317 -p 4318:4318 -v "%cd%/examples/otlp":/cfg otel/opentelemetry-collector:0.19.0 --config=/cfg/opentelemetry-collector-config/config.dev.yaml
```

Note that the OTLP exporter connects to the Collector at `localhost:4317` by
default. This can be changed with first argument from command-line, for example:
Note that the OTLP gRPC and HTTP exporters connects to the Collector at `localhost:4317` and `localhost:4318:/v1/traces` respectively. This can be changed with first argument from command-line, for example:
`./example_otlp_grpc gateway.docker.internal:4317` and
`./example_otlp_http gateway.docker.internal:55681/v1/traces`.
`./example_otlp_http gateway.docker.internal:4318/v1/traces`.

Once you have the Collector running, see
[CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ receivers:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: "0.0.0.0:55681"
endpoint: "0.0.0.0:4318"
cors_allowed_origins:
- '*'
service:
Expand Down
2 changes: 1 addition & 1 deletion exporters/otlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ auto exporter = std::unique_ptr<sdktrace::SpanExporter>(new otlp::OtlpHttpExport

| Option | Env Variable |Default | Description |
| ------------ |-----|------------ |------|
| `url` | `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:4317/v1/traces` | The OTLP HTTP endpoint to connect to |
| `url` | `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:4318/v1/traces` | The OTLP HTTP endpoint to connect to |
| | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | | |
| `content_type` | n/a | `application/json` | Data format used - JSON or Binary |
| `json_bytes_mapping` | n/a | `JsonBytesMappingKind::kHexId` | Encoding used for trace_id and span_id |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ inline const std::string GetOtlpDefaultHttpEndpoint()
{
constexpr char kOtlpTracesEndpointEnv[] = "OTEL_EXPORTER_OTLP_TRACES_ENDPOINT";
constexpr char kOtlpEndpointEnv[] = "OTEL_EXPORTER_OTLP_ENDPOINT";
constexpr char kOtlpEndpointDefault[] = "http://localhost:4317/v1/traces";
constexpr char kOtlpEndpointDefault[] = "http://localhost:4318/v1/traces";

auto endpoint = opentelemetry::sdk::common::GetEnvironmentVariable(kOtlpTracesEndpointEnv);
if (endpoint.empty())
Expand Down

0 comments on commit bfab71a

Please sign in to comment.