Skip to content

Knative enhance failed events extensions in mt channel broker - #6569

Merged
knative-prow[bot] merged 17 commits into
knative:mainfrom
liuchangyan:KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker
Nov 16, 2022
Merged

knative-prow[bot] merged 17 commits into
knative:mainfrom
liuchangyan:KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker

Conversation

@liuchangyan

@liuchangyan liuchangyan commented Oct 14, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #6541
Signed-off-by: Teresaliu [email protected]

Proposed Changes

  • Add Reconciler Test of Channel to test failer extensions metadata
  • Add failed events extensions knativeerrordest, knativeerrordata,knativeerrorcode to MTChannelBroker and corresponding Reconciler Test to Broker

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note

Add contextual information on why the message landed in deadletter sink of the MTChannel-based Broker or its Triggers.

Docs

@knative-prow knative-prow Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/test-and-release Test infrastructure, tests or release size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 14, 2022
@codecov

codecov Bot commented Oct 14, 2022 •

Copy link
Copy Markdown

Codecov Report

Base: 81.89% // Head: 81.83% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (abf8afb) compared to base (98dfb5b).
Patch coverage: 58.44% of modified lines in pull request are covered.

❗ Current head abf8afb differs from pull request most recent head d71566b. Consider uploading reports for the commit d71566b to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6569      +/-   ##
==========================================
- Coverage   81.89%   81.83%   -0.06%     
==========================================
  Files         235      235              
  Lines       11756    11833      +77     
==========================================
+ Hits         9627     9684      +57     
- Misses       1652     1669      +17     
- Partials      477      480       +3     
Impacted Files Coverage Δ
pkg/channel/message_dispatcher.go 76.85% <15.38%> (-3.88%) ⬇️
pkg/broker/filter/filter_handler.go 75.73% <67.18%> (-0.12%) ⬇️
pkg/broker/ttl.go 71.42% <0.00%> (ø)
pkg/duck/channel.go 62.85% <0.00%> (ø)
pkg/kncloudevents/retries.go 100.00% <0.00%> (ø)
pkg/reconciler/source/duck/duck.go 76.87% <0.00%> (ø)
pkg/kncloudevents/message_receiver.go 93.82% <0.00%> (+0.32%) ⬆️
pkg/scheduler/statefulset/scheduler.go 79.49% <0.00%> (+0.35%) ⬆️
pkg/adapter/apiserver/adapter.go 67.05% <0.00%> (+1.20%) ⬆️
... and 1 more

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment thread pkg/broker/filter/filter_handler.go Outdated
}

// isFailure returns true if the status code is not a successful HTTP status.
func isFailure(statusCode int) bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could we somehow/where extract this?

see:

func isFailure(statusCode int) bool {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Got your point

@knative-prow-robot knative-prow-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 19, 2022
@liuchangyan
liuchangyan force-pushed the KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker branch from f154226 to 8e1a7d2 Compare October 21, 2022 11:28
@knative-prow-robot knative-prow-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 21, 2022
@liuchangyan liuchangyan changed the title [WIP] Knative enhance failed events extensions in mt channel broker Knative enhance failed events extensions in mt channel broker Oct 21, 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 Oct 21, 2022
@liuchangyan

Copy link
Copy Markdown
Contributor Author

/retest

@matzew

matzew commented Oct 25, 2022

Copy link
Copy Markdown
Member

looks like there is some funk going on in here:

    event_info_store.go:160: Timeout waiting for at least 1 matches.
        Error: FAIL MATCHING: saw 0/1 matching events.
        - Store-
        Pod 'sink-sralvegh' in namespace 'test-vhxgbfmt'
        - Recent events -
        1 events seen, last 1 events (total events seen 32, events ignored 31):
        -- EventInfo --
        --- Kind: Received ---
        --- Event ---
        Context Attributes,
          specversion: 1.0
          type: type1
          source: source1
          id: 25ef7129-e4fc-44d8-9ca1-e4d776797842
          datacontenttype: application/json
        Extensions,
          knativearrivaltime: 2022-10-25T04:52:29.153625148Z
          knativebrokerttl: 255
          knativeerrorcode: 422
          knativeerrordata: eyJlcnJkZXN0aW5hdGlvbiI6eyJTY2hlbWUiOiJodHRwIiwiT3BhcXVlIjoiIiwiVXNlciI6bnVsbCwiSG9zdCI6ImZhaWxlci1qc2d6dmdycy50ZXN0LXZoeGdiZm10LnN2Yy5jbHVzdGVyLmxvY2FsIiwiUGF0aCI6IiIsIlJhd1BhdGgiOiIiLCJGb3JjZVF1ZXJ5IjpmYWxzZSwiUmF3UXVlcnkiOiIiLCJGcmFnbWVudCI6IiIsIlJhd0ZyYWdtZW50IjoiIn0sImVycnJlc3BvbnNlYm9keSI6IiJ9
          knativeerrordest: http://broker-filter.knative-eventing-0fczwub0zw.svc.cluster.local/triggers/test-vhxgbfmt/via-qldxtpmh/64a8bc0c-c8de-4968-bf04-96671f93ca93
        Data,
          {
            "msg": "test msg"
          }

Let me test your branch, and this test locally

@matzew

matzew commented Oct 25, 2022

Copy link
Copy Markdown
Member

/assign @matzew

Comment thread test/rekt/features/broker/feature.go Outdated
}

// Install the trigger
f.Setup("install trigger", trigger.Install(via, brokerName, cfg...))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@liuchangyan

Copy link
Copy Markdown
Contributor Author

looks like there is some funk going on in here:

    event_info_store.go:160: Timeout waiting for at least 1 matches.
        Error: FAIL MATCHING: saw 0/1 matching events.
        - Store-
        Pod 'sink-sralvegh' in namespace 'test-vhxgbfmt'
        - Recent events -
        1 events seen, last 1 events (total events seen 32, events ignored 31):
        -- EventInfo --
        --- Kind: Received ---
        --- Event ---
        Context Attributes,
          specversion: 1.0
          type: type1
          source: source1
          id: 25ef7129-e4fc-44d8-9ca1-e4d776797842
          datacontenttype: application/json
        Extensions,
          knativearrivaltime: 2022-10-25T04:52:29.153625148Z
          knativebrokerttl: 255
          knativeerrorcode: 422
          knativeerrordata: eyJlcnJkZXN0aW5hdGlvbiI6eyJTY2hlbWUiOiJodHRwIiwiT3BhcXVlIjoiIiwiVXNlciI6bnVsbCwiSG9zdCI6ImZhaWxlci1qc2d6dmdycy50ZXN0LXZoeGdiZm10LnN2Yy5jbHVzdGVyLmxvY2FsIiwiUGF0aCI6IiIsIlJhd1BhdGgiOiIiLCJGb3JjZVF1ZXJ5IjpmYWxzZSwiUmF3UXVlcnkiOiIiLCJGcmFnbWVudCI6IiIsIlJhd0ZyYWdtZW50IjoiIn0sImVycnJlc3BvbnNlYm9keSI6IiJ9
          knativeerrordest: http://broker-filter.knative-eventing-0fczwub0zw.svc.cluster.local/triggers/test-vhxgbfmt/via-qldxtpmh/64a8bc0c-c8de-4968-bf04-96671f93ca93
        Data,
          {
            "msg": "test msg"
          }

Let me test your branch, and this test locally

oh, I got the problem, there is a problem with a judgement condition: https://github.com/knative/eventing/pull/6569/files#:~:text=if%20destination.,var%20errExtensionInfo%20ErrExtensionInfo

Comment thread test/rekt/features/broker/feature.go Outdated
}

// Install the trigger
f.Setup("install trigger", trigger.Install(via, brokerName, cfg...))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@liuchangyan liuchangyan Oct 25, 2022 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll format it

@liuchangyan

Copy link
Copy Markdown
Contributor Author

@matzew Seems everything all right :)

@matzew

matzew commented Oct 25, 2022

Copy link
Copy Markdown
Member

/test unit-tests

@liuchangyan

Copy link
Copy Markdown
Contributor Author

/retest

@liuchangyan

Copy link
Copy Markdown
Contributor Author

@matzew matzew left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/approve

/test all

Comment thread pkg/broker/filter/filter_handler.go Resolved
@pierDipi

Copy link
Copy Markdown
Contributor

/test upgrade-tests

Comment on lines -395 to -396
additionalReplyHeaders: http.Header{"Retry-After": []string{"10"}},
expectedResponseHeaders: http.Header{"Retry-After": []string{"10"}},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are these removed?

Comment thread pkg/broker/filter/filter_handler.go Resolved
Comment thread pkg/broker/filter/filter_handler.go Resolved
Comment thread pkg/broker/filter/filter_handler.go Resolved
Comment thread pkg/broker/filter/filter_handler.go Resolved
Comment thread pkg/broker/filter/filter_handler.go Resolved
Name: "Knative Broker - DeadLetterSink - with Extensions",

Features: []*feature.Feature{
brokerSubscriberUnreachable(),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this one

@liuchangyan
liuchangyan force-pushed the KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker branch 4 times, most recently from 6fe215a to edeb56f Compare November 14, 2022 08:49
@liuchangyan
liuchangyan force-pushed the KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker branch from edeb56f to efb9fa4 Compare November 14, 2022 14:39
@liuchangyan
liuchangyan force-pushed the KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker branch from 3ccafa2 to fb3cc2e Compare November 15, 2022 10:50
Comment thread pkg/broker/filter/filter_handler.go Resolved
Comment thread pkg/broker/filter/filter_handler.go Outdated
dispatchTime := time.Since(start)
if err != nil {
err = fmt.Errorf("failed to dispatch message: %w", err)
responseErr.sendErr = true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we directly use resp != nil to infer sendErr

@liuchangyan
liuchangyan force-pushed the KNATIVE_Enhance_failed_events_extensions_in_MTChannelBroker branch from abf8afb to d71566b Compare November 16, 2022 11:23

@pierDipi pierDipi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @liuchangyan, this will make debugging so much easier!

@matzew any other comment?

/lgtm

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2022
@knative-prow

knative-prow Bot commented Nov 16, 2022

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liuchangyan, matzew, pierDipi

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

The pull request process is described here

Details 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 ed5e0a7 into knative:main Nov 16, 2022
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/test-and-release Test infrastructure, tests or release lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MTChannelBroker: Enhance failed events with extra metadata

5 participants