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

[receiver/awsfirehosereceiver] Add otlp_v1 into the unmarshalers map #36125

Merged
merged 7 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .chloggen/add_otlp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion receiver/awsfirehosereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
3 changes: 2 additions & 1 deletion receiver/awsfirehosereceiver/metrics_receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package awsfirehosereceiver // import "github.com/open-telemetry/opentelemetry-c

import (
"context"
"fmt"
"net/http"

"go.opentelemetry.io/collector/consumer"
Expand Down Expand Up @@ -44,7 +45,7 @@ func newMetricsReceiver(
}
configuredUnmarshaler := unmarshalers[recordType]
if configuredUnmarshaler == nil {
return nil, errUnrecognizedRecordType
return nil, fmt.Errorf("%w: recordType = %s", errUnrecognizedRecordType, recordType)
}

mc := &metricsConsumer{
Expand Down
3 changes: 2 additions & 1 deletion receiver/awsfirehosereceiver/metrics_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package awsfirehosereceiver
import (
"context"
"errors"
"fmt"
"net/http"
"testing"

Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions receiver/awsfirehosereceiver/testdata/otlpv1_config.yaml
Original file line number Diff line number Diff line change
@@ -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