Skip to content

Log dispatch errors in stub bus#386

Merged
knative-prow-robot merged 1 commit into
knative:masterfrom
greghaynes:fix/stub-dispatch-error-log
Aug 30, 2018
Merged

Log dispatch errors in stub bus#386
knative-prow-robot merged 1 commit into
knative:masterfrom
greghaynes:fix/stub-dispatch-error-log

Conversation

@greghaynes
Copy link
Copy Markdown
Contributor

@greghaynes greghaynes commented Aug 20, 2018

Proposed Changes

If we encounter an error when dispatching an event in the stub bus we
silently ignore it. Lets log the error instead.

Release Note

NONE

@knative-prow-robot knative-prow-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 20, 2018
@greghaynes greghaynes force-pushed the fix/stub-dispatch-error-log branch from f130cf6 to 4aee5e0 Compare August 20, 2018 22:15
@knative-metrics-robot
Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-eventing-go-coverage to run the coverage report again

File Old Coverage New Coverage Delta
pkg/buses/stub/main.go 5.4% 5.1% -0.3

@n3wscott
Copy link
Copy Markdown
Contributor

could you please add NONE to the release notes section.

@n3wscott
Copy link
Copy Markdown
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 20, 2018
@scothis
Copy link
Copy Markdown
Contributor

scothis commented Aug 23, 2018

/lgtm

This will conflict with #382, but I can manage the diff 😄

@greghaynes greghaynes force-pushed the fix/stub-dispatch-error-log branch from 4aee5e0 to e40dc37 Compare August 29, 2018 15:39
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Aug 29, 2018
Comment thread pkg/buses/stub/bus.go Outdated
go func() {
err := stubSubscription.dispatchMessage(message)
if err != nil {
glog.Errorf("Failed to dispatch message: %v", err)
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.

Error seems a bit extreme here. The dispatch could fail because of a misconfiguration in the subscription resource or the subscriber is down. It's not necessarily the fault of the bus.

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.

Good point - since this is also not expected behavior how do we feel about warning?

@greghaynes greghaynes force-pushed the fix/stub-dispatch-error-log branch from e40dc37 to a6daae9 Compare August 30, 2018 16:00
@bbrowning
Copy link
Copy Markdown
Contributor

I was recently bit by the stub bus silently dropping errors and had no idea what was going on until @greghaynes pointed me in this direction and the coredns issues. So, +1 for logging here.

@greghaynes greghaynes force-pushed the fix/stub-dispatch-error-log branch from a6daae9 to 00e52df Compare August 30, 2018 16:18
@knative-prow-robot knative-prow-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Aug 30, 2018
Comment thread pkg/buses/stub/bus.go Outdated
ReceiveMessageFunc: func(channelRef buses.ChannelReference, message *buses.Message) error {
bus.logger.Infof("Recieved message for %q channel", channelRef.String())
bus.channel(channelRef).receiveMessage(message)
bus.channel(channelRef).receiveMessage(bus, message)
Copy link
Copy Markdown
Contributor

@scothis scothis Aug 30, 2018

Choose a reason for hiding this comment

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

I'd be more inclined to capture the logger when creating the stubChannel rather then as a function param.

Sorry, this is a moving target. If you'd rather I'd be ok with taking this as is and following up later. (Of course someone with approval rights will need to agree)

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.

Not a problem - I can update with adding the logger the the stubChannel struct.

If we encounter an error when dispatching an event in the stub bus we
silently ignore it.
@greghaynes greghaynes force-pushed the fix/stub-dispatch-error-log branch from 00e52df to b6cf009 Compare August 30, 2018 18:22
@vaikas
Copy link
Copy Markdown
Contributor

vaikas commented Aug 30, 2018

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 30, 2018
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: greghaynes, vaikas-google

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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2018
@knative-prow-robot knative-prow-robot merged commit d58e308 into knative:master Aug 30, 2018
scothis added a commit to scothis/eventing that referenced this pull request Aug 30, 2018
The Channel and Subscription are interesting context to capture for
messages logged within stub bus.

Follow up to knative#386
knative-prow-robot pushed a commit that referenced this pull request Aug 30, 2018
The Channel and Subscription are interesting context to capture for
messages logged within stub bus.

Follow up to #386
matzew added a commit to matzew/eventing that referenced this pull request Jan 10, 2020
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. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants