server

package
v0.0.0-...-a196a74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandledEventsCounterWithLabelValues

func HandledEventsCounterWithLabelValues(lvs ...string) (prometheus.Counter, error)

HandledEventsCounterWithLabelValues replaces the method of the same name in MetricVec.

func RateLimitWithLabelValues

func RateLimitWithLabelValues(lvs ...string) (prometheus.Gauge, error)

RateLimitWithLabelValues replaces the method of the same name in MetricVec.

func RegisterMetrics

func RegisterMetrics(client ghclient.Client) []error

RegisterMetrics registers prometheus collectors to collect metrics

func RegisterOrAssignCollector

func RegisterOrAssignCollector(collector prometheus.Collector, errors *[]error, assign func(regCollector prometheus.Collector))

RegisterOrAssignCollector registers the provided Collector with the DefaultRegisterer and assigns the Collector, unless an equal Collector was registered before, in which case that Collector is assigned.

func UnRegisterAndResetMetrics

func UnRegisterAndResetMetrics()

UnRegisterAndResetMetrics unregisters and reset prometheus collectors.

func WebHookCounterWithLabelValues

func WebHookCounterWithLabelValues(lvs ...string) (prometheus.Counter, error)

WebHookCounterWithLabelValues replaces the method of the same name in MetricVec.

Types

type GitHubEventHandler

type GitHubEventHandler interface {
	HandlePullRequestEvent(logger log.Logger, event *gogh.PullRequestEvent) error
	HandleIssueCommentEvent(logger log.Logger, event *gogh.IssueCommentEvent) error
}

GitHubEventHandler is a type which keeps the logic of handling GitHub events for the given plugin implementation. It is used by Server implementation to handle incoming events.

type Server

type Server struct {
	GitHubEventHandler GitHubEventHandler
	HmacSecret         []byte
	PluginName         string
}

Server implements http.Handler. It validates incoming GitHub webhooks and then dispatches them to the appropriate plugins.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP validates an incoming webhook and puts it into the event channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL