-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add event framework (Log Lossy Feed events) #89
Conversation
78af451
to
04ba4bc
Compare
04ba4bc
to
1c704e7
Compare
1c704e7
to
4503ae5
Compare
99cdf0c
to
b6c14e8
Compare
// Checks whether an event should be dispatched under the configured | ||
// filter options. | ||
// Options are applied as follows: | ||
// - disabled event types are always disabled. |
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.
nit: extra space
config/scheduledfeed.go
Outdated
default: | ||
return nil, fmt.Errorf( | ||
"unknown sink type '%v' provided to events configuration", | ||
ec.Sink, |
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.
Could be nice to provide the available sink types here in the error message? However this does then open the question if we should be doing similar for all config options so that's potentially suited for a followup.
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.
This would be easy to do now but would add an additional burden to adding sinks which could easily be missed. I think that adding documentation for the currently supported sinks/publishers/feeds etc is something that should be done for supporting user configuration. #97 is open to track this.
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.
Agreed
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.
Great! Until #97 is resolved it may be worth just adding a small snippet to the example config in the README
as part of this PR, highlighting it optionally enabled (not blocking on this however).
As this is essentially opening up a new data type that can be put 'on the wire', (including the scope to have pubsub The event introduced here exercises all of the methods provided by the interface (component, type, message) when generating the logrus output. Could |
I think that the definition of an
Yeah I think this might need some tweaking to have an easily method of encoding data for transmission. We might want some form of standardised event payload which the individual Event implementations can populate. The current method of having the sink switch based on the event type isn't very extendable for many sinks and many events. |
91c385b
to
693dff8
Compare
Extending the event framework for event serialization for future sinks is being tracked as part of issue #96. |
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.
Other than my open 'nit' comment this all looks good to me, taking into account the followup issues that have been generated. Feel free to resolve the README suggestion comment regardless.
693dff8
to
cae2d39
Compare
This PR introduces an event framework for driving defined system events through a sink interface. A logrus logging sink is implemented initially for logging event locally but event could also be dispatched to alternative metrics/logging mechanisms. The initial event which is added for this is to log and identify potential loss of data between polling intervals. This lossy feed problem is detailed in issue ossf#83 and whilst this doesn't fix the problem, it can help to identify and monitor occurances of this issue within a long running production environment. Lossy feed detection occurs on a feed by feed basis and is up to the implementor to enable through the use of a utility struct `LossyFeedAlerter`.
Adds lossy feed checking for npm, pypi, crates and rubygems feeds using the event framework.
cae2d39
to
3ddf962
Compare
This PR introduces an event framework for driving defined system events
through a sink interface. A logrus logging sink is implemented
initially for logging event locally but event could also be
dispatched to alternative metrics/logging mechanisms.
The initial event which is added for this is to log and
identify potential loss of data between polling intervals.
This lossy feed problem is detailed in issue #83 and whilst
this doesn't fix the problem, it can help to identify and monitor
occurrences of this issue within a long running production environment.
Lossy feed event checking and dispatch is added as a utility in the feeds package
and is implemented within the currently supported feeds which have the potential to be lossy
(crates, npm, pypi, rubygems).