Skip to content

Commit 3218d8a

Browse files
Change default OTLP/HTTP port number (#3743)
This implements specification change open-telemetry/opentelemetry-specification#1839 To make transition to new port numbers less painful OTLP receiver will also accept data on the legacy port numbers when it is configured to use the default endpoint. Users who use the default Collector config can continue sending data to the legacy ports and have a graceful period to update their senders to start sending to the new ports.
1 parent 9fd1f5f commit 3218d8a

File tree

8 files changed

+28
-15
lines changed

8 files changed

+28
-15
lines changed

cmd/configschema/docsgen/docsgen/testdata/otlp-receiver.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@
270270
"Name": "endpoint",
271271
"Type": "",
272272
"Kind": "string",
273-
"Default": "0.0.0.0:55681",
273+
"Default": "0.0.0.0:4318",
274274
"Doc": "Endpoint configures the listening address for the server.\n",
275275
"Fields": null
276276
},

exporter/otlphttpexporter/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ incompatible way any time.*
99

1010
The following settings are required:
1111

12-
- `endpoint` (no default): The target base URL to send data to (e.g.: https://example.com:55681).
12+
- `endpoint` (no default): The target base URL to send data to (e.g.: https://example.com:4318).
1313
To send each signal a corresponding path will be added to this base URL, i.e. for traces
1414
"/v1/traces" will appended, for metrics "/v1/metrics" will be appended, for logs
1515
"/v1/logs" will be appended.
1616

1717
The following settings can be optionally configured:
1818

19-
- `traces_endpoint` (no default): The target URL to send trace data to (e.g.: https://example.com:55681/v1/traces).
19+
- `traces_endpoint` (no default): The target URL to send trace data to (e.g.: https://example.com:4318/v1/traces).
2020
If this setting is present the `endpoint` setting is ignored for traces.
21-
- `metrics_endpoint` (no default): The target URL to send metric data to (e.g.: https://example.com:55681/v1/metrics).
21+
- `metrics_endpoint` (no default): The target URL to send metric data to (e.g.: https://example.com:4318/v1/metrics).
2222
If this setting is present the `endpoint` setting is ignored for metrics.
23-
- `logs_endpoint` (no default): The target URL to send log data to (e.g.: https://example.com:55681/v1/logs).
23+
- `logs_endpoint` (no default): The target URL to send log data to (e.g.: https://example.com:4318/v1/logs).
2424
If this setting is present the `endpoint` setting is ignored logs.
2525

2626
- `insecure` (default = false): when set to true disables verifying the server's
@@ -45,7 +45,7 @@ Example:
4545
```yaml
4646
exporters:
4747
otlphttp:
48-
endpoint: https://example.com:55681/v1/traces
48+
endpoint: https://example.com:4318/v1/traces
4949
```
5050
5151
The full list of settings exposed for this exporter are documented [here](./config.go)

receiver/otlpreceiver/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ receivers:
2525
2626
The following settings are configurable:
2727
28-
- `endpoint` (default = 0.0.0.0:4317 for grpc protocol, 0.0.0.0:55681 http protocol):
28+
- `endpoint` (default = 0.0.0.0:4317 for grpc protocol, 0.0.0.0:4318 http protocol):
2929
host:port to which the receiver is going to receive data. The valid syntax is
3030
described at https://github.com/grpc/grpc/blob/master/doc/naming.md.
3131

@@ -46,7 +46,7 @@ serialization](https://developers.google.com/protocol-buffers/docs/proto3#json).
4646

4747
To write traces with HTTP/JSON, `POST` to `[address]/v1/traces` for traces,
4848
to `[address]/v1/metrics` for metrics, to `[address]/v1/logs` for logs. The default
49-
port is `55681`.
49+
port is `4318`.
5050

5151
The HTTP/JSON endpoint can also optionally configure
5252
[CORS](https://fetch.spec.whatwg.org/#cors-protocol), which is enabled by
@@ -58,7 +58,7 @@ receivers:
5858
otlp:
5959
protocols:
6060
http:
61-
endpoint: "localhost:55681"
61+
endpoint: "localhost:4318"
6262
cors_allowed_origins:
6363
- http://test.com
6464
# Origins can have wildcards with *, use * by itself to match any origin.

receiver/otlpreceiver/config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Config defines configuration for OTLP receiver.
7373

7474
| Name | Type | Default | Docs |
7575
| ---- | ---- | ------- | ---- |
76-
| endpoint |string| 0.0.0.0:55681 | Endpoint configures the listening address for the server. |
76+
| endpoint |string| 0.0.0.0:4318 | Endpoint configures the listening address for the server. |
7777
| tls_settings |[configtls-TLSServerSetting](#configtls-TLSServerSetting)| <no value> | TLSSetting struct exposes TLS client configuration. |
7878
| cors_allowed_origins |[]string| <no value> | CorsOrigins are the allowed CORS origins for HTTP/JSON requests to grpc-gateway adapter for the OTLP receiver. See github.com/rs/cors An empty list means that CORS is not enabled at all. A wildcard (*) can be used to match any origin or one or more characters of an origin. |
7979
| cors_allowed_headers |[]string| <no value> | CorsHeaders are the allowed CORS headers for HTTP/JSON requests to grpc-gateway adapter for the OTLP receiver. See github.com/rs/cors CORS needs to be enabled first by providing a non-empty list in CorsOrigins A wildcard (*) can be used to match any header. |

receiver/otlpreceiver/config_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestLoadConfig(t *testing.T) {
139139
ReadBufferSize: 512 * 1024,
140140
},
141141
HTTP: &confighttp.HTTPServerSettings{
142-
Endpoint: "0.0.0.0:55681",
142+
Endpoint: "0.0.0.0:4318",
143143
TLSSetting: &configtls.TLSServerSetting{
144144
TLSSetting: configtls.TLSSetting{
145145
CertFile: "test.crt",
@@ -155,7 +155,7 @@ func TestLoadConfig(t *testing.T) {
155155
ReceiverSettings: config.NewReceiverSettings(config.NewIDWithName(typeStr, "cors")),
156156
Protocols: Protocols{
157157
HTTP: &confighttp.HTTPServerSettings{
158-
Endpoint: "0.0.0.0:55681",
158+
Endpoint: "0.0.0.0:4318",
159159
CorsOrigins: []string{"https://*.test.com", "https://test.com"},
160160
},
161161
},
@@ -166,7 +166,7 @@ func TestLoadConfig(t *testing.T) {
166166
ReceiverSettings: config.NewReceiverSettings(config.NewIDWithName(typeStr, "corsheader")),
167167
Protocols: Protocols{
168168
HTTP: &confighttp.HTTPServerSettings{
169-
Endpoint: "0.0.0.0:55681",
169+
Endpoint: "0.0.0.0:4318",
170170
CorsOrigins: []string{"https://*.test.com", "https://test.com"},
171171
CorsHeaders: []string{"ExampleHeader"},
172172
},

receiver/otlpreceiver/factory.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ const (
3131
typeStr = "otlp"
3232

3333
defaultGRPCEndpoint = "0.0.0.0:4317"
34-
defaultHTTPEndpoint = "0.0.0.0:55681"
34+
defaultHTTPEndpoint = "0.0.0.0:4318"
3535
legacyGRPCEndpoint = "0.0.0.0:55680"
36+
legacyHTTPEndpoint = "0.0.0.0:55681"
3637
)
3738

3839
// NewFactory creates a new OTLP receiver factory.

receiver/otlpreceiver/otlp.go

+12
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,18 @@ func (r *otlpReceiver) startProtocolServers(host component.Host) error {
155155
if err != nil {
156156
return err
157157
}
158+
if r.cfg.HTTP.Endpoint == defaultHTTPEndpoint {
159+
r.logger.Info("Setting up a second HTTP listener on legacy endpoint " + legacyHTTPEndpoint)
160+
161+
// Copy the config.
162+
cfgLegacyHTTP := r.cfg.HTTP
163+
// And use the legacy endpoint.
164+
cfgLegacyHTTP.Endpoint = legacyHTTPEndpoint
165+
err = r.startHTTPServer(cfgLegacyHTTP, host)
166+
if err != nil {
167+
return err
168+
}
169+
}
158170
}
159171

160172
return err

website_docs/configuration.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ exporters:
330330
331331
# Data sources: traces, metrics
332332
otlphttp:
333-
endpoint: https://example.com:55681/v1/traces
333+
endpoint: https://example.com:4318/v1/traces
334334
335335
# Data sources: metrics
336336
prometheus:

0 commit comments

Comments
 (0)