actionsmetrics

package
v0.27.6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package metrics provides monitoring of the GitHub related metrics.

This depends on the metrics exporter of kubebuilder. See https://book.kubebuilder.io/reference/metrics.html for details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHook

type EventHook func(interface{})

type EventReader

type EventReader struct {
	Log logr.Logger

	// GitHub Client to fetch information about job failures
	GitHubClient *github.Client

	// Event queue
	Events chan interface{}
}

func (*EventReader) HandleWorkflowJobEvent

func (reader *EventReader) HandleWorkflowJobEvent(event interface{})

HandleWorkflowJobEvent send event to reader channel for processing

forcing the events through a channel ensures they are processed in sequentially, and prevents any race conditions with githubWorkflowJobStatus

func (*EventReader) ProcessWorkflowJobEvent

func (reader *EventReader) ProcessWorkflowJobEvent(ctx context.Context, event interface{})

ProcessWorkflowJobEvent processes a single event

Events should be processed in the same order that Github emits them

func (*EventReader) ProcessWorkflowJobEvents

func (reader *EventReader) ProcessWorkflowJobEvents(ctx context.Context)

ProcessWorkflowJobEvents pop events in a loop for processing

Should be called asynchronously with `go`

type ParseResult

type ParseResult struct {
	ExitCode  string
	QueueTime time.Duration
	RunTime   time.Duration
}

type WebhookServer

type WebhookServer struct {
	Log logr.Logger

	// SecretKeyBytes is the byte representation of the Webhook secret token
	// the administrator is generated and specified in GitHub Web UI.
	SecretKeyBytes []byte

	// GitHub Client to discover runner groups assigned to a repository
	GitHubClient *github.Client

	// When HorizontalRunnerAutoscalerGitHubWebhook handles a request, each EventHook is sent the webhook event
	EventHooks []EventHook
}

WebhookServer is a HTTP server that handles workflow_job events sent from GitHub Actions

func (*WebhookServer) Handle

func (autoscaler *WebhookServer) Handle(w http.ResponseWriter, r *http.Request)

func (*WebhookServer) Reconcile

func (autoscaler *WebhookServer) Reconcile(_ context.Context, request reconcile.Request) (reconcile.Result, error)

Jump to

Keyboard shortcuts

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