From ac58456d9c43928c7d61765a23f104e43ae27f32 Mon Sep 17 00:00:00 2001 From: kaiyan-sheng Date: Tue, 5 Nov 2024 16:39:04 -0700 Subject: [PATCH] add changelog --- .chloggen/add_firehose_logs.yaml | 25 +++++++++++++++++++ receiver/awsfirehosereceiver/README.md | 4 +++ .../unmarshalertest/nop_logs_unmarshaler.go | 2 +- .../nop_logs_unmarshaler_test.go | 6 ++--- .../awsfirehosereceiver/logs_receiver_test.go | 4 +-- .../metrics_receiver_test.go | 4 +-- receiver/awsfirehosereceiver/receiver_test.go | 2 +- 7 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 .chloggen/add_firehose_logs.yaml diff --git a/.chloggen/add_firehose_logs.yaml b/.chloggen/add_firehose_logs.yaml new file mode 100644 index 000000000000..7b89d7a30e7d --- /dev/null +++ b/.chloggen/add_firehose_logs.yaml @@ -0,0 +1,25 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# 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: Add support for logs sent from services directly to Firehose + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [36184] + +# (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] diff --git a/receiver/awsfirehosereceiver/README.md b/receiver/awsfirehosereceiver/README.md index 6fab04fd95bc..761640f1a79a 100644 --- a/receiver/awsfirehosereceiver/README.md +++ b/receiver/awsfirehosereceiver/README.md @@ -86,3 +86,7 @@ For example: ### otlp_v1 The OTLP v1 format as produced by CloudWatch metric streams. See [documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-metric-streams-formats-opentelemetry-100.html) for details. + +### firehoselogs +The record type for logs sent directly from AWS services to Firehose. +For example, VPC flow logs can be configured to send to Firehose directly. Please see [documentation](https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs-firehose.html) for more details. diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go index 79f29caecfdb..9c2789c8e587 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler.go @@ -37,7 +37,7 @@ func NewErrLogs(err error) *NopLogsUnmarshaler { } // Unmarshal deserializes the records into logs. -func (u *NopLogsUnmarshaler) Unmarshal([][]byte) (plog.Logs, error) { +func (u *NopLogsUnmarshaler) Unmarshal([][]byte, map[string]string, string, int64) (plog.Logs, error) { return u.logs, u.err } diff --git a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go index 69be0c74f224..0f982119dd50 100644 --- a/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go +++ b/receiver/awsfirehosereceiver/internal/unmarshaler/unmarshalertest/nop_logs_unmarshaler_test.go @@ -13,7 +13,7 @@ import ( func TestNewNopLogs(t *testing.T) { unmarshaler := NewNopLogs() - got, err := unmarshaler.Unmarshal(nil) + got, err := unmarshaler.Unmarshal(nil, nil, "", 0) require.NoError(t, err) require.NotNil(t, got) require.Equal(t, typeStr, unmarshaler.Type()) @@ -23,7 +23,7 @@ func TestNewWithLogs(t *testing.T) { logs := plog.NewLogs() logs.ResourceLogs().AppendEmpty() unmarshaler := NewWithLogs(logs) - got, err := unmarshaler.Unmarshal(nil) + got, err := unmarshaler.Unmarshal(nil, nil, "", 0) require.NoError(t, err) require.NotNil(t, got) require.Equal(t, logs, got) @@ -33,7 +33,7 @@ func TestNewWithLogs(t *testing.T) { func TestNewErrLogs(t *testing.T) { wantErr := fmt.Errorf("test error") unmarshaler := NewErrLogs(wantErr) - got, err := unmarshaler.Unmarshal(nil) + got, err := unmarshaler.Unmarshal(nil, nil, "", 0) require.Error(t, err) require.Equal(t, wantErr, err) require.NotNil(t, got) diff --git a/receiver/awsfirehosereceiver/logs_receiver_test.go b/receiver/awsfirehosereceiver/logs_receiver_test.go index da448640ddb4..36d3f3d941b3 100644 --- a/receiver/awsfirehosereceiver/logs_receiver_test.go +++ b/receiver/awsfirehosereceiver/logs_receiver_test.go @@ -94,7 +94,7 @@ func TestLogsConsumer(t *testing.T) { unmarshaler: unmarshalertest.NewErrLogs(testCase.unmarshalerErr), consumer: consumertest.NewErr(testCase.consumerErr), } - gotStatus, gotErr := mc.Consume(context.TODO(), nil, nil) + gotStatus, gotErr := mc.Consume(context.TODO(), nil, nil, "", 0) require.Equal(t, testCase.wantStatus, gotStatus) require.Equal(t, testCase.wantErr, gotErr) }) @@ -110,7 +110,7 @@ func TestLogsConsumer(t *testing.T) { } gotStatus, gotErr := mc.Consume(context.TODO(), nil, map[string]string{ "CommonAttributes": "Test", - }) + }, "", 0) require.Equal(t, http.StatusOK, gotStatus) require.NoError(t, gotErr) gotRms := rc.result.ResourceLogs() diff --git a/receiver/awsfirehosereceiver/metrics_receiver_test.go b/receiver/awsfirehosereceiver/metrics_receiver_test.go index efe6bf7ccbd3..8409d4f4faf0 100644 --- a/receiver/awsfirehosereceiver/metrics_receiver_test.go +++ b/receiver/awsfirehosereceiver/metrics_receiver_test.go @@ -95,7 +95,7 @@ func TestMetricsConsumer(t *testing.T) { unmarshaler: unmarshalertest.NewErrMetrics(testCase.unmarshalerErr), consumer: consumertest.NewErr(testCase.consumerErr), } - gotStatus, gotErr := mc.Consume(context.TODO(), nil, nil) + gotStatus, gotErr := mc.Consume(context.TODO(), nil, nil, "", 0) require.Equal(t, testCase.wantStatus, gotStatus) require.Equal(t, testCase.wantErr, gotErr) }) @@ -111,7 +111,7 @@ func TestMetricsConsumer(t *testing.T) { } gotStatus, gotErr := mc.Consume(context.TODO(), nil, map[string]string{ "CommonAttributes": "Test", - }) + }, "", 0) require.Equal(t, http.StatusOK, gotStatus) require.NoError(t, gotErr) gotRms := rc.result.ResourceMetrics() diff --git a/receiver/awsfirehosereceiver/receiver_test.go b/receiver/awsfirehosereceiver/receiver_test.go index e0ece7054d72..be84914a83c2 100644 --- a/receiver/awsfirehosereceiver/receiver_test.go +++ b/receiver/awsfirehosereceiver/receiver_test.go @@ -39,7 +39,7 @@ func newNopFirehoseConsumer(statusCode int, err error) *nopFirehoseConsumer { return &nopFirehoseConsumer{statusCode, err} } -func (nfc *nopFirehoseConsumer) Consume(context.Context, [][]byte, map[string]string) (int, error) { +func (nfc *nopFirehoseConsumer) Consume(context.Context, [][]byte, map[string]string, string, int64) (int, error) { return nfc.statusCode, nfc.err }