exporter

package
v0.0.0-...-e417875 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const JobServiceCollectorName = "JobServiceCollector"

JobServiceCollectorName ...

View Source
const ProjectCollectorName = "ProjectCollector"

ProjectCollectorName ...

View Source
const StatisticsCollectorName = "StatisticsCollector"

Variables

This section is empty.

Functions

func CacheDelete

func CacheDelete(key string)

CacheDelete delete a key from cache

func CacheEnabled

func CacheEnabled() bool

CacheEnabled returns if the cache in exporter enabled

func CacheGet

func CacheGet(key string) (value interface{}, ok bool)

CacheGet get a value from cache

func CacheInit

func CacheInit(opt *Opt)

CacheInit add cache to exporter

func CachePut

func CachePut(key, value interface{})

CachePut put a value to cache with key

func GetBackendWorker

func GetBackendWorker() *work.Client

GetBackendWorker ...

func GetRedisPool

func GetRedisPool() *redis.Pool

GetRedisPool ...

func InitBackendWorker

func InitBackendWorker(redisPoolConfig *RedisPoolConfig)

InitBackendWorker initiate backend worker

func InitHarborClient

func InitHarborClient(hc *HarborClient)

InitHarborClient initialize the harbor client

func StartCacheCleaner

func StartCacheCleaner()

StartCacheCleaner start a cache clean job

Types

type Exporter

type Exporter struct {
	*http.Server
	Opt *Opt
	// contains filtered or unexported fields
}

Exporter is struct for Harbor which can used to connection Harbor and collecting data

func NewExporter

func NewExporter(opt *Opt) *Exporter

NewExporter creates a exporter for Harbor with the configuration

func (*Exporter) Collect

func (e *Exporter) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (*Exporter) Describe

func (e *Exporter) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*Exporter) RegisterCollector

func (e *Exporter) RegisterCollector(collectors ...collector) error

RegisterCollector register a collector to expoter

type HarborClient

type HarborClient struct {
	HarborScheme string
	HarborHost   string
	HarborPort   int
	*http.Client
}

HarborClient is client for request harbor

func (HarborClient) Get

func (hc HarborClient) Get(p string) (*http.Response, error)

Get ...

type HealthCollector

type HealthCollector struct {
	*HarborClient
}

HealthCollector is the Heartbeat

func NewHealthCollect

func NewHealthCollect(cli *HarborClient) *HealthCollector

NewHealthCollect ...

func (*HealthCollector) Collect

func (hc *HealthCollector) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (*HealthCollector) Describe

func (hc *HealthCollector) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*HealthCollector) GetName

func (hc *HealthCollector) GetName() string

GetName returns the name of the health collector

type JobServiceCollector

type JobServiceCollector struct {
	Namespace string
}

JobServiceCollector ...

func NewJobServiceCollector

func NewJobServiceCollector() *JobServiceCollector

NewJobServiceCollector ...

func (*JobServiceCollector) Collect

func (hc *JobServiceCollector) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (*JobServiceCollector) Describe

func (hc *JobServiceCollector) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*JobServiceCollector) GetName

func (hc *JobServiceCollector) GetName() string

GetName returns the name of the job service collector

type Opt

type Opt struct {
	Port                   int
	MetricsPath            string
	ExporterMetricsEnabled bool
	MaxRequests            int
	TLSEnabled             bool
	Certificate            string
	Key                    string
	CacheDuration          int64
	CacheCleanInterval     int64
}

Opt is the config of Harbor exporter

type ProjectCollector

type ProjectCollector struct{}

ProjectCollector ...

func NewProjectCollector

func NewProjectCollector() *ProjectCollector

NewProjectCollector ...

func (*ProjectCollector) Collect

func (hc *ProjectCollector) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (*ProjectCollector) Describe

func (hc *ProjectCollector) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*ProjectCollector) GetName

func (hc *ProjectCollector) GetName() string

GetName returns the name of the project info collector

type RedisPoolConfig

type RedisPoolConfig struct {
	URL               string
	Namespace         string
	IdleTimeoutSecond int
}

RedisPoolConfig ...

type StatisticsCollector

type StatisticsCollector struct {
	// contains filtered or unexported fields
}

func NewStatisticsCollector

func NewStatisticsCollector() *StatisticsCollector

func (StatisticsCollector) Collect

func (g StatisticsCollector) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (StatisticsCollector) Describe

func (g StatisticsCollector) Describe(c chan<- *prometheus.Desc)

func (StatisticsCollector) GetName

func (g StatisticsCollector) GetName() string

type SystemInfoCollector

type SystemInfoCollector struct {
	*HarborClient
}

SystemInfoCollector ...

func NewSystemInfoCollector

func NewSystemInfoCollector(hbrCli *HarborClient) *SystemInfoCollector

NewSystemInfoCollector ...

func (*SystemInfoCollector) Collect

func (hc *SystemInfoCollector) Collect(c chan<- prometheus.Metric)

Collect implements prometheus.Collector

func (*SystemInfoCollector) Describe

func (hc *SystemInfoCollector) Describe(c chan<- *prometheus.Desc)

Describe implements prometheus.Collector

func (*SystemInfoCollector) GetName

func (hc *SystemInfoCollector) GetName() string

GetName returns the name of the system info collector

Jump to

Keyboard shortcuts

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