controller

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: Apache-2.0 Imports: 26 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

func NewInternalCollectorCurrentlyQueuedTasksCount added in v0.5.1

func NewInternalCollectorCurrentlyQueuedTasksCount() prometheus.Collector

NewInternalCollectorCurrentlyQueuedTasksCount returns a new collector for the gcpe_currently_queued_tasks_count metric

func NewInternalCollectorEnvironmentsCount added in v0.5.1

func NewInternalCollectorEnvironmentsCount() prometheus.Collector

NewInternalCollectorEnvironmentsCount returns a new collector for the gcpe_environments_count metric

func NewInternalCollectorExecutedTasksCount added in v0.5.1

func NewInternalCollectorExecutedTasksCount() prometheus.Collector

NewInternalCollectorExecutedTasksCount returns a new collector for the gcpe_executed_tasks_count metric

func NewInternalCollectorGitLabAPIRequestsCount added in v0.5.1

func NewInternalCollectorGitLabAPIRequestsCount() prometheus.Collector

NewInternalCollectorGitLabAPIRequestsCount returns a new collector for the gcpe_gitlab_api_requests_count metric

func NewInternalCollectorMetricsCount added in v0.5.1

func NewInternalCollectorMetricsCount() prometheus.Collector

NewInternalCollectorMetricsCount returns a new collector for the gcpe_metrics_count metric

func NewInternalCollectorProjectsCount added in v0.5.1

func NewInternalCollectorProjectsCount() prometheus.Collector

NewInternalCollectorProjectsCount returns a new collector for the gcpe_projects_count metric

func NewInternalCollectorRefsCount added in v0.5.1

func NewInternalCollectorRefsCount() prometheus.Collector

NewInternalCollectorRefsCount returns a new collector for the gcpe_refs_count 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 schemas.TaskType, uniqueID string, args ...interface{})

ScheduleTask ..

func (*Controller) ScheduleTaskWithTicker

func (c *Controller) ScheduleTaskWithTicker(ctx context.Context, tt schemas.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, id string, 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

	InternalCollectors struct {
		CurrentlyQueuedTasksCount prometheus.Collector
		EnvironmentsCount         prometheus.Collector
		ExecutedTasksCount        prometheus.Collector
		GitLabAPIRequestsCount    prometheus.Collector
		MetricsCount              prometheus.Collector
		ProjectsCount             prometheus.Collector
		RefsCount                 prometheus.Collector
	}

	Collectors RegistryCollectors
}

Registry wraps a pointer of prometheus.Registry

func NewRegistry

func NewRegistry() *Registry

NewRegistry initialize a new registry

func (*Registry) ExportInternalMetrics added in v0.5.1

func (r *Registry) ExportInternalMetrics(
	g *gitlab.Client,
	s store.Store,
) (err error)

ExportInternalMetrics ..

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

func (*Registry) RegisterInternalCollectors added in v0.5.1

func (r *Registry) RegisterInternalCollectors()

RegisterInternalCollectors declare our internal collectors 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
	TaskSchedulingMonitoring map[schemas.TaskType]*monitor.TaskSchedulingStatus
}

TaskController holds task related clients

func NewTaskController

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

NewTaskController initializes and returns a new TaskController object

Jump to

Keyboard shortcuts

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