prometheus

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prometheus

type Prometheus struct {
	ModuleName  string       `mapstructure:"module-name" yaml:"module-name" json:"moduleName"`    // 模块名称
	Enabled     bool         `mapstructure:"enabled" yaml:"enabled" json:"enabled"`               // 是否启用Prometheus
	Path        string       `mapstructure:"path" yaml:"path" json:"path"`                        // Prometheus路径
	Port        int          `mapstructure:"port" yaml:"port" json:"port"`                        // Prometheus端口
	Endpoint    string       `mapstructure:"endpoint" yaml:"endpoint" json:"endpoint"`            // Prometheus端点
	PushGateway *PushGateway `mapstructure:"push-gateway" yaml:"push-gateway" json:"pushGateway"` // PushGateway配置
	Scraping    *Scraping    `mapstructure:"scraping" yaml:"scraping" json:"scraping"`            // 抓取配置
}

Prometheus Prometheus配置

func Default

func Default() *Prometheus

Default 创建默认Prometheus配置

func (*Prometheus) Clone

func (p *Prometheus) Clone() internal.Configurable

Clone 返回配置的副本

func (*Prometheus) Disable

func (p *Prometheus) Disable() *Prometheus

Disable 禁用Prometheus

func (*Prometheus) Enable

func (p *Prometheus) Enable() *Prometheus

Enable 启用Prometheus

func (*Prometheus) EnablePushGateway

func (p *Prometheus) EnablePushGateway() *Prometheus

EnablePushGateway 启用PushGateway

func (*Prometheus) Get

func (p *Prometheus) Get() interface{}

Get 返回配置接口

func (*Prometheus) IsEnabled

func (p *Prometheus) IsEnabled() bool

IsEnabled 检查是否启用

func (*Prometheus) Set

func (p *Prometheus) Set(data interface{})

Set 设置配置数据

func (*Prometheus) Validate

func (p *Prometheus) Validate() error

Validate 验证配置

func (*Prometheus) WithEnabled

func (p *Prometheus) WithEnabled(enabled bool) *Prometheus

WithEnabled 设置是否启用

func (*Prometheus) WithEndpoint

func (p *Prometheus) WithEndpoint(endpoint string) *Prometheus

WithEndpoint 设置端点

func (*Prometheus) WithModuleName

func (p *Prometheus) WithModuleName(moduleName string) *Prometheus

WithModuleName 设置模块名称

func (*Prometheus) WithPath

func (p *Prometheus) WithPath(path string) *Prometheus

WithPath 设置路径

func (*Prometheus) WithPort

func (p *Prometheus) WithPort(port int) *Prometheus

WithPort 设置端口

func (*Prometheus) WithPushGateway

func (p *Prometheus) WithPushGateway(enabled bool, endpoint, jobName string) *Prometheus

WithPushGateway 设置PushGateway配置

func (*Prometheus) WithScraping

func (p *Prometheus) WithScraping(interval, timeout, metricsPath string) *Prometheus

WithScraping 设置抓取配置

type PushGateway

type PushGateway struct {
	Enabled  bool   `mapstructure:"enabled" yaml:"enabled" json:"enabled"`    // 是否启用PushGateway
	Endpoint string `mapstructure:"endpoint" yaml:"endpoint" json:"endpoint"` // PushGateway端点
	JobName  string `mapstructure:"job-name" yaml:"job-name" json:"jobName"`  // Job名称
}

PushGateway PushGateway配置

type Scraping

type Scraping struct {
	Interval    string `mapstructure:"interval" yaml:"interval" json:"interval"`            // 抓取间隔
	Timeout     string `mapstructure:"timeout" yaml:"timeout" json:"timeout"`               // 超时时间
	MetricsPath string `mapstructure:"metrics-path" yaml:"metrics-path" json:"metricsPath"` // 指标路径
}

Scraping 抓取配置

Jump to

Keyboard shortcuts

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