diff --git a/.chloggen/add_otlp.yaml b/.chloggen/add_otlp.yaml index dbea16c5a93d..d4ff1d22af39 100644 --- a/.chloggen/add_otlp.yaml +++ b/.chloggen/add_otlp.yaml @@ -8,7 +8,7 @@ component: awsfirehosereceiver note: make otlp_v1 a valid record type # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. -issues: [35750] +issues: [35750, 36125] # (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. diff --git a/receiver/awsfirehosereceiver/config_test.go b/receiver/awsfirehosereceiver/config_test.go index 77f5ef1fb7bb..9f5f89850dc4 100644 --- a/receiver/awsfirehosereceiver/config_test.go +++ b/receiver/awsfirehosereceiver/config_test.go @@ -20,7 +20,7 @@ import ( func TestLoadConfig(t *testing.T) { for _, configType := range []string{ - "cwmetrics", "cwlogs", "invalid", + "cwmetrics", "cwlogs", "otlp_v1", "invalid", } { t.Run(configType, func(t *testing.T) { fileName := fmt.Sprintf("%s_config.yaml", configType) diff --git a/receiver/awsfirehosereceiver/factory.go b/receiver/awsfirehosereceiver/factory.go index 1d918f85ac54..5058ad42064d 100644 --- a/receiver/awsfirehosereceiver/factory.go +++ b/receiver/awsfirehosereceiver/factory.go @@ -58,8 +58,10 @@ func validateRecordType(recordType string) error { // unmarshalers. func defaultMetricsUnmarshalers(logger *zap.Logger) map[string]unmarshaler.MetricsUnmarshaler { cwmsu := cwmetricstream.NewUnmarshaler(logger) + otlpv1msu := otlpmetricstream.NewUnmarshaler(logger) return map[string]unmarshaler.MetricsUnmarshaler{ - cwmsu.Type(): cwmsu, + cwmsu.Type(): cwmsu, + otlpv1msu.Type(): otlpv1msu, } } diff --git a/receiver/awsfirehosereceiver/metrics_receiver.go b/receiver/awsfirehosereceiver/metrics_receiver.go index 2bb466292aa9..e1eb841f4c4b 100644 --- a/receiver/awsfirehosereceiver/metrics_receiver.go +++ b/receiver/awsfirehosereceiver/metrics_receiver.go @@ -5,6 +5,7 @@ package awsfirehosereceiver // import "github.com/open-telemetry/opentelemetry-c import ( "context" + "fmt" "net/http" "go.opentelemetry.io/collector/consumer" @@ -43,7 +44,7 @@ func newMetricsReceiver( } configuredUnmarshaler := unmarshalers[recordType] if configuredUnmarshaler == nil { - return nil, errUnrecognizedRecordType + return nil, fmt.Errorf("%w: recordType = %s", errUnrecognizedRecordType, recordType) } mc := &metricsConsumer{ diff --git a/receiver/awsfirehosereceiver/metrics_receiver_test.go b/receiver/awsfirehosereceiver/metrics_receiver_test.go index 0952b12596e6..efe6bf7ccbd3 100644 --- a/receiver/awsfirehosereceiver/metrics_receiver_test.go +++ b/receiver/awsfirehosereceiver/metrics_receiver_test.go @@ -6,6 +6,7 @@ package awsfirehosereceiver import ( "context" "errors" + "fmt" "net/http" "testing" @@ -43,7 +44,7 @@ func TestNewMetricsReceiver(t *testing.T) { "WithInvalidRecordType": { consumer: consumertest.NewNop(), recordType: "test", - wantErr: errUnrecognizedRecordType, + wantErr: fmt.Errorf("%w: recordType = %s", errUnrecognizedRecordType, "test"), }, } for name, testCase := range testCases { diff --git a/receiver/awsfirehosereceiver/testdata/otlp_v1_config.yaml b/receiver/awsfirehosereceiver/testdata/otlp_v1_config.yaml new file mode 100644 index 000000000000..fe9def7fe827 --- /dev/null +++ b/receiver/awsfirehosereceiver/testdata/otlp_v1_config.yaml @@ -0,0 +1,7 @@ +awsfirehose: + endpoint: 0.0.0.0:4433 + record_type: otlp_v1 + access_key: "some_access_key" + tls: + cert_file: server.crt + key_file: server.key