Documentation ¶
Index ¶
- func NewCountPlugin(runner func(Plugin) error) *cobra.Command
- type ActiveState
- type AuthorFilterPluginWrapper
- func (a *AuthorFilterPluginWrapper) AddFlags(cmd *cobra.Command)
- func (a *AuthorFilterPluginWrapper) ReceiveComment(comment sql.Comment) []Point
- func (a *AuthorFilterPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
- func (a *AuthorFilterPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
- type AuthorLoggerPluginWrapper
- func (a *AuthorLoggerPluginWrapper) AddFlags(cmd *cobra.Command)
- func (a *AuthorLoggerPluginWrapper) ReceiveComment(comment sql.Comment) []Point
- func (a *AuthorLoggerPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
- func (a *AuthorLoggerPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
- type BundledStates
- type ByDuration
- type CloseEvent
- type CommentCounterPlugin
- func (c *CommentCounterPlugin) AddFlags(cmd *cobra.Command)
- func (c *CommentCounterPlugin) CheckFlags() error
- func (c *CommentCounterPlugin) ReceiveComment(comment sql.Comment) []Point
- func (CommentCounterPlugin) ReceiveIssue(issue sql.Issue) []Point
- func (CommentCounterPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
- type CommentEvent
- type DummyPlugin
- type EventCounterPlugin
- func (e *EventCounterPlugin) AddFlags(cmd *cobra.Command)
- func (e *EventCounterPlugin) CheckFlags() error
- func (e *EventCounterPlugin) ReceiveComment(comment sql.Comment) []Point
- func (e *EventCounterPlugin) ReceiveIssue(issue sql.Issue) []Point
- func (e *EventCounterPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
- type EventMatcher
- type EventTimeHeap
- type FakeCommentPluginWrapper
- type FakeOpenPluginWrapper
- type FalseEvent
- type InactiveState
- type LabelEvent
- type MergeEvent
- type MultiState
- type MultiplexerPluginWrapper
- type OpenEvent
- type Plugin
- type Point
- type ReopenEvent
- type State
- type StatePlugin
- type TrueEvent
- type TypeFilterWrapperPlugin
- func (t *TypeFilterWrapperPlugin) AddFlags(cmd *cobra.Command)
- func (t *TypeFilterWrapperPlugin) CheckFlags() error
- func (t *TypeFilterWrapperPlugin) ReceiveComment(comment sql.Comment) []Point
- func (t *TypeFilterWrapperPlugin) ReceiveIssue(issue sql.Issue) []Point
- func (t *TypeFilterWrapperPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
- type UnlabelEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActiveState ¶
type ActiveState struct {
// contains filtered or unexported fields
}
ActiveState describe a states that has been enabled.
func (ActiveState) Active ¶
func (ActiveState) Active() bool
Active if always true for an ActiveState
func (*ActiveState) Age ¶
func (a *ActiveState) Age(t time.Time) time.Duration
Age gives the time since the state has been activated.
func (*ActiveState) ReceiveEvent ¶
ReceiveEvent checks if the event matches the exit criteria. Returns a new InactiveState or self, and true if it changed.
type AuthorFilterPluginWrapper ¶
type AuthorFilterPluginWrapper struct {
// contains filtered or unexported fields
}
AuthorFilterPluginWrapper ignore comments and events from some authors
func NewAuthorFilterPluginWrapper ¶
func NewAuthorFilterPluginWrapper(plugin Plugin) *AuthorFilterPluginWrapper
NewAuthorFilterPluginWrapper is the constructor for AuthorFilterPluginWrapper
func (*AuthorFilterPluginWrapper) AddFlags ¶
func (a *AuthorFilterPluginWrapper) AddFlags(cmd *cobra.Command)
AddFlags adds "ignore-authors" <authors> to the command help
func (*AuthorFilterPluginWrapper) ReceiveComment ¶
func (a *AuthorFilterPluginWrapper) ReceiveComment(comment sql.Comment) []Point
ReceiveComment calls plugin.ReceiveComment() if the author is not filtered
func (*AuthorFilterPluginWrapper) ReceiveIssue ¶
func (a *AuthorFilterPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue calls plugin.ReceiveIssue() if the author is not filtered
func (*AuthorFilterPluginWrapper) ReceiveIssueEvent ¶
func (a *AuthorFilterPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent calls plugin.ReceiveIssueEvent() if the author is not filtered
type AuthorLoggerPluginWrapper ¶
type AuthorLoggerPluginWrapper struct {
// contains filtered or unexported fields
}
AuthorLoggerPluginWrapper logs the author on all the Points returned. This is enabled by command-line.
func NewAuthorLoggerPluginWrapper ¶
func NewAuthorLoggerPluginWrapper(plugin Plugin) *AuthorLoggerPluginWrapper
NewAuthorLoggerPluginWrapper is the constructor for AuthorLoggerPluginWrapper
func (*AuthorLoggerPluginWrapper) AddFlags ¶
func (a *AuthorLoggerPluginWrapper) AddFlags(cmd *cobra.Command)
AddFlags adds "log-authors" <authors> to the command help
func (*AuthorLoggerPluginWrapper) ReceiveComment ¶
func (a *AuthorLoggerPluginWrapper) ReceiveComment(comment sql.Comment) []Point
ReceiveComment is a wrapper on plugin.ReceiveComment() logging the author
func (*AuthorLoggerPluginWrapper) ReceiveIssue ¶
func (a *AuthorLoggerPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue is a wrapper on plugin.ReceiveIssue() logging the author
func (*AuthorLoggerPluginWrapper) ReceiveIssueEvent ¶
func (a *AuthorLoggerPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent is a wrapper on plugin.ReceiveIssueEvent() logging the author
type BundledStates ¶
type BundledStates struct {
// contains filtered or unexported fields
}
BundledStates saves the state of multiple issues/pull-requests. This will also allow us to then compute statistics on these states like: - Number of pull-requests in activated states (first return value of Total()) - Sum of time since activated pull-requests are activated (second return value of Total()) - Get a specific percentile time for activated pull-requests (Percentile())
func NewBundledStates ¶
func NewBundledStates(description string) BundledStates
NewBundledStates is the constructor for BundledStates
func (BundledStates) Percentile ¶
Percentile returns given percentile for age of all active states at time t
func (BundledStates) ReceiveEvent ¶
ReceiveEvent is called when something happens on an issue. The state for that issue is updated.
type ByDuration ¶
ByDuration sorts a slice of time.Duration
func (ByDuration) Len ¶
func (b ByDuration) Len() int
func (ByDuration) Less ¶
func (b ByDuration) Less(i, j int) bool
func (ByDuration) Swap ¶
func (b ByDuration) Swap(i, j int)
type CommentCounterPlugin ¶
type CommentCounterPlugin struct {
// contains filtered or unexported fields
}
CommentCounterPlugin counts comments
func (*CommentCounterPlugin) AddFlags ¶
func (c *CommentCounterPlugin) AddFlags(cmd *cobra.Command)
AddFlags adds "comments" <comments> to the command help
func (*CommentCounterPlugin) CheckFlags ¶
func (c *CommentCounterPlugin) CheckFlags() error
CheckFlags looks for comments matching regexes
func (*CommentCounterPlugin) ReceiveComment ¶
func (c *CommentCounterPlugin) ReceiveComment(comment sql.Comment) []Point
ReceiveComment adds matching comments to InfluxDB
func (CommentCounterPlugin) ReceiveIssue ¶
func (CommentCounterPlugin) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue is needed to implement a Plugin
func (CommentCounterPlugin) ReceiveIssueEvent ¶
func (CommentCounterPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent is needed to implement a Plugin
type CommentEvent ¶
type CommentEvent struct{}
CommentEvent is a "commented" event
func (CommentEvent) Match ¶
func (CommentEvent) Match(eventName, label string) bool
Match is "commented"
type DummyPlugin ¶
type DummyPlugin struct{}
DummyPlugin is an empty plugin
func (DummyPlugin) ReceiveComment ¶
func (DummyPlugin) ReceiveComment(comment sql.Comment) []Point
ReceiveComment is needed to implement a Plugin
func (DummyPlugin) ReceiveIssue ¶
func (DummyPlugin) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue is needed to implement a Plugin
func (DummyPlugin) ReceiveIssueEvent ¶
func (DummyPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent is needed to implement a Plugin
type EventCounterPlugin ¶
type EventCounterPlugin struct {
// contains filtered or unexported fields
}
EventCounterPlugin counts events
func (*EventCounterPlugin) AddFlags ¶
func (e *EventCounterPlugin) AddFlags(cmd *cobra.Command)
AddFlags adds "event" to the command help
func (*EventCounterPlugin) CheckFlags ¶
func (e *EventCounterPlugin) CheckFlags() error
CheckFlags is delegated to EventMatcher
func (*EventCounterPlugin) ReceiveComment ¶
func (e *EventCounterPlugin) ReceiveComment(comment sql.Comment) []Point
ReceiveComment is needed to implement a Plugin
func (*EventCounterPlugin) ReceiveIssue ¶
func (e *EventCounterPlugin) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue is needed to implement a Plugin
func (*EventCounterPlugin) ReceiveIssueEvent ¶
func (e *EventCounterPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent adds issue events to InfluxDB
type EventMatcher ¶
type EventMatcher interface { // Does eventName and label match the event Match(eventName, label string) bool // Return the opposite of this eventmatcher Opposite() EventMatcher }
EventMatcher generates events based on name and labels
func NewEventMatcher ¶
func NewEventMatcher(eventDescription string) EventMatcher
NewEventMatcher returns the correct EventMatcher based on description Incoming event should have the following form: eventName:labelName. If eventName is not label, then the second part can be omitted.
type EventTimeHeap ¶
type EventTimeHeap []sql.IssueEvent
EventTimeHeap is a min-heap on Event creation time
func (EventTimeHeap) Len ¶
func (t EventTimeHeap) Len() int
func (EventTimeHeap) Less ¶
func (t EventTimeHeap) Less(i, j int) bool
func (*EventTimeHeap) Pop ¶
func (t *EventTimeHeap) Pop() interface{}
Pop retrieves the last added event
func (*EventTimeHeap) Push ¶
func (t *EventTimeHeap) Push(x interface{})
Push adds event to the heap
func (EventTimeHeap) Swap ¶
func (t EventTimeHeap) Swap(i, j int)
type FakeCommentPluginWrapper ¶
type FakeCommentPluginWrapper struct {
// contains filtered or unexported fields
}
FakeCommentPluginWrapper is a plugin wrapper creating fake "commented" events
func NewFakeCommentPluginWrapper ¶
func NewFakeCommentPluginWrapper(plugin Plugin) *FakeCommentPluginWrapper
NewFakeCommentPluginWrapper is the constructor for FakeCommentPluginWrapper
func (*FakeCommentPluginWrapper) ReceiveComment ¶
func (o *FakeCommentPluginWrapper) ReceiveComment(comment sql.Comment) []Point
ReceiveComment creates a fake "commented" event
func (*FakeCommentPluginWrapper) ReceiveIssue ¶
func (o *FakeCommentPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue is a wrapper on plugin.ReceiveIssue()
func (*FakeCommentPluginWrapper) ReceiveIssueEvent ¶
func (o *FakeCommentPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent is a wrapper on plugin.ReceiveIssueEvent()
type FakeOpenPluginWrapper ¶
type FakeOpenPluginWrapper struct {
// contains filtered or unexported fields
}
FakeOpenPluginWrapper sends new "opened" event to ReceiveEvent
func NewFakeOpenPluginWrapper ¶
func NewFakeOpenPluginWrapper(plugin Plugin) *FakeOpenPluginWrapper
NewFakeOpenPluginWrapper is the constructor for FakeOpenPluginWrapper
func (*FakeOpenPluginWrapper) ReceiveComment ¶
func (o *FakeOpenPluginWrapper) ReceiveComment(comment sql.Comment) []Point
ReceiveComment is a wrapper on plugin.ReceiveComment()
func (*FakeOpenPluginWrapper) ReceiveIssue ¶
func (o *FakeOpenPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue creates a fake "opened" event
func (*FakeOpenPluginWrapper) ReceiveIssueEvent ¶
func (o *FakeOpenPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent injects an extra "opened" event before calling plugin.ReceiveIssueEvent()
type InactiveState ¶
type InactiveState struct {
// contains filtered or unexported fields
}
InactiveState describes a state that has not enabled, or been disabled.
func (InactiveState) Active ¶
func (InactiveState) Active() bool
Active is always false for an InactiveState
func (*InactiveState) Age ¶
func (i *InactiveState) Age(t time.Time) time.Duration
Age doesn't make sense for InactiveState.
func (*InactiveState) ReceiveEvent ¶
ReceiveEvent checks if the event matches the entry criteria Returns a new ActiveState or self, and true if it changed.
type LabelEvent ¶
type LabelEvent struct {
Label string
}
LabelEvent is a "labeled" event
func (LabelEvent) Match ¶
func (l LabelEvent) Match(eventName, label string) bool
Match is "labeled" with label
type MultiState ¶
type MultiState struct {
// contains filtered or unexported fields
}
MultiState tracks multiple individual states at the same time.
func (*MultiState) Active ¶
func (m *MultiState) Active() bool
Active is true if all the states are active.
func (*MultiState) Age ¶
func (m *MultiState) Age(t time.Time) time.Duration
Age returns the time since all states have been activated. It will panic if any of the state is not active.
func (*MultiState) ReceiveEvent ¶
ReceiveEvent will send the event to each individual state, and update them if they change.
type MultiplexerPluginWrapper ¶
type MultiplexerPluginWrapper struct {
// contains filtered or unexported fields
}
MultiplexerPluginWrapper allows registering multiple plugins for events
func NewMultiplexerPluginWrapper ¶
func NewMultiplexerPluginWrapper(plugins ...Plugin) *MultiplexerPluginWrapper
NewMultiplexerPluginWrapper is the constructor for MultiplexerPluginWrapper
func (*MultiplexerPluginWrapper) ReceiveComment ¶
func (m *MultiplexerPluginWrapper) ReceiveComment(comment sql.Comment) []Point
ReceiveComment calls plugin.ReceiveComment() for all plugins
func (*MultiplexerPluginWrapper) ReceiveIssue ¶
func (m *MultiplexerPluginWrapper) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue calls plugin.ReceiveIssue() for all plugins
func (*MultiplexerPluginWrapper) ReceiveIssueEvent ¶
func (m *MultiplexerPluginWrapper) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent calls plugin.ReceiveIssueEvent() for all plugins
type Plugin ¶
type Plugin interface { ReceiveIssue(sql.Issue) []Point ReceiveComment(sql.Comment) []Point ReceiveIssueEvent(sql.IssueEvent) []Point }
Plugin is the generic interface for metrics stats and measurement. Each metric will be implemented as a Plugin, compute the measurement and push it to the InfluxDatabase. nil Point means there is nothing to return.
type ReopenEvent ¶
type ReopenEvent struct{}
ReopenEvent is a "reopened" event
func (ReopenEvent) Match ¶
func (ReopenEvent) Match(eventName, label string) bool
Match is "reopened"
type State ¶
type State interface { // Has the state been activated Active() bool // How long has the state been activated (will panic if not active) Age(t time.Time) time.Duration // Receive the event, return the new state ReceiveEvent(eventName, label string, t time.Time) (State, bool) }
State describes a pull-request states, based on the events we've seen.
type StatePlugin ¶
type StatePlugin struct {
// contains filtered or unexported fields
}
StatePlugin records age percentiles of issues in InfluxDB
func (*StatePlugin) AddFlags ¶
func (s *StatePlugin) AddFlags(cmd *cobra.Command)
AddFlags adds "state" and "percentiles" to the command help
func (*StatePlugin) CheckFlags ¶
func (s *StatePlugin) CheckFlags() error
CheckFlags configures which states to monitor
func (*StatePlugin) ReceiveComment ¶
func (s *StatePlugin) ReceiveComment(comment sql.Comment) []Point
ReceiveComment is needed to implement a Plugin
func (*StatePlugin) ReceiveIssue ¶
func (s *StatePlugin) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue is needed to implement a Plugin
func (*StatePlugin) ReceiveIssueEvent ¶
func (s *StatePlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent computes age percentiles and saves them to InfluxDB
type TypeFilterWrapperPlugin ¶
type TypeFilterWrapperPlugin struct {
// contains filtered or unexported fields
}
TypeFilterWrapperPlugin allows ignoring either PR or issues from processing
func NewTypeFilterWrapperPlugin ¶
func NewTypeFilterWrapperPlugin(plugin Plugin) *TypeFilterWrapperPlugin
NewTypeFilterWrapperPlugin is the constructor of TypeFilterWrapperPlugin
func (*TypeFilterWrapperPlugin) AddFlags ¶
func (t *TypeFilterWrapperPlugin) AddFlags(cmd *cobra.Command)
AddFlags adds "no-pull-requests" and "no-issues" to the command help
func (*TypeFilterWrapperPlugin) CheckFlags ¶
func (t *TypeFilterWrapperPlugin) CheckFlags() error
CheckFlags makes sure not both PR and issues are ignored
func (*TypeFilterWrapperPlugin) ReceiveComment ¶
func (t *TypeFilterWrapperPlugin) ReceiveComment(comment sql.Comment) []Point
ReceiveComment calls plugin.ReceiveComment() if issues are not ignored
func (*TypeFilterWrapperPlugin) ReceiveIssue ¶
func (t *TypeFilterWrapperPlugin) ReceiveIssue(issue sql.Issue) []Point
ReceiveIssue calls plugin.ReceiveIssue() if issues are not ignored
func (*TypeFilterWrapperPlugin) ReceiveIssueEvent ¶
func (t *TypeFilterWrapperPlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point
ReceiveIssueEvent calls plugin.ReceiveIssueEvent() if issues are not ignored
type UnlabelEvent ¶
type UnlabelEvent struct {
Label string
}
UnlabelEvent is an "unlabeled" event
func (UnlabelEvent) Match ¶
func (u UnlabelEvent) Match(eventName, label string) bool
Match is "unlabeled"