server

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GHActionExporter

type GHActionExporter struct {
	GHClient    *github.Client
	Logger      log.Logger
	Opts        Opts
	JobObserver WorkflowJobObserver
}

GHActionExporter struct to hold some information

func NewGHActionExporter

func NewGHActionExporter(logger log.Logger, opts Opts) *GHActionExporter

func (*GHActionExporter) CollectActionBilling

func (c *GHActionExporter) CollectActionBilling()

CollectActionBilling collect the action billing.

func (*GHActionExporter) CollectWorkflowJobEvent

func (c *GHActionExporter) CollectWorkflowJobEvent(event *github.WorkflowJobEvent)

func (*GHActionExporter) CollectWorkflowRun

func (c *GHActionExporter) CollectWorkflowRun(checkRunEvent *github.CheckRunEvent)

CollectWorkflowRun collect the workflow execution run metric

func (*GHActionExporter) HandleGHWebHook

func (c *GHActionExporter) HandleGHWebHook(w http.ResponseWriter, r *http.Request)

handleGHWebHook responds to POST /gh_event, when receive a event from GitHub.

type JobObserver

type JobObserver struct{}

func (*JobObserver) ObserveWorkflowJobDuration

func (o *JobObserver) ObserveWorkflowJobDuration(org, repo, state, runnerGroup string, seconds float64)

type Opts

type Opts struct {
	MetricsPath   string
	ListenAddress string
	WebhookPath   string
	// GitHub webhook token.
	GitHubToken string
	// GitHub API token.
	GitHubAPIToken string
	GitHubOrg      string
	GitHubUser     string
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(logger log.Logger, opts Opts) *Server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type WorkflowJobObserver

type WorkflowJobObserver interface {
	ObserveWorkflowJobDuration(org, repo, state, runnerGroup string, seconds float64)
}

Jump to

Keyboard shortcuts

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