From bfab71a53fda0ac2533c81de61e84adaa47c4149 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 19 Oct 2021 01:01:29 -0700 Subject: [PATCH] Change OTLP/HTTP default port from 4317 to 4318 (#1018) --- docs/public/sdk/GettingStarted.rst | 2 +- examples/otlp/README.md | 9 ++++----- .../otlp/opentelemetry-collector-config/config.dev.yaml | 2 +- exporters/otlp/README.md | 2 +- .../opentelemetry/exporters/otlp/otlp_environment.h | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/public/sdk/GettingStarted.rst b/docs/public/sdk/GettingStarted.rst index fcdce5b846..dc982fc391 100644 --- a/docs/public/sdk/GettingStarted.rst +++ b/docs/public/sdk/GettingStarted.rst @@ -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(new opentelemetry::exporter::otlp::OtlpHttpExporter(opts)); diff --git a/examples/otlp/README.md b/examples/otlp/README.md index cd85a392a1..0f6579288e 100644 --- a/examples/otlp/README.md +++ b/examples/otlp/README.md @@ -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 diff --git a/examples/otlp/opentelemetry-collector-config/config.dev.yaml b/examples/otlp/opentelemetry-collector-config/config.dev.yaml index d3fbfd8834..6eb0b28fcf 100644 --- a/examples/otlp/opentelemetry-collector-config/config.dev.yaml +++ b/examples/otlp/opentelemetry-collector-config/config.dev.yaml @@ -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: diff --git a/exporters/otlp/README.md b/exporters/otlp/README.md index e0b1b7f4bb..9ac6918ba7 100644 --- a/exporters/otlp/README.md +++ b/exporters/otlp/README.md @@ -63,7 +63,7 @@ auto exporter = std::unique_ptr(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 | diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_environment.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_environment.h index c06507daed..4a1882984b 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_environment.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_environment.h @@ -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())