Skip to content
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

Knative error extensions #2374

Merged
merged 15 commits into from
Aug 23, 2022
Merged

Knative error extensions #2374

merged 15 commits into from
Aug 23, 2022

Conversation

egorlepa
Copy link
Contributor

@egorlepa egorlepa commented Jul 4, 2022

Fixes #2340

Release Note

Failed events are now decorated with Knative error extensions when routed to the `deadLetterSink` for more context

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 4, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 4, 2022
@knative-prow
Copy link

knative-prow bot commented Jul 4, 2022

Welcome @egorlepa! It looks like this is your first PR to knative-sandbox/eventing-kafka-broker 🎉

@knative-prow
Copy link

knative-prow bot commented Jul 4, 2022

Hi @egorlepa. Thanks for your PR.

I'm waiting for a knative-sandbox member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/data-plane labels Jul 4, 2022
@pierDipi
Copy link
Member

pierDipi commented Jul 4, 2022

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 4, 2022
@codecov
Copy link

codecov bot commented Jul 4, 2022

Codecov Report

Merging #2374 (01ca092) into main (92a73d3) will increase coverage by 0.10%.
The diff coverage is 91.89%.

@@             Coverage Diff              @@
##               main    #2374      +/-   ##
============================================
+ Coverage     62.31%   62.42%   +0.10%     
- Complexity      708      714       +6     
============================================
  Files           146      146              
  Lines         10100    10132      +32     
  Branches        225      229       +4     
============================================
+ Hits           6294     6325      +31     
- Misses         3373     3376       +3     
+ Partials        433      431       -2     
Flag Coverage Δ
java-unittests 81.24% <91.89%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...a/broker/dispatcher/impl/RecordDispatcherImpl.java 89.25% <91.89%> (+1.34%) ⬆️
...ive/eventing/kafka/broker/core/AsyncCloseable.java 66.66% <0.00%> (-13.34%) ⬇️
...dispatcher/impl/consumer/BaseConsumerVerticle.java 87.09% <0.00%> (-6.46%) ⬇️
...broker/dispatcher/impl/consumer/OffsetManager.java 93.54% <0.00%> (-2.16%) ⬇️
...lane/pkg/reconciler/consumergroup/consumergroup.go 71.95% <0.00%> (+1.10%) ⬆️
...patcher/impl/consumer/OrderedConsumerVerticle.java 75.23% <0.00%> (+1.90%) ⬆️
.../kafka/broker/dispatcher/impl/ResourceContext.java 100.00% <0.00%> (+9.09%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@egorlepa egorlepa changed the title Knative error extensions [WIP] Knative error extensions Jul 4, 2022
@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 4, 2022
@matzew
Copy link
Contributor

matzew commented Jul 4, 2022

@egorlepa thanks for putting this PR together, I looks nice!

I will review this tomorrow. Glad to see your contribution here 🎉

@egorlepa
Copy link
Contributor Author

egorlepa commented Jul 4, 2022

@matzew ok, cool. i'll fix e2es tomorrow

.onSuccess(v -> onDeadLetterSinkSuccess(recordContext, finalProm))
.onFailure(ex -> onDeadLetterSinkFailure(recordContext, ex, finalProm));
// enhance event with extension attributes prior to forwarding to the dead letter sink
ConsumerRecordContext transformedRecordContext = errorTransform(recordContext, response);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer using final as much as possible, to express objects are not mutable.

See other classes for examples. That would be really my only "nit" comment on the code 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, no problem. i mainly use golang and kotlin nowadays, almost forgot how to talk in java :) kotlin has nice val/var for this purpose

@matzew
Copy link
Contributor

matzew commented Jul 5, 2022

@egorlepa it would be nice if we had a little e2e test for this in here: https://github.com/knative-sandbox/eventing-kafka-broker/tree/main/test/e2e_new

@pierDipi
Copy link
Member

pierDipi commented Jul 6, 2022

/test unit-tests_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Jul 6, 2022

/test unit-tests_eventing-kafka-broker_main

@@ -0,0 +1,169 @@
//go:build e2e
// +build e2e
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dls_extenisons_test.go: there is a little typo in extensions

@matzew
Copy link
Contributor

matzew commented Jul 6, 2022

/retest

fmt.Println("dead letter sink is not addressable", err)
}
fmt.Println("dead letter sink address: ", dlsAddress.Path)
return cetest.HasExtension("knativeerrordest", dlsAddress.Path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to include the scheme, etc

Suggested change
return cetest.HasExtension("knativeerrordest", dlsAddress.Path)
return cetest.HasExtension("knativeerrordest", dlsAddress.String())

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2022
@knative-prow knative-prow bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 7, 2022
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2022
))
f.Setup("trigger is ready", trigger.IsReady(triggerName))

f.Setup("install source", eventshub.Install(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f.Setup("install source", eventshub.Install(
f.Requirement("install source", eventshub.Install(

This will make sure that we send the event only after the Broker is ready because every step at the same phase (for example, Setup) will run in parallel.

))
f.Setup("trigger is ready", trigger.IsReady(triggerName))

f.Setup("install source", eventshub.Install(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f.Setup("install source", eventshub.Install(
f.Requirement("install source", eventshub.Install(

Same reasoning.

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
@matzew matzew changed the title [WIP] Knative error extensions Knative error extensions Aug 23, 2022
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 23, 2022
Copy link
Contributor

@matzew matzew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow knative-prow bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 23, 2022
@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/retest

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/retest-required

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test reconciler-tests_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test reconciler-tests-namespaced-broker_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test integration-tests-namespaced-broker_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test integration-tests_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test reconciler-tests_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test reconciler-tests-namespaced-broker_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/test integration-tests-namespaced-broker_eventing-kafka-broker_main

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/retest

Copy link
Contributor

@matzew matzew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

@knative-prow
Copy link

knative-prow bot commented Aug 23, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: egorlepa, matzew

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit 401a877 into knative-extensions:main Aug 23, 2022
@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/cherry-pick release-1.6

@matzew
Copy link
Contributor

matzew commented Aug 23, 2022

/cherry-pick release-1.5

@knative-prow-robot
Copy link
Contributor

@matzew: new pull request created: #2547

In response to this:

/cherry-pick release-1.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot
Copy link
Contributor

@matzew: #2374 failed to apply on top of branch "release-1.5":

Applying: enhancing failed events with knativeerror* extensions before sending to dls
Applying: enhancing failed events with knativeerror* extensions before sending to dls
Using index info to reconstruct a base tree...
M	data-plane/dispatcher/src/main/java/dev/knative/eventing/kafka/broker/dispatcher/impl/RecordDispatcherImpl.java
M	data-plane/dispatcher/src/test/java/dev/knative/eventing/kafka/broker/dispatcher/impl/RecordDispatcherTest.java
Falling back to patching base and 3-way merge...
Auto-merging data-plane/dispatcher/src/test/java/dev/knative/eventing/kafka/broker/dispatcher/impl/RecordDispatcherTest.java
Auto-merging data-plane/dispatcher/src/main/java/dev/knative/eventing/kafka/broker/dispatcher/impl/RecordDispatcherImpl.java
CONFLICT (content): Merge conflict in data-plane/dispatcher/src/main/java/dev/knative/eventing/kafka/broker/dispatcher/impl/RecordDispatcherImpl.java
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0002 enhancing failed events with knativeerror* extensions before sending to dls
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.5

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

matzew added a commit to matzew/eventing-kafka-broker that referenced this pull request Aug 23, 2022
* enhancing failed events with knativeerror* extensions before sending to dls

* enhancing failed events with knativeerror* extensions before sending to dls

* fix star import

* final vars & e2e draft

* e2es

* upgrade reconciler-test package, fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix eventshub.SendMultipleEvents call

* fix time import

* More import fixes

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Populating response from ResponseFailureException

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Fixing tests

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: Matthias Wessendorf <mwessend@redhat.com>
openshift-merge-robot pushed a commit to openshift-knative/eventing-kafka-broker that referenced this pull request Aug 24, 2022
* Knative error extensions (knative-extensions#2374)

* enhancing failed events with knativeerror* extensions before sending to dls

* enhancing failed events with knativeerror* extensions before sending to dls

* fix star import

* final vars & e2e draft

* e2es

* upgrade reconciler-test package, fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix eventshub.SendMultipleEvents call

* fix time import

* More import fixes

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Populating response from ResponseFailureException

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Fixing tests

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: Matthias Wessendorf <mwessend@redhat.com>

* Remove due to incorrect deps

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: egorlepa <76429849+egorlepa@users.noreply.github.com>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/eventing-kafka-broker that referenced this pull request Aug 24, 2022
* enhancing failed events with knativeerror* extensions before sending to dls

* enhancing failed events with knativeerror* extensions before sending to dls

* fix star import

* final vars & e2e draft

* e2es

* upgrade reconciler-test package, fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix eventshub.SendMultipleEvents call

* fix time import

* More import fixes

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Populating response from ResponseFailureException

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Fixing tests

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: Matthias Wessendorf <mwessend@redhat.com>
openshift-merge-robot pushed a commit to openshift-knative/eventing-kafka-broker that referenced this pull request Aug 31, 2022
* Knative error extensions (knative-extensions#2374)

* enhancing failed events with knativeerror* extensions before sending to dls

* enhancing failed events with knativeerror* extensions before sending to dls

* fix star import

* final vars & e2e draft

* e2es

* upgrade reconciler-test package, fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix e2es

* fix eventshub.SendMultipleEvents call

* fix time import

* More import fixes

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Populating response from ResponseFailureException

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

* Fixing tests

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: Matthias Wessendorf <mwessend@redhat.com>

* Remove due to incorrect deps

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
Co-authored-by: egorlepa <76429849+egorlepa@users.noreply.github.com>
Co-authored-by: Matthias Wessendorf <mwessend@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/data-plane area/test lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed events are not enhanced with extension attributes
4 participants