Skip to content

Commit df5ba72

Browse files
kaiyan-shengmwear
andauthored
[receiver/awsfirehosereceiver] make otlp_v1 a valid record type (#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 [email protected]/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. #1234) or full URL to issue, if applicable. --> --------- Co-authored-by: Matthew Wear <[email protected]>
1 parent 7cca491 commit df5ba72

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

.chloggen/add_otlp.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
2+
change_type: bug_fix
3+
4+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
5+
component: awsfirehosereceiver
6+
7+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
8+
note: make otlp_v1 a valid record type
9+
10+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
11+
issues: [35750]
12+
13+
# (Optional) One or more lines of additional information to render under the primary note.
14+
# These lines will be padded with 2 spaces and then inserted directly into the document.
15+
# Use pipe (|) for multiline entries.
16+
subtext:
17+
18+
# If your change doesn't affect end users or the exported elements of any package,
19+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: [user]

receiver/awsfirehosereceiver/factory.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler"
1919
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwlog"
2020
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream"
21+
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream"
2122
)
2223

2324
const (
@@ -28,8 +29,9 @@ const (
2829
var (
2930
errUnrecognizedRecordType = errors.New("unrecognized record type")
3031
availableRecordTypes = map[string]bool{
31-
cwmetricstream.TypeStr: true,
32-
cwlog.TypeStr: true,
32+
cwmetricstream.TypeStr: true,
33+
cwlog.TypeStr: true,
34+
otlpmetricstream.TypeStr: true,
3335
}
3436
)
3537

receiver/awsfirehosereceiver/factory_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import (
1111
"go.opentelemetry.io/collector/component/componenttest"
1212
"go.opentelemetry.io/collector/consumer/consumertest"
1313
"go.opentelemetry.io/collector/receiver/receivertest"
14+
15+
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsfirehosereceiver/internal/unmarshaler/otlpmetricstream"
1416
)
1517

1618
func TestValidConfig(t *testing.T) {
@@ -43,5 +45,6 @@ func TestCreateLogsReceiver(t *testing.T) {
4345
func TestValidateRecordType(t *testing.T) {
4446
require.NoError(t, validateRecordType(defaultMetricsRecordType))
4547
require.NoError(t, validateRecordType(defaultLogsRecordType))
48+
require.NoError(t, validateRecordType(otlpmetricstream.TypeStr))
4649
require.Error(t, validateRecordType("nop"))
4750
}

0 commit comments

Comments
 (0)