本文整理汇总了Golang中github.com/prometheus/client_golang/prometheus.NewCounterVec函数的典型用法代码示例。如果您正苦于以下问题:Golang NewCounterVec函数的具体用法?Golang NewCounterVec怎么用?Golang NewCounterVec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewCounterVec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewEventHandler
func NewEventHandler(cf Config) (events.Handler, error) {
h := &handler{listenAddr: cf.ListenAddr, errorSink: cf.ErrorSink}
h.connections = prom.NewCounterVec(prom.CounterOpts{
Name: "flux_connections_total",
Help: "Number of TCP connections established",
}, []string{"individual", "group", "src", "dst", "protocol"})
httpLabels := []string{"individual", "group", "src", "dst", "method", "code"}
h.http = prom.NewCounterVec(prom.CounterOpts{
Name: "flux_http_total",
Help: "Number of HTTP request/response exchanges",
}, httpLabels)
h.httpRoundtrip = prom.NewSummaryVec(prom.SummaryOpts{
Name: "flux_http_roundtrip_usec",
Help: "HTTP response roundtrip time in microseconds",
}, httpLabels)
h.httpTotal = prom.NewSummaryVec(prom.SummaryOpts{
Name: "flux_http_total_usec",
Help: "HTTP total response time in microseconds",
}, httpLabels)
if cf.AdvertiseAddr != "" {
var err error
if h.advertiser, err = newAdvertiser(cf); err != nil {
return nil, err
}
}
return h, nil
}
开发者ID:errordeveloper,项目名称:flux,代码行数:34,代码来源:eventhandler.go
示例2: NewExporter
// NewExporter returns an initialized exporter
func NewExporter(server string) *Exporter {
return &Exporter{
mc: memcache.New(server),
up: prometheus.NewGauge(
prometheus.GaugeOpts{
Name: "up",
Namespace: namespace,
Help: "Are the servers up.",
ConstLabels: prometheus.Labels{"server": server},
},
),
uptime: prometheus.NewCounter(
prometheus.CounterOpts{
Name: "uptime",
Namespace: namespace,
Help: "The uptime of the server.",
ConstLabels: prometheus.Labels{"server": server},
},
),
cache: prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "cache",
Namespace: namespace,
Help: "The cache hits/misses broken down by command (get, set, etc.).",
ConstLabels: prometheus.Labels{"server": server},
},
[]string{"command", "status"},
),
usage: prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "usage",
Namespace: namespace,
Help: "Details the resource usage (items/connections) of the server, by time (current/total).",
ConstLabels: prometheus.Labels{"server": server},
},
[]string{"time", "resource"},
),
bytes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "bytes",
Namespace: namespace,
Help: "The bytes sent/received by the server.",
ConstLabels: prometheus.Labels{"server": server},
},
[]string{"direction"},
),
removals: prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "removal",
Namespace: namespace,
Help: "Number of items that have been evicted/expired (status), and if the were fetched ever or not.",
ConstLabels: prometheus.Labels{"server": server},
},
[]string{"status", "fetched"},
),
}
}
开发者ID:sciffer,项目名称:memcache_exporter,代码行数:58,代码来源:main.go
示例3: New
// New constructs a neww Notifier.
func New(o *Options) *Notifier {
ctx, cancel := context.WithCancel(context.Background())
return &Notifier{
queue: make(model.Alerts, 0, o.QueueCapacity),
ctx: ctx,
cancel: cancel,
more: make(chan struct{}, 1),
opts: o,
latency: prometheus.NewSummaryVec(prometheus.SummaryOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "latency_seconds",
Help: "Latency quantiles for sending alert notifications (not including dropped notifications).",
},
[]string{alertmanagerLabel},
),
errors: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "errors_total",
Help: "Total number of errors sending alert notifications.",
},
[]string{alertmanagerLabel},
),
sent: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "sent_total",
Help: "Total number of alerts successfully sent.",
},
[]string{alertmanagerLabel},
),
dropped: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "dropped_total",
Help: "Total number of alerts dropped due to alert manager missing in configuration.",
}),
queueLength: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: subsystem,
Name: "queue_length",
Help: "The number of alert notifications in the queue.",
}),
queueCapacity: prometheus.MustNewConstMetric(
prometheus.NewDesc(
prometheus.BuildFQName(namespace, subsystem, "queue_capacity"),
"The capacity of the alert notifications queue.",
nil, nil,
),
prometheus.GaugeValue,
float64(o.QueueCapacity),
),
}
}
开发者ID:RichiH,项目名称:prometheus,代码行数:58,代码来源:notifier.go
示例4: initPrometheusMetrics
func initPrometheusMetrics() {
TotalClientCounter = stat.NewGauge(stat.GaugeOpts{
Name: "total_clients",
Help: "Total number of connected clients",
})
TotalNodes = stat.NewGauge(stat.GaugeOpts{
Name: "meshnodes_total",
Help: "Total number of Nodes",
})
TotalNodeTrafficRx = stat.NewCounter(stat.CounterOpts{
Name: "total_traffic_rx",
Help: "Total accumulated received traffic as reported by Nodes",
})
TotalNodeTrafficTx = stat.NewCounter(stat.CounterOpts{
Name: "total_traffic_tx",
Help: "Total accumulated transmitted traffic as reported by Nodes",
})
TotalNodeMgmtTrafficRx = stat.NewCounter(stat.CounterOpts{
Name: "total_traffic_mgmt_rx",
Help: "Total accumulated received management traffic as reported by Nodes",
})
TotalNodeMgmtTrafficTx = stat.NewCounter(stat.CounterOpts{
Name: "total_traffic_mgmt_tx",
Help: "Total accumulated transmitted management traffic as reported by Nodes",
})
OnlineNodes = stat.NewGauge(stat.GaugeOpts{
Name: "meshnodes_online_total",
Help: "All online nodes",
})
NodesTrafficRx = stat.NewCounterVec(stat.CounterOpts{
Name: "meshnode_traffic_rx",
Help: "Transmitted traffic from nodes",
}, append(nodeLabels, "type"))
NodesTrafficTx = stat.NewCounterVec(stat.CounterOpts{
Name: "meshnode_traffic_tx",
Help: "Received traffic on nodes",
}, append(nodeLabels, "type"))
NodesUptime = stat.NewCounterVec(stat.CounterOpts{
Name: "meshnode_uptime",
Help: "Uptime of meshnodes",
}, nodeLabels)
NodesClients = stat.NewGaugeVec(stat.GaugeOpts{
Name: "meshnode_clients",
Help: "Clients on single meshnodes",
}, nodeLabels)
}
开发者ID:tantive,项目名称:node-informant,代码行数:56,代码来源:prometheus.go
示例5: NewDevstatCollector
// Takes a prometheus registry and returns a new Collector exposing
// Device stats.
func NewDevstatCollector() (Collector, error) {
return &devstatCollector{
bytes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: devstatSubsystem,
Name: "bytes_total",
Help: "The total number of bytes in transactions.",
},
[]string{"device", "type"},
),
transfers: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: devstatSubsystem,
Name: "transfers_total",
Help: "The total number of transactions.",
},
[]string{"device", "type"},
),
duration: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: devstatSubsystem,
Name: "duration_seconds_total",
Help: "The total duration of transactions in seconds.",
},
[]string{"device", "type"},
),
busyTime: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: devstatSubsystem,
Name: "busy_time_seconds_total",
Help: "Total time the device had one or more transactions outstanding in seconds.",
},
[]string{"device"},
),
blocks: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: devstatSubsystem,
Name: "blocks_transferred_total",
Help: "The total number of blocks transferred.",
},
[]string{"device"},
),
}, nil
}
开发者ID:juergenhoetzel,项目名称:node_exporter,代码行数:51,代码来源:devstat_freebsd.go
示例6: init
func init() {
prometheus.MustRegister(memAllocBytesGauge)
prometheus.MustRegister(availFSGauge)
prometheus.MustRegister(&cpuTimeMetric{prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: "process",
Name: "cpu_nsec",
Help: "CPU time spent in ns, split by user/system.",
},
[]string{"mode"},
)})
prometheus.MustRegister(&diskStatsMetric{
reads: prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: "system",
Name: "disk_reads",
Help: "Disk reads, per device name (e.g. xvda).",
},
[]string{"device"},
),
writes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: "system",
Name: "disk_writes",
Help: "Disk writes, per device name (e.g. xvda).",
},
[]string{"device"},
),
readbytes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: "system",
Name: "disk_read_bytes",
Help: "Bytes read from disk, per device name (e.g. xvda).",
},
[]string{"device"},
),
writtenbytes: prometheus.NewCounterVec(
prometheus.CounterOpts{
Subsystem: "system",
Name: "disk_written_bytes",
Help: "Bytes written to disk, per device name (e.g. xvda).",
},
[]string{"device"},
),
})
}
开发者ID:jamessan,项目名称:dcs,代码行数:48,代码来源:varz.go
示例7: NewExporter
// NewExporter returns a new MySQL exporter for the provided DSN.
func NewExporter(dsn string) *Exporter {
return &Exporter{
dsn: dsn,
duration: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: exporter,
Name: "last_scrape_duration_seconds",
Help: "Duration of the last scrape of metrics from MySQL.",
}),
totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: exporter,
Name: "scrapes_total",
Help: "Total number of times MySQL was scraped for metrics.",
}),
scrapeErrors: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: exporter,
Name: "scrape_errors_total",
Help: "Total number of times an error occurred scraping a MySQL.",
}, []string{"collector"}),
error: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Subsystem: exporter,
Name: "last_scrape_error",
Help: "Whether the last scrape of metrics from MySQL resulted in an error (1 for error, 0 for success).",
}),
mysqldUp: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "up",
Help: "Whether the MySQL server is up.",
}),
}
}
开发者ID:roman-vynar,项目名称:mysqld_exporter,代码行数:35,代码来源:mysqld_exporter.go
示例8: NewMiddleware
// NewMiddleware returns a new prometheus Middleware handler.
func NewMiddleware(name string, buckets ...float64) *Middleware {
var m Middleware
m.reqs = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: reqsName,
Help: "How many HTTP requests processed, partitioned by status code, method and HTTP path.",
ConstLabels: prometheus.Labels{"service": name},
},
[]string{"code", "method", "path"},
)
prometheus.MustRegister(m.reqs)
if len(buckets) == 0 {
buckets = dflBuckets
}
m.latency = prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: latencyName,
Help: "How long it took to process the request, partitioned by status code, method and HTTP path.",
ConstLabels: prometheus.Labels{"service": name},
Buckets: buckets,
},
[]string{"code", "method", "path"},
)
prometheus.MustRegister(m.latency)
return &m
}
开发者ID:zbindenren,项目名称:negroni-prometheus,代码行数:27,代码来源:middleware.go
示例9: New
// Creates and returns a new Manager.
func New() *Manager {
refreshChannel := make(chan string, 10)
quitChannel := make(chan int)
refreshCounter := prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "proxym",
Subsystem: "refresh",
Name: "count",
Help: "Number of refreshes triggered",
}, []string{"result"})
prometheus.MustRegister(refreshCounter)
var c Config
envconfig.Process("proxym", &c)
m := &Manager{
Config: &c,
httpRouter: pat.New(),
refresh: refreshChannel,
refreshCounter: refreshCounter,
quit: quitChannel,
}
m.httpRouter.Get("/metrics", prometheus.Handler())
return m
}
开发者ID:nickwales,项目名称:proxym,代码行数:28,代码来源:manager.go
示例10: NewExporter
// NewExporter returns an initialized Exporter.
func NewExporter(uri string) *Exporter {
return &Exporter{
URI: uri,
scrapeFailures: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "exporter_scrape_failures_total",
Help: "Number of errors while scraping nginx.",
}),
processedConnections: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Name: "connections_processed_total",
Help: "Number of connections processed by nginx",
},
[]string{"stage"},
),
currentConnections: prometheus.NewGaugeVec(prometheus.GaugeOpts{
Namespace: namespace,
Name: "connections_current",
Help: "Number of connections currently processed by nginx",
},
[]string{"state"},
),
client: &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: *insecure},
},
},
}
}
开发者ID:life360,项目名称:nginx_exporter,代码行数:30,代码来源:nginx_exporter.go
示例11: TestToReader
func TestToReader(t *testing.T) {
cntVec := prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "name",
Help: "docstring",
ConstLabels: prometheus.Labels{"constname": "constvalue"},
},
[]string{"labelname"},
)
cntVec.WithLabelValues("val1").Inc()
cntVec.WithLabelValues("val2").Inc()
reg := prometheus.NewRegistry()
reg.MustRegister(cntVec)
want := `prefix.name.constname.constvalue.labelname.val1 1 1477043
prefix.name.constname.constvalue.labelname.val2 1 1477043
`
mfs, err := reg.Gather()
if err != nil {
t.Fatalf("error: %v", err)
}
now := model.Time(1477043083)
var buf bytes.Buffer
err = writeMetrics(&buf, mfs, "prefix", now)
if err != nil {
t.Fatalf("error: %v", err)
}
if got := buf.String(); want != got {
t.Fatalf("wanted \n%s\n, got \n%s\n", want, got)
}
}
开发者ID:prometheus,项目名称:client_golang,代码行数:34,代码来源:bridge_test.go
示例12: ExampleCounterVec
func ExampleCounterVec() {
binaryVersion := flag.String("environment", "test", "Execution environment: test, staging, production.")
flag.Parse()
httpReqs := prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "http_requests_total",
Help: "How many HTTP requests processed, partitioned by status code and HTTP method.",
ConstLabels: prometheus.Labels{"env": *binaryVersion},
},
[]string{"code", "method"},
)
prometheus.MustRegister(httpReqs)
httpReqs.WithLabelValues("404", "POST").Add(42)
// If you have to access the same set of labels very frequently, it
// might be good to retrieve the metric only once and keep a handle to
// it. But beware of deletion of that metric, see below!
m := httpReqs.WithLabelValues("200", "GET")
for i := 0; i < 1000000; i++ {
m.Inc()
}
// Delete a metric from the vector. If you have previously kept a handle
// to that metric (as above), future updates via that handle will go
// unseen (even if you re-create a metric with the same label set
// later).
httpReqs.DeleteLabelValues("200", "GET")
// Same thing with the more verbose Labels syntax.
httpReqs.Delete(prometheus.Labels{"method": "GET", "code": "200"})
}
开发者ID:eghobo,项目名称:kubedash,代码行数:31,代码来源:examples_test.go
示例13: newMesosExporter
func newMesosExporter(opts *exporterOpts) *periodicExporter {
e := &periodicExporter{
errors: prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: "mesos_exporter",
Name: "slave_scrape_errors_total",
Help: "Current total scrape errors",
},
[]string{"slave"},
),
opts: opts,
}
e.slaves.urls = []string{e.opts.localURL}
if e.opts.autoDiscover {
log.Info("auto discovery enabled from command line flag.")
// Update nr. of mesos slaves every 10 minutes
e.updateSlaves()
go runEvery(e.updateSlaves, 10*time.Minute)
}
// Fetch slave metrics every interval
go runEvery(e.scrapeSlaves, e.opts.interval)
return e
}
开发者ID:ekesken,项目名称:mesos_exporter,代码行数:27,代码来源:main.go
示例14: Update
func (c *netDevCollector) Update(ch chan<- prometheus.Metric) (err error) {
netDev, err := getNetDevStats()
if err != nil {
return fmt.Errorf("couldn't get netstats: %s", err)
}
for direction, devStats := range netDev {
for dev, stats := range devStats {
for t, value := range stats {
key := direction + "_" + t
if _, ok := c.metrics[key]; !ok {
c.metrics[key] = prometheus.NewCounterVec(
prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: netDevSubsystem,
Name: key,
Help: fmt.Sprintf("%s %s from getifaddrs().", t, direction),
},
[]string{"device"},
)
}
v, err := strconv.ParseFloat(value, 64)
if err != nil {
return fmt.Errorf("invalid value %s in netstats: %s", value, err)
}
c.metrics[key].WithLabelValues(dev).Set(v)
}
}
}
for _, m := range c.metrics {
m.Collect(ch)
}
return err
}
开发者ID:robbiet480,项目名称:node_exporter,代码行数:33,代码来源:netdev_freebsd.go
示例15: TestPush
func TestPush(t *testing.T) {
reg := prometheus.NewRegistry()
cntVec := prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "name",
Help: "docstring",
ConstLabels: prometheus.Labels{"constname": "constvalue"},
},
[]string{"labelname"},
)
cntVec.WithLabelValues("val1").Inc()
cntVec.WithLabelValues("val2").Inc()
reg.MustRegister(cntVec)
host := "localhost"
port := ":56789"
b, err := NewBridge(&Config{
URL: host + port,
Gatherer: reg,
Prefix: "prefix",
})
if err != nil {
t.Fatalf("error creating bridge: %v", err)
}
nmg, err := newMockGraphite(port)
if err != nil {
t.Fatalf("error creating mock graphite: %v", err)
}
defer nmg.Close()
err = b.Push()
if err != nil {
t.Fatalf("error pushing: %v", err)
}
wants := []string{
"prefix.name.constname.constvalue.labelname.val1 1",
"prefix.name.constname.constvalue.labelname.val2 1",
}
select {
case got := <-nmg.readc:
for _, want := range wants {
matched, err := regexp.MatchString(want, got)
if err != nil {
t.Fatalf("error pushing: %v", err)
}
if !matched {
t.Fatalf("missing metric:\nno match for %s received by server:\n%s", want, got)
}
}
return
case err := <-nmg.errc:
t.Fatalf("error reading push: %v", err)
case <-time.After(50 * time.Millisecond):
t.Fatalf("no result from graphite server")
}
}
开发者ID:prometheus,项目名称:client_golang,代码行数:59,代码来源:bridge_test.go
示例16: counter
func counter(subsystem, name, help string, labels ...string) *prometheus.CounterVec {
return prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: "mesos",
Subsystem: subsystem,
Name: name,
Help: help,
}, labels)
}
开发者ID:yuyulei,项目名称:mesos_exporter,代码行数:8,代码来源:common.go
示例17: main
func main() {
cfg, err := New()
if err != nil {
log.Fatalf("Failed to parse config: %s", err)
return
}
runs := prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "elasticsearch_backup_runs_total",
Help: "Number of elasticsearch backup runs",
},
[]string{"status"},
)
runs = prometheus.MustRegisterOrGet(runs).(*prometheus.CounterVec)
duration := prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "elasticsearch_backup_duration",
Help: "Duration of elasticsearch backup runs",
},
[]string{"operation"},
)
duration = prometheus.MustRegisterOrGet(duration).(*prometheus.SummaryVec)
go listen()
interval := time.Hour * time.Duration(cfg.Interval)
for {
t0 := time.Now()
opFunc := func() error {
return backupAndRemove(cfg)
}
logFunc := func(err error, wait time.Duration) {
log.Warnf("Failed to connect to ES: %s. Retry in %s", err, wait)
}
bo := backoff.NewExponentialBackOff()
bo.InitialInterval = time.Second
bo.MaxInterval = 60 * time.Second
bo.MaxElapsedTime = 15 * time.Minute
log.Infof("Attempting Snapshot ...")
err := backoff.RetryNotify(opFunc, bo, logFunc)
if err != nil {
runs.WithLabelValues("failed").Inc()
log.Warnf("Failed to delete snapshots: %s", err)
continue
}
runs.WithLabelValues("ok").Inc()
d0 := float64(time.Since(t0)) / float64(time.Microsecond)
duration.WithLabelValues("backup").Observe(d0)
if interval < time.Second {
break
}
log.Infof("Waiting %s until next run", interval.String())
time.Sleep(interval)
}
os.Exit(0)
}
开发者ID:dominikschulz,项目名称:es-backup,代码行数:58,代码来源:main.go
示例18: NewFilesystemCollector
// Takes a prometheus registry and returns a new Collector exposing
// Filesystems stats.
func NewFilesystemCollector() (Collector, error) {
subsystem := "filesystem"
mountPointPattern := regexp.MustCompile(*ignoredMountPoints)
filesystemsTypesPattern := regexp.MustCompile(*ignoredFSTypes)
sizeDesc := prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "size"),
"Filesystem size in bytes.",
filesystemLabelNames, nil,
)
freeDesc := prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "free"),
"Filesystem free space in bytes.",
filesystemLabelNames, nil,
)
availDesc := prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "avail"),
"Filesystem space available to non-root users in bytes.",
filesystemLabelNames, nil,
)
filesDesc := prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "files"),
"Filesystem total file nodes.",
filesystemLabelNames, nil,
)
filesFreeDesc := prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "files_free"),
"Filesystem total free file nodes.",
filesystemLabelNames, nil,
)
roDesc := prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "readonly"),
"Filesystem read-only status.",
filesystemLabelNames, nil,
)
devErrors := prometheus.NewCounterVec(prometheus.CounterOpts{
Name: prometheus.BuildFQName(Namespace, subsystem, "device_errors_total"),
Help: "Total number of errors occurred when getting stats for device",
}, filesystemLabelNames)
return &filesystemCollector{
ignoredMountPointsPattern: mountPointPattern,
ignoredFSTypesPattern: filesystemsTypesPattern,
sizeDesc: sizeDesc,
freeDesc: freeDesc,
availDesc: availDesc,
filesDesc: filesDesc,
filesFreeDesc: filesFreeDesc,
roDesc: roDesc,
devErrors: devErrors,
}, nil
}
开发者ID:prometheus,项目名称:node_exporter,代码行数:60,代码来源:filesystem_common.go
示例19: NewMySQLExporter
// return new empty exporter
func NewMySQLExporter(dsn string) *Exporter {
return &Exporter{
dsn: dsn,
duration: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "exporter_last_scrape_duration_seconds",
Help: "The last scrape duration.",
}),
totalScrapes: prometheus.NewCounter(prometheus.CounterOpts{
Namespace: namespace,
Name: "exporter_scrapes_total",
Help: "Current total mysqld scrapes.",
}),
error: prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: namespace,
Name: "exporter_last_scrape_error",
Help: "The last scrape error status.",
}),
metrics: map[string]prometheus.Gauge{},
commands: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: globalStatus,
Name: "commands_total",
Help: "Number of executed mysql commands.",
}, []string{"command"}),
connectionErrors: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: globalStatus,
Name: "connection_errors_total",
Help: "Number of mysql connection errors.",
}, []string{"error"}),
innodbRows: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: globalStatus,
Name: "innodb_rows_total",
Help: "Mysql Innodb row operations.",
}, []string{"operation"}),
performanceSchema: prometheus.NewCounterVec(prometheus.CounterOpts{
Namespace: namespace,
Subsystem: globalStatus,
Name: "performance_schema_total",
Help: "Mysql instrumentations that could not be loaded or created due to memory constraints",
}, []string{"instrumentation"}),
}
}
开发者ID:jmptrader,项目名称:mysqld_exporter,代码行数:46,代码来源:mysqld_exporter.go
示例20: newMeasurer
func newMeasurer() grpcinstrument.Measurer {
return &measurer{
registry: ®istry{
total: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "grpc_calls_total",
Help: "Number of gRPC calls received by the server being instrumented.",
}, []string{"service", "method"}),
errors: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "grpc_calls_errors",
Help: "Number of gRPC calls that returned an error.",
}, []string{"service", "method"}),
duration: prometheus.NewHistogramVec(prometheus.HistogramOpts{
Name: "grpc_calls_durations",
Help: "Duration of gRPC calls.",
}, []string{"service", "method"}),
},
}
}
开发者ID:kazegusuri,项目名称:grpcinstrument,代码行数:18,代码来源:measurer.go
注:本文中的github.com/prometheus/client_golang/prometheus.NewCounterVec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论