-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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/awsfirehose] Add support for encoding extensions #37262
Conversation
fbf5919
to
abc720f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -19,7 +19,7 @@ import ( | |||
|
|||
func TestLoadConfig(t *testing.T) { | |||
for _, configType := range []string{ | |||
"cwmetrics", "cwlogs", "otlp_v1", "invalid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing for an invalid record type or encoding is different from testing that both an encoding and record type have been provided. Both tests should remain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we're now supporting extensions, the record type is only known to be valid/invalid at the time we call Start
. There's a test case in there for invalid encoding/record type. See the WithUnknownEncoding
test cases for TestLogsReceiver_Start
and TestMetricsReceiver_Start
.
// If a record type is specified, it must be valid. | ||
// An empty string is acceptable, however, because it will use a telemetry-type-specific default. | ||
if c.RecordType != "" { | ||
return validateRecordType(c.RecordType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think validation of the record type or encoding can be deferred. This has to fail fast to alert the user to their configuration error rather than allowing the collector to start and then failing to process received data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The collector will still fail fast. e.g.
$ cat local/config.yaml
receivers:
awsfirehose:
record_type: invalid
exporters:
debug: {}
service:
pipelines:
logs:
receivers: [awsfirehose]
processors: []
exporters: [debug]
$ ./bin/otelcontribcol_linux_amd64 --config local/config.yaml
2025-01-17T10:51:28.527+0800 info service@v0.117.1-0.20250114172347-71aae791d7f8/service.go:164 Setting up own telemetry...
2025-01-17T10:51:28.527+0800 info telemetry/metrics.go:70 Serving metrics {"address": "localhost:8888", "metrics level": "Normal"}
2025-01-17T10:51:28.527+0800 info builders/builders.go:26 Development component. May change in the future. {"kind": "exporter", "data_type": "logs", "name": "debug"}
2025-01-17T10:51:28.527+0800 warn awsfirehosereceiver@v0.117.0/config.go:48 record_type is deprecated, and will be removed in a future version. Use encoding instead. {"kind": "receiver", "name": "awsfirehose", "data_type": "logs"}
2025-01-17T10:51:28.530+0800 info service@v0.117.1-0.20250114172347-71aae791d7f8/service.go:230 Starting otelcontribcol... {"Version": "0.117.0-dev", "NumCPU": 16}
2025-01-17T10:51:28.530+0800 info extensions/extensions.go:39 Starting extensions...
2025-01-17T10:51:28.530+0800 error graph/graph.go:426 Failed to start component {"error": "unknown encoding extension \"invalid\"", "type": "Receiver", "id": "awsfirehose"}
2025-01-17T10:51:28.530+0800 info service@v0.117.1-0.20250114172347-71aae791d7f8/service.go:295 Starting shutdown...
2025-01-17T10:51:28.530+0800 info extensions/extensions.go:66 Stopping extensions...
2025-01-17T10:51:28.530+0800 info service@v0.117.1-0.20250114172347-71aae791d7f8/service.go:309 Shutdown complete.
Error: cannot start pipelines: unknown encoding extension "invalid"
2025/01/17 10:51:28 collector server run finished with error: cannot start pipelines: unknown encoding extension "invalid"
It's doing a bit more work than before it gets to the error, but AFAIK it's not possible to access extensions earlier than the Start
method.
receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go
Outdated
Show resolved
Hide resolved
receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go
Outdated
Show resolved
Hide resolved
receiver/awsfirehosereceiver/internal/unmarshaler/cwlog/unmarshaler.go
Outdated
Show resolved
Hide resolved
receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream/unmarshaler.go
Outdated
Show resolved
Hide resolved
receiver/awsfirehosereceiver/internal/unmarshaler/cwmetricstream/unmarshaler_test.go
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
This comment was marked as outdated.
This comment was marked as outdated.
b70cbd0
to
b147b60
Compare
Add support for using encoding extensions for unmarshalling records transmitted via Amazon Data Firehose. The "record_type" config is now deprecated and has been replaced by "encoding". This new config setting supports all of the existing encodings (cwlogs, cwmetrics otlp_v1) as well as support for loading additional encodings via extensions.
b147b60
to
512d5e4
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error enrichment can happen in a separate PR, but I think it needs to happen. Context from the caller is sometimes the only way to understand what an error message actually means.
Co-authored-by: Anthony Mirabella <a9@aneurysm9.com>
* main: (22 commits) [receiver/awsfirehose] Add support for encoding extensions (open-telemetry#37262) fix(deps): update module google.golang.org/api to v0.223.0 (open-telemetry#38181) [chore] skip TestSyslogComplementaryRFC3164 (open-telemetry#38240) fix(deps): update module github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common to v1.0.1106 (open-telemetry#38199) [provider/s3] Use mdatagen, promote to alpha (open-telemetry#38227) fix: fix flaky test in kafkatopicsobserver (open-telemetry#38218) [processor/resourcedetection] Add k8s.cluster.uid to kubeadm detector (open-telemetry#38216) Revert "Add issue generation from fkaly tests for all archs (open-telemetry#38191)" (open-telemetry#38230) Revert "Introduce issuegenerator to open issues when tests fail on main (open-telemetry#38177)" (open-telemetry#38231) [chore] Update otelcol core dependency (open-telemetry#38214) [pkg/stanza] Improve error logs produced by transformer processors (open-telemetry#37285) [receiver/statsd] Make full config structure public (open-telemetry#38186) processor/metricsstarttime: add ridwanmsharif as codeowner (open-telemetry#38193) fix(deps): update module github.com/huaweicloud/huaweicloud-sdk-go-v3 to v0.1.137 (open-telemetry#38154) [pkg/datadog] export StaticAPIKeyCheck (open-telemetry#38223) [chore][pkg/ottl] Move scope and resource PathGetSetters to internal ctx packages (open-telemetry#38225) fix(deps): update all github.com/datadog packages to v0.64.0-rc.3 (open-telemetry#38202) feat(telemetrygen): added support for delta temporality (open-telemetry#38146) [chore] Some more fixes of component IDs (open-telemetry#38221) [chore][pkg/ottl] Define PathGetSetter in ctxdatapoint (open-telemetry#38201) ...
Description
Add support for using encoding extensions for unmarshalling records transmitted via Amazon Data Firehose.
The "record_type" config is now deprecated and has been replaced by "encoding". This new config setting supports all of the existing encodings (cwlogs, cwmetrics otlp_v1) as well as support for loading additional encodings via extensions.
Link to tracking issue
Fixes #37113
Testing
Should be a non-functional change, so mostly relying on existing unit tests to catch issues. Tests have been added for new extension functionality. Manually tested creating a Firehose delivery stream and using the
text_encoding
extension:aws firehose put-record --delivery-stream-name=axwtest --record Data=$(echo -n abc | base64)
Documentation
Updated README.