Skip to content

Commit

Permalink
[receiver/awsfirehosereceiver] make otlp_v1 a valid record type (open…
Browse files Browse the repository at this point in the history
…-telemetry#35750)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This PR is to add `otlp_v1` into the list of valid `record_type` input.
Otherwise when `record_type` sets to `otlp_v1`, we get error:
```
2024-10-23T16:53:09.823Z	info	service@v0.112.0/service.go:135	Setting up own telemetry...
2024-10-23T16:53:09.824Z	info	telemetry/metrics.go:70	Serving metrics	{"address": "localhost:8888", "metrics level": "Normal"}
Error: failed to build pipelines: failed to create "awsfirehose" receiver for data type "metrics": unrecognized record type
```
<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->

---------

Co-authored-by: Matthew Wear <matthew.wear@gmail.com>
  • Loading branch information
kaiyan-sheng and mwear authored Oct 25, 2024
1 parent 7cca491 commit df5ba72
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .chloggen/add_otlp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
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]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: [user]
6 changes: 4 additions & 2 deletions receiver/awsfirehosereceiver/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream"
)

const (
Expand All @@ -28,8 +29,9 @@ const (
var (
errUnrecognizedRecordType = errors.New("unrecognized record type")
availableRecordTypes = map[string]bool{
cwmetricstream.TypeStr: true,
cwlog.TypeStr: true,
cwmetricstream.TypeStr: true,
cwlog.TypeStr: true,
otlpmetricstream.TypeStr: true,
}
)

Expand Down
3 changes: 3 additions & 0 deletions receiver/awsfirehosereceiver/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/receiver/receivertest"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream"
)

func TestValidConfig(t *testing.T) {
Expand Down Expand Up @@ -43,5 +45,6 @@ func TestCreateLogsReceiver(t *testing.T) {
func TestValidateRecordType(t *testing.T) {
require.NoError(t, validateRecordType(defaultMetricsRecordType))
require.NoError(t, validateRecordType(defaultLogsRecordType))
require.NoError(t, validateRecordType(otlpmetricstream.TypeStr))
require.Error(t, validateRecordType("nop"))
}

0 comments on commit df5ba72

Please sign in to comment.