server

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingMetricsExporter added in v0.4.0

type BillingMetricsExporter struct {
	GHClient *github.Client
	Logger   log.Logger
	Opts     Opts
}

func NewBillingMetricsExporter added in v0.4.0

func NewBillingMetricsExporter(logger log.Logger, opts Opts) *BillingMetricsExporter

func (*BillingMetricsExporter) StartOrgBilling added in v0.4.0

func (c *BillingMetricsExporter) StartOrgBilling(ctx context.Context) error

func (*BillingMetricsExporter) StartUserBilling added in v0.4.0

func (c *BillingMetricsExporter) StartUserBilling(ctx context.Context) error

type Opts

type Opts struct {
	MetricsPath          string
	ListenAddressMetrics string
	ListenAddressIngress string
	WebhookPath          string
	// GitHub webhook token.
	GitHubToken string
	// GitHub API token.
	GitHubAPIToken        string
	GitHubOrg             string
	GitHubUser            string
	BillingAPIPollSeconds int
}

type PrometheusObserver added in v0.4.0

type PrometheusObserver struct{}

func (*PrometheusObserver) CountWorkflowJobDuration added in v0.4.0

func (o *PrometheusObserver) CountWorkflowJobDuration(org, repo, status, conclusion, runnerGroup, workflowName, jobName string, seconds float64)

func (*PrometheusObserver) CountWorkflowJobStatus added in v0.4.0

func (o *PrometheusObserver) CountWorkflowJobStatus(org, repo, status, conclusion, runnerGroup, workflowName, jobName string)

func (*PrometheusObserver) CountWorkflowRunStatus added in v0.4.0

func (o *PrometheusObserver) CountWorkflowRunStatus(org, repo, status, conclusion, workflowName string)

func (*PrometheusObserver) ObserveWorkflowJobDuration added in v0.4.0

func (o *PrometheusObserver) ObserveWorkflowJobDuration(org, repo, state, runnerGroup, workflowName, jobName string, seconds float64)

func (*PrometheusObserver) ObserveWorkflowRunDuration added in v0.4.0

func (o *PrometheusObserver) ObserveWorkflowRunDuration(org, repo, workflowName, conclusion string, seconds float64)

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(_ context.Context) error

func (*Server) Shutdown

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

type WorkflowMetricsExporter added in v0.4.0

type WorkflowMetricsExporter struct {
	GHClient           *github.Client
	Logger             log.Logger
	Opts               Opts
	PrometheusObserver WorkflowObserver
}

WorkflowMetricsExporter struct to hold some information

func NewWorkflowMetricsExporter added in v0.4.0

func NewWorkflowMetricsExporter(logger log.Logger, opts Opts) *WorkflowMetricsExporter

func (*WorkflowMetricsExporter) CollectWorkflowJobEvent added in v0.4.0

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

func (*WorkflowMetricsExporter) CollectWorkflowRunEvent added in v0.4.0

func (c *WorkflowMetricsExporter) CollectWorkflowRunEvent(event *github.WorkflowRunEvent)

func (*WorkflowMetricsExporter) HandleGHWebHook added in v0.4.0

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

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

type WorkflowObserver added in v0.4.0

type WorkflowObserver interface {
	ObserveWorkflowJobDuration(org, repo, state, runnerGroup, workflowName, jobName string, seconds float64)
	CountWorkflowJobStatus(org, repo, status, conclusion, runnerGroup, workflowName, jobName string)
	CountWorkflowJobDuration(org, repo, status, conclusion, runnerGroup, workflowName, jobName string, seconds float64)

	ObserveWorkflowRunDuration(org, repo, workflow, conclusion string, seconds float64)
	CountWorkflowRunStatus(org, repo, status, conclusion, workflow string)
}

Jump to

Keyboard shortcuts

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