Back to godoc.org

Package exporter

v0.0.0 (948130a)
Latest Go to latest
Published: Jul 27, 2020 | License: Apache-2.0 | Module: github.com/mvisonneau/gitlab-ci-pipelines-exporter

Index

Package Files

type Client

type Client struct {
	*gitlab.Client
	Config       *schemas.Config
	RateLimiter  ratelimit.Limiter
	ProjectsRefs ProjectsRefs
	Mutex        sync.Mutex
}

Client holds a GitLab client

func (*Client) OrchestratePolling

func (c *Client) OrchestratePolling(ctx context.Context)

OrchestratePolling ...

type ProjectRef

type ProjectRef struct {
	*schemas.Project

	Kind                        ProjectRefKind
	ID                          int
	PathWithNamespace           string
	Topics                      string
	Ref                         string
	MostRecentPipeline          *gitlab.Pipeline
	MostRecentPipelineVariables string
	Jobs                        map[string]*gitlab.Job
}

ProjectRef is what we will use a metrics entity on which we will perform regular polling operations

func NewProjectRef

func NewProjectRef(project *schemas.Project, gp *gitlab.Project, ref string, kind ProjectRefKind) *ProjectRef

NewProjectRef is an helper which returns a new ProjectRef pointer

type ProjectRefKind

type ProjectRefKind string

ProjectRefKind is used to determine the kind of the ref

const (
	// ProjectRefKindBranch refers to a branch
	ProjectRefKindBranch ProjectRefKind = "branch"

	// ProjectRefKindTag refers to a tag
	ProjectRefKindTag ProjectRefKind = "tag"

	// ProjectRefKindMergeRequest refers to a tag
	ProjectRefKindMergeRequest ProjectRefKind = "merge-request"
)

type ProjectsRefs

type ProjectsRefs map[int]map[string]*ProjectRef

ProjectsRefs allows us to keep track of all the ProjectRef we have configured/discovered

func (ProjectsRefs) Count

func (prs ProjectsRefs) Count() (count int)

Count returns the amount of projects refs in the map

type Registry

type Registry struct {
	*prometheus.Registry
}

Registry wraps a pointer of prometheus.Registry

func NewRegistry

func NewRegistry() *Registry

NewRegistry initialize a new registry

func (*Registry) MetricsHandler

func (r *Registry) MetricsHandler(disableOpenMetricsEncoder bool) http.Handler

MetricsHandler returns an http handler containing with the desired configuration

func (*Registry) RegisterDefaultMetrics

func (r *Registry) RegisterDefaultMetrics() error

RegisterDefaultMetrics add all our metrics to the registry

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier