Skip to content

Commit

Permalink
add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyan-sheng committed Nov 5, 2024
1 parent e58a7d8 commit ac58456
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 9 deletions.
25 changes: 25 additions & 0 deletions .chloggen/add_firehose_logs.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: 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]
4 changes: 4 additions & 0 deletions receiver/awsfirehosereceiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions receiver/awsfirehosereceiver/logs_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions receiver/awsfirehosereceiver/metrics_receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion receiver/awsfirehosereceiver/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit ac58456

Please sign in to comment.