Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(receiver/otlpreceiver): make the configuration HttpServerSettings public #8176

25 changes: 25 additions & 0 deletions .chloggen/fix-public-api-otlpreceiver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: breaking
lpegoraro marked this conversation as resolved.
Show resolved Hide resolved

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: otlpreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: the public API for creating the otlpreceiver configuration for HTTPServerSettings was private. This change makes it public.
dmitryax marked this conversation as resolved.
Show resolved Hide resolved

# One or more tracking issues or pull requests related to the change
issues: [8175]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: Changes signature of receiver/otlpreceiver/config.go type httpServerSettings to HTTPServerSettings, and all places that uses it.
dmitryax marked this conversation as resolved.
Show resolved Hide resolved

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
4 changes: 2 additions & 2 deletions receiver/otlpreceiver/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (
protoHTTP = "protocols::http"
)

type httpServerSettings struct {
type HTTPServerSettings struct {
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
*confighttp.HTTPServerSettings `mapstructure:",squash"`

// The URL path to receive traces on. If omitted "/v1/traces" will be used.
Expand All @@ -37,7 +37,7 @@ type httpServerSettings struct {
// Protocols is the configuration for the supported protocols.
type Protocols struct {
GRPC *configgrpc.GRPCServerSettings `mapstructure:"grpc"`
HTTP *httpServerSettings `mapstructure:"http"`
HTTP *HTTPServerSettings `mapstructure:"http"`
}

// Config defines configuration for OTLP receiver.
Expand Down
4 changes: 2 additions & 2 deletions receiver/otlpreceiver/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func TestUnmarshalConfig(t *testing.T) {
},
},
},
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: "0.0.0.0:4318",
TLSSetting: &configtls.TLSServerSetting{
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestUnmarshalConfigUnix(t *testing.T) {
},
ReadBufferSize: 512 * 1024,
},
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: "/tmp/http_otlp.sock",
},
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func createDefaultConfig() component.Config {
// We almost write 0 bytes, so no need to tune WriteBufferSize.
ReadBufferSize: 512 * 1024,
},
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: defaultHTTPEndpoint,
},
Expand Down
14 changes: 7 additions & 7 deletions receiver/otlpreceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestCreateTracesReceiver(t *testing.T) {
Transport: "tcp",
},
}
defaultHTTPSettings := &httpServerSettings{
defaultHTTPSettings := &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: testutil.GetAvailableLocalAddress(t),
},
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestCreateTracesReceiver(t *testing.T) {
cfg: &Config{
Protocols: Protocols{
GRPC: defaultGRPCSettings,
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: "localhost:112233",
},
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestCreateMetricReceiver(t *testing.T) {
Transport: "tcp",
},
}
defaultHTTPSettings := &httpServerSettings{
defaultHTTPSettings := &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: testutil.GetAvailableLocalAddress(t),
},
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestCreateMetricReceiver(t *testing.T) {
cfg: &Config{
Protocols: Protocols{
GRPC: defaultGRPCSettings,
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: "327.0.0.1:1122",
},
Expand Down Expand Up @@ -212,7 +212,7 @@ func TestCreateLogReceiver(t *testing.T) {
Transport: "tcp",
},
}
defaultHTTPSettings := &httpServerSettings{
defaultHTTPSettings := &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: testutil.GetAvailableLocalAddress(t),
},
Expand Down Expand Up @@ -259,7 +259,7 @@ func TestCreateLogReceiver(t *testing.T) {
cfg: &Config{
Protocols: Protocols{
GRPC: defaultGRPCSettings,
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: "327.0.0.1:1122",
},
Expand All @@ -275,7 +275,7 @@ func TestCreateLogReceiver(t *testing.T) {
cfg: &Config{
Protocols: Protocols{
GRPC: defaultGRPCSettings,
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: "127.0.0.1:1122",
},
Expand Down
6 changes: 3 additions & 3 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func TestHandleInvalidRequests(t *testing.T) {
endpoint := testutil.GetAvailableLocalAddress(t)
cfg := &Config{
Protocols: Protocols{
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: endpoint,
},
Expand Down Expand Up @@ -900,7 +900,7 @@ func TestGRPCMaxRecvSize(t *testing.T) {
func TestHTTPInvalidTLSCredentials(t *testing.T) {
cfg := &Config{
Protocols: Protocols{
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: testutil.GetAvailableLocalAddress(t),
TLSSetting: &configtls.TLSServerSetting{
Expand Down Expand Up @@ -933,7 +933,7 @@ func testHTTPMaxRequestBodySizeJSON(t *testing.T, payload []byte, size int, expe
url := fmt.Sprintf("http://%s/v1/traces", endpoint)
cfg := &Config{
Protocols: Protocols{
HTTP: &httpServerSettings{
HTTP: &HTTPServerSettings{
HTTPServerSettings: &confighttp.HTTPServerSettings{
Endpoint: endpoint,
MaxRequestBodySize: int64(size),
Expand Down