Documentation ¶
Index ¶
- Constants
- Variables
- func GetConsulId(app string, role string, host string, port int64) string
- func GetLocalIpAddr() (ipaddr string, err error)
- func Init(cluster string, role string, cfg *config.Config)
- func RegisterConsul(addr, app, role, cluster string, port int64)
- func SendRegisterReq(addr string, app string, role string, cluster string, port int64)
- type Alarm
- type ConsulRegisterInfo
- type Counter
- type Gauge
- type TimePoint
- type TimePointCount
Constants ¶
View Source
const ( RegisterPeriod = time.Duration(1) * time.Minute RegisterPath = "/v1/agent/service/register" )
View Source
const ( PromHandlerPattern = "/metrics" // prometheus handler AppName = "cfs" //app name ConfigKeyExporterPort = "exporterPort" //exporter port ConfigKeyConsulAddr = "consulAddr" //consul addr ChSize = 1024 * 10 //collect chan size )
Variables ¶
View Source
var ( AlarmPool = &sync.Pool{New: func() interface{} { return new(Alarm) }} //AlarmGroup sync.Map AlarmCh chan *Alarm )
View Source
var ( CounterGroup sync.Map CounterPool = &sync.Pool{New: func() interface{} { return new(Counter) }} CounterCh chan *Counter )
Functions ¶
func GetConsulId ¶
get consul id
func GetLocalIpAddr ¶
GetLocalIpAddr returns the local IP address.
func RegisterConsul ¶
Types ¶
type ConsulRegisterInfo ¶
*
- consul register info for prometheus
- optional for user when set prometheus exporter
type Counter ¶
type Counter struct {
Gauge
}
func NewCounter ¶
func (*Counter) AddWithLabels ¶
func (*Counter) Metric ¶
func (c *Counter) Metric() prometheus.Counter
type Gauge ¶
type Gauge struct {
// contains filtered or unexported fields
}
func (*Gauge) Metric ¶
func (c *Gauge) Metric() prometheus.Gauge
type TimePointCount ¶
type TimePointCount struct {
// contains filtered or unexported fields
}
func NewTPCnt ¶
func NewTPCnt(name string) (tpc *TimePointCount)
func (*TimePointCount) Set ¶
func (tpc *TimePointCount) Set()
Click to show internal directories.
Click to hide internal directories.