controller

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 40 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 NewCollectorJobStartTime

func NewCollectorJobStartTime() prometheus.Collector

NewCollectorJobStartTime returns a new collector for the gitlab_ci_pipeline_job_start_time 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 NewCollectorStartTime

func NewCollectorStartTime() prometheus.Collector

NewCollectorStartTime returns a new collector for the gitlab_ci_pipeline_start_time metric.

func NewCollectorStatus

func NewCollectorStatus() prometheus.Collector

NewCollectorStatus returns a new collector for the gitlab_ci_pipeline_status metric.

func NewCollectorTestReportErrorCount

func NewCollectorTestReportErrorCount() prometheus.Collector

NewCollectorTestReportErrorCount returns a new collector for the gitlab_ci_pipeline_test_report_error_count metric.

func NewCollectorTestReportFailedCount

func NewCollectorTestReportFailedCount() prometheus.Collector

NewCollectorTestReportFailedCount returns a new collector for the gitlab_ci_pipeline_test_report_failed_count metric.

func NewCollectorTestReportSkippedCount

func NewCollectorTestReportSkippedCount() prometheus.Collector

NewCollectorTestReportSkippedCount returns a new collector for the gitlab_ci_pipeline_test_report_skipped_count metric.

func NewCollectorTestReportSuccessCount

func NewCollectorTestReportSuccessCount() prometheus.Collector

NewCollectorTestReportSuccessCount returns a new collector for the gitlab_ci_pipeline_test_report_success_count metric.

func NewCollectorTestReportTotalCount

func NewCollectorTestReportTotalCount() prometheus.Collector

NewCollectorTestReportTotalCount returns a new collector for the gitlab_ci_pipeline_test_report_total_count metric.

func NewCollectorTestReportTotalTime

func NewCollectorTestReportTotalTime() prometheus.Collector

NewCollectorTestReportTotalTime returns a new collector for the gitlab_ci_pipeline_test_report_total_time metric.

func NewCollectorTestSuiteErrorCount

func NewCollectorTestSuiteErrorCount() prometheus.Collector

NewCollectorTestSuiteErrorCount returns a new collector for the gitlab_ci_pipeline_test_suite_error_count metric.

func NewCollectorTestSuiteFailedCount

func NewCollectorTestSuiteFailedCount() prometheus.Collector

NewCollectorTestSuiteFailedCount returns a new collector for the gitlab_ci_pipeline_test_suite_failed_count metric.

func NewCollectorTestSuiteSkippedCount

func NewCollectorTestSuiteSkippedCount() prometheus.Collector

NewCollectorTestSuiteSkippedCount returns a new collector for the gitlab_ci_pipeline_test_suite_skipped_count metric.

func NewCollectorTestSuiteSuccessCount

func NewCollectorTestSuiteSuccessCount() prometheus.Collector

NewCollectorTestSuiteSuccessCount returns a new collector for the gitlab_ci_pipeline_test_suite_success_count metric.

func NewCollectorTestSuiteTotalCount

func NewCollectorTestSuiteTotalCount() prometheus.Collector

NewCollectorTestSuiteTotalCount returns a new collector for the gitlab_ci_pipeline_test_suite_total_count metric.

func NewCollectorTestSuiteTotalTime

func NewCollectorTestSuiteTotalTime() prometheus.Collector

NewCollectorTestSuiteTotalTime returns a new collector for the gitlab_ci_pipeline_test_suite_total_time metric.

func NewCollectorTimestamp

func NewCollectorTimestamp() prometheus.Collector

NewCollectorTimestamp returns a new collector for the gitlab_ci_pipeline_timestamp metric.

func NewInternalCollectorCurrentlyQueuedTasksCount

func NewInternalCollectorCurrentlyQueuedTasksCount() prometheus.Collector

NewInternalCollectorCurrentlyQueuedTasksCount returns a new collector for the gcpe_currently_queued_tasks_count metric.

func NewInternalCollectorEnvironmentsCount

func NewInternalCollectorEnvironmentsCount() prometheus.Collector

NewInternalCollectorEnvironmentsCount returns a new collector for the gcpe_environments_count metric.

func NewInternalCollectorExecutedTasksCount

func NewInternalCollectorExecutedTasksCount() prometheus.Collector

NewInternalCollectorExecutedTasksCount returns a new collector for the gcpe_executed_tasks_count metric.

func NewInternalCollectorGitLabAPIRequestsCount

func NewInternalCollectorGitLabAPIRequestsCount() prometheus.Collector

NewInternalCollectorGitLabAPIRequestsCount returns a new collector for the gcpe_gitlab_api_requests_count metric.

func NewInternalCollectorGitLabAPIRequestsLimit

func NewInternalCollectorGitLabAPIRequestsLimit() prometheus.Collector

NewInternalCollectorGitLabAPIRequestsLimit returns a new collector for the gcpe_gitlab_api_requests_limit metric.

func NewInternalCollectorGitLabAPIRequestsRemaining

func NewInternalCollectorGitLabAPIRequestsRemaining() prometheus.Collector

NewInternalCollectorGitLabAPIRequestsRemaining returns a new collector for the gcpe_gitlab_api_requests_remaining metric.

func NewInternalCollectorMetricsCount

func NewInternalCollectorMetricsCount() prometheus.Collector

NewInternalCollectorMetricsCount returns a new collector for the gcpe_metrics_count metric.

func NewInternalCollectorProjectsCount

func NewInternalCollectorProjectsCount() prometheus.Collector

NewInternalCollectorProjectsCount returns a new collector for the gcpe_projects_count metric.

func NewInternalCollectorRefsCount

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

	// UUID is used to identify this controller/process amongst others when
	// the exporter is running in cluster mode, leveraging Redis.
	UUID uuid.UUID
}

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

GarbageCollectEnvironments ..

func (*Controller) GarbageCollectMetrics

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

GarbageCollectMetrics ..

func (*Controller) GarbageCollectProjects

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

GarbageCollectProjects ..

func (*Controller) GarbageCollectRefs

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

GarbageCollectRefs ..

func (*Controller) GetRefs

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

GetRefs ..

func (*Controller) HealthCheckHandler

func (c *Controller) HealthCheckHandler(ctx context.Context) (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(ctx context.Context, ref schemas.Ref, job schemas.Job)

ProcessJobMetrics ..

func (*Controller) ProcessTestReportMetrics

func (c *Controller) ProcessTestReportMetrics(ctx context.Context, ref schemas.Ref, tr schemas.TestReport)

ProcessTestReportMetrics ..

func (*Controller) ProcessTestSuiteMetrics

func (c *Controller) ProcessTestSuiteMetrics(ctx context.Context, ref schemas.Ref, ts schemas.TestSuite)

ProcessTestSuiteMetrics ..

func (*Controller) PullEnvironmentMetrics

func (c *Controller) PullEnvironmentMetrics(ctx context.Context, 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(ctx context.Context, ref schemas.Ref) error

PullRefMetrics ..

func (*Controller) PullRefMostRecentJobsMetrics

func (c *Controller) PullRefMostRecentJobsMetrics(ctx context.Context, ref schemas.Ref) error

PullRefMostRecentJobsMetrics ..

func (*Controller) PullRefPipelineJobsMetrics

func (c *Controller) PullRefPipelineJobsMetrics(ctx context.Context, ref schemas.Ref) error

PullRefPipelineJobsMetrics ..

func (*Controller) PullRefsFromProject

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

PullRefsFromProject ..

func (*Controller) RemoveWebhooks added in v1.0.17

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

func (*Controller) Schedule

Schedule ..

func (*Controller) ScheduleRedisSetKeepalive

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

ScheduleRedisSetKeepalive will ensure that whilst the process is running, a key is periodically updated within Redis to let other instances know this one is alive and processing tasks.

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) TaskHandlerAddWebhooks

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

TaskHandlerAddWebhooks ..

func (*Controller) TaskHandlerConfigUpdate

func (c *Controller) TaskHandlerConfigUpdate(ctx context.Context) (err error)

TaskHandlerConfigUpdate ..

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(ctx context.Context, 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(ctx context.Context, 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(ctx context.Context, 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
		GitlabAPIRequestsRemaining prometheus.Collector
		GitlabAPIRequestsLimit     prometheus.Collector
		MetricsCount               prometheus.Collector
		ProjectsCount              prometheus.Collector
		RefsCount                  prometheus.Collector
	}

	Collectors RegistryCollectors
}

Registry wraps a pointer of prometheus.Registry.

func NewRegistry

func NewRegistry(ctx context.Context) *Registry

NewRegistry initialize a new registry.

func (*Registry) ExportInternalMetrics

func (r *Registry) ExportInternalMetrics(
	ctx context.Context,
	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

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(ctx context.Context, r *redis.Client, maximumJobsQueueSize int) (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