controller

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCollectorCoverage

func NewCollectorCoverage() prometheus.Collector

NewCollectorCoverage returns a new collector for the gitlab_ci_pipeline_coverage metric

func NewCollectorDurationSeconds

func NewCollectorDurationSeconds() prometheus.Collector

NewCollectorDurationSeconds returns a new collector for the gitlab_ci_pipeline_duration_seconds metric

func NewCollectorEnvironmentBehindCommitsCount

func NewCollectorEnvironmentBehindCommitsCount() prometheus.Collector

NewCollectorEnvironmentBehindCommitsCount returns a new collector for the gitlab_ci_environment_behind_commits_count metric

func NewCollectorEnvironmentBehindDurationSeconds

func NewCollectorEnvironmentBehindDurationSeconds() prometheus.Collector

NewCollectorEnvironmentBehindDurationSeconds returns a new collector for the gitlab_ci_environment_behind_duration_seconds metric

func NewCollectorEnvironmentDeploymentCount

func NewCollectorEnvironmentDeploymentCount() prometheus.Collector

NewCollectorEnvironmentDeploymentCount returns a new collector for the gitlab_ci_environment_deployment_count metric

func NewCollectorEnvironmentDeploymentDurationSeconds

func NewCollectorEnvironmentDeploymentDurationSeconds() prometheus.Collector

NewCollectorEnvironmentDeploymentDurationSeconds returns a new collector for the gitlab_ci_environment_deployment_duration_seconds metric

func NewCollectorEnvironmentDeploymentJobID

func NewCollectorEnvironmentDeploymentJobID() prometheus.Collector

NewCollectorEnvironmentDeploymentJobID returns a new collector for the gitlab_ci_environment_deployment_id metric

func NewCollectorEnvironmentDeploymentStatus

func NewCollectorEnvironmentDeploymentStatus() prometheus.Collector

NewCollectorEnvironmentDeploymentStatus returns a new collector for the gitlab_ci_environment_deployment_status metric

func NewCollectorEnvironmentDeploymentTimestamp

func NewCollectorEnvironmentDeploymentTimestamp() prometheus.Collector

NewCollectorEnvironmentDeploymentTimestamp returns a new collector for the gitlab_ci_environment_deployment_timestamp metric

func NewCollectorEnvironmentInformation

func NewCollectorEnvironmentInformation() prometheus.Collector

NewCollectorEnvironmentInformation returns a new collector for the gitlab_ci_environment_information metric

func NewCollectorID

func NewCollectorID() prometheus.Collector

NewCollectorID returns a new collector for the gitlab_ci_pipeline_id metric

func NewCollectorJobArtifactSizeBytes

func NewCollectorJobArtifactSizeBytes() prometheus.Collector

NewCollectorJobArtifactSizeBytes returns a new collector for the gitlab_ci_pipeline_job_artifact_size_bytes metric

func NewCollectorJobDurationSeconds

func NewCollectorJobDurationSeconds() prometheus.Collector

NewCollectorJobDurationSeconds returns a new collector for the gitlab_ci_pipeline_job_duration_seconds metric

func NewCollectorJobID

func NewCollectorJobID() prometheus.Collector

NewCollectorJobID returns a new collector for the gitlab_ci_pipeline_job_id metric

func NewCollectorJobQueuedDurationSeconds

func NewCollectorJobQueuedDurationSeconds() prometheus.Collector

NewCollectorJobQueuedDurationSeconds returns a new collector for the gitlab_ci_pipeline_job_queued_duration_seconds metric

func NewCollectorJobRunCount

func NewCollectorJobRunCount() prometheus.Collector

NewCollectorJobRunCount returns a new collector for the gitlab_ci_pipeline_job_run_count metric

func NewCollectorJobStatus

func NewCollectorJobStatus() prometheus.Collector

NewCollectorJobStatus returns a new collector for the gitlab_ci_pipeline_job_status metric

func NewCollectorJobTimestamp

func NewCollectorJobTimestamp() prometheus.Collector

NewCollectorJobTimestamp returns a new collector for the gitlab_ci_pipeline_job_timestamp metric

func NewCollectorQueuedDurationSeconds

func NewCollectorQueuedDurationSeconds() prometheus.Collector

NewCollectorQueuedDurationSeconds returns a new collector for the gitlab_ci_pipeline_queued_duration_seconds metric

func NewCollectorRunCount

func NewCollectorRunCount() prometheus.Collector

NewCollectorRunCount returns a new collector for the gitlab_ci_pipeline_run_count metric

func NewCollectorStatus

func NewCollectorStatus() prometheus.Collector

NewCollectorStatus returns a new collector for the gitlab_ci_pipeline_status metric

func NewCollectorTimestamp

func NewCollectorTimestamp() prometheus.Collector

NewCollectorTimestamp returns a new collector for the gitlab_ci_pipeline_timestamp metric

Types

type Controller

type Controller struct {
	Config         config.Config
	Redis          *redis.Client
	Gitlab         *gitlab.Client
	Store          store.Store
	TaskController TaskController
}

Controller holds the necessary clients to run the app and handle requests

func New

func New(ctx context.Context, cfg config.Config, version string) (c Controller, err error)

New creates a new controller

func (*Controller) GarbageCollectEnvironments

func (c *Controller) GarbageCollectEnvironments(_ context.Context) error

GarbageCollectEnvironments ..

func (*Controller) GarbageCollectMetrics

func (c *Controller) GarbageCollectMetrics(_ context.Context) error

GarbageCollectMetrics ..

func (*Controller) GarbageCollectProjects

func (c *Controller) GarbageCollectProjects(_ context.Context) error

GarbageCollectProjects ..

func (*Controller) GarbageCollectRefs

func (c *Controller) GarbageCollectRefs(_ context.Context) error

GarbageCollectRefs ..

func (*Controller) GetRefs

func (c *Controller) GetRefs(p schemas.Project) (
	refs schemas.Refs,
	err error,
)

GetRefs ..

func (*Controller) HealthCheckHandler

func (c *Controller) HealthCheckHandler() (h healthcheck.Handler)

HealthCheckHandler ..

func (*Controller) MetricsHandler

func (c *Controller) MetricsHandler(w http.ResponseWriter, r *http.Request)

MetricsHandler ..

func (*Controller) ProcessJobMetrics

func (c *Controller) ProcessJobMetrics(ref schemas.Ref, job schemas.Job)

ProcessJobMetrics ..

func (*Controller) PullEnvironmentMetrics

func (c *Controller) PullEnvironmentMetrics(env schemas.Environment) (err error)

PullEnvironmentMetrics ..

func (*Controller) PullEnvironmentsFromProject

func (c *Controller) PullEnvironmentsFromProject(ctx context.Context, p schemas.Project) (err error)

PullEnvironmentsFromProject ..

func (*Controller) PullProjectsFromWildcard

func (c *Controller) PullProjectsFromWildcard(ctx context.Context, w config.Wildcard) error

PullProjectsFromWildcard ..

func (*Controller) PullRefMetrics

func (c *Controller) PullRefMetrics(ref schemas.Ref) error

PullRefMetrics ..

func (*Controller) PullRefMostRecentJobsMetrics

func (c *Controller) PullRefMostRecentJobsMetrics(ref schemas.Ref) error

PullRefMostRecentJobsMetrics ..

func (*Controller) PullRefPipelineJobsMetrics

func (c *Controller) PullRefPipelineJobsMetrics(ref schemas.Ref) error

PullRefPipelineJobsMetrics ..

func (*Controller) PullRefsFromProject

func (c *Controller) PullRefsFromProject(ctx context.Context, p schemas.Project) error

PullRefsFromProject ..

func (*Controller) Schedule

func (c *Controller) Schedule(ctx context.Context, pull config.Pull, gc config.GarbageCollect)

Schedule ..

func (*Controller) ScheduleTask

func (c *Controller) ScheduleTask(ctx context.Context, tt TaskType, args ...interface{})

ScheduleTask ..

func (*Controller) ScheduleTaskWithTicker

func (c *Controller) ScheduleTaskWithTicker(ctx context.Context, tt TaskType, intervalSeconds int)

ScheduleTaskWithTicker ..

func (*Controller) TaskHandlerGarbageCollectEnvironments

func (c *Controller) TaskHandlerGarbageCollectEnvironments(ctx context.Context) error

TaskHandlerGarbageCollectEnvironments ..

func (*Controller) TaskHandlerGarbageCollectMetrics

func (c *Controller) TaskHandlerGarbageCollectMetrics(ctx context.Context) error

TaskHandlerGarbageCollectMetrics ..

func (*Controller) TaskHandlerGarbageCollectProjects

func (c *Controller) TaskHandlerGarbageCollectProjects(ctx context.Context) error

TaskHandlerGarbageCollectProjects ..

func (*Controller) TaskHandlerGarbageCollectRefs

func (c *Controller) TaskHandlerGarbageCollectRefs(ctx context.Context) error

TaskHandlerGarbageCollectRefs ..

func (*Controller) TaskHandlerPullEnvironmentMetrics

func (c *Controller) TaskHandlerPullEnvironmentMetrics(env schemas.Environment)

TaskHandlerPullEnvironmentMetrics ..

func (*Controller) TaskHandlerPullEnvironmentsFromProject

func (c *Controller) TaskHandlerPullEnvironmentsFromProject(ctx context.Context, p schemas.Project)

TaskHandlerPullEnvironmentsFromProject ..

func (*Controller) TaskHandlerPullEnvironmentsFromProjects

func (c *Controller) TaskHandlerPullEnvironmentsFromProjects(ctx context.Context)

TaskHandlerPullEnvironmentsFromProjects ..

func (*Controller) TaskHandlerPullMetrics

func (c *Controller) TaskHandlerPullMetrics(ctx context.Context)

TaskHandlerPullMetrics ..

func (*Controller) TaskHandlerPullProjectsFromWildcard

func (c *Controller) TaskHandlerPullProjectsFromWildcard(ctx context.Context, w config.Wildcard) error

TaskHandlerPullProjectsFromWildcard ..

func (*Controller) TaskHandlerPullProjectsFromWildcards

func (c *Controller) TaskHandlerPullProjectsFromWildcards(ctx context.Context)

TaskHandlerPullProjectsFromWildcards ..

func (*Controller) TaskHandlerPullRefMetrics

func (c *Controller) TaskHandlerPullRefMetrics(ref schemas.Ref)

TaskHandlerPullRefMetrics ..

func (*Controller) TaskHandlerPullRefsFromProject

func (c *Controller) TaskHandlerPullRefsFromProject(ctx context.Context, p schemas.Project)

TaskHandlerPullRefsFromProject ..

func (*Controller) TaskHandlerPullRefsFromProjects

func (c *Controller) TaskHandlerPullRefsFromProjects(ctx context.Context)

TaskHandlerPullRefsFromProjects ..

func (*Controller) UpdateEnvironment

func (c *Controller) UpdateEnvironment(env *schemas.Environment) error

UpdateEnvironment ..

func (*Controller) WebhookHandler

func (c *Controller) WebhookHandler(w http.ResponseWriter, r *http.Request)

WebhookHandler ..

type Registry

type Registry struct {
	*prometheus.Registry

	Collectors RegistryCollectors
}

Registry wraps a pointer of prometheus.Registry

func NewRegistry

func NewRegistry() *Registry

NewRegistry initialize a new registry

func (*Registry) ExportMetrics

func (r *Registry) ExportMetrics(metrics schemas.Metrics)

ExportMetrics ..

func (*Registry) GetCollector

func (r *Registry) GetCollector(kind schemas.MetricKind) prometheus.Collector

GetCollector ..

func (*Registry) RegisterCollectors

func (r *Registry) RegisterCollectors() error

RegisterCollectors add all our metrics to the registry

type RegistryCollectors

type RegistryCollectors map[schemas.MetricKind]prometheus.Collector

RegistryCollectors ..

type TaskController

type TaskController struct {
	Factory taskq.Factory
	Queue   taskq.Queue
	TaskMap *taskq.TaskMap
}

TaskController holds task related clients

func NewTaskController

func NewTaskController(r *redis.Client) (t TaskController)

NewTaskController initializes and returns a new TaskController object

type TaskType

type TaskType string

TaskType represents the type of a task

const (
	// TaskTypePullProjectsFromWildcard ..
	TaskTypePullProjectsFromWildcard TaskType = "PullProjectsFromWildcard"

	// TaskTypePullProjectsFromWildcards ..
	TaskTypePullProjectsFromWildcards TaskType = "PullProjectsFromWildcards"

	// TaskTypePullEnvironmentsFromProject ..
	TaskTypePullEnvironmentsFromProject TaskType = "PullEnvironmentsFromProject"

	// TaskTypePullEnvironmentsFromProjects ..
	TaskTypePullEnvironmentsFromProjects TaskType = "PullEnvironmentsFromProjects"

	// TaskTypePullEnvironmentMetrics ..
	TaskTypePullEnvironmentMetrics TaskType = "PullEnvironmentMetrics"

	// TaskTypePullMetrics ..
	TaskTypePullMetrics TaskType = "PullMetrics"

	// TaskTypePullRefsFromProject ..
	TaskTypePullRefsFromProject TaskType = "PullRefsFromProject"

	// TaskTypePullRefsFromProjects ..
	TaskTypePullRefsFromProjects TaskType = "PullRefsFromProjects"

	// TaskTypePullRefMetrics ..
	TaskTypePullRefMetrics TaskType = "PullRefMetrics"

	// TaskTypeGarbageCollectProjects ..
	TaskTypeGarbageCollectProjects TaskType = "GarbageCollectProjects"

	// TaskTypeGarbageCollectEnvironments ..
	TaskTypeGarbageCollectEnvironments TaskType = "GarbageCollectEnvironments"

	// TaskTypeGarbageCollectRefs ..
	TaskTypeGarbageCollectRefs TaskType = "GarbageCollectRefs"

	// TaskTypeGarbageCollectMetrics ..
	TaskTypeGarbageCollectMetrics TaskType = "GarbageCollectMetrics"
)

Jump to

Keyboard shortcuts

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