• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang prometheus.NewGaugeVec函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/prometheus/client_golang/prometheus.NewGaugeVec函数的典型用法代码示例。如果您正苦于以下问题:Golang NewGaugeVec函数的具体用法?Golang NewGaugeVec怎么用?Golang NewGaugeVec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NewGaugeVec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: NewProcessesCollector

func NewProcessesCollector() (Collector, error) {
	var processesLabelNames = []string{"process"}

	return &processesCollector{
		metrics: []prometheus.Collector{
			prometheus.NewGaugeVec(
				prometheus.GaugeOpts{
					Namespace: Namespace,
					Subsystem: processesSubsystem,
					Name:      "memory_resident_usage_bytes",
					Help:      "Resident memory size in bytes",
				},
				processesLabelNames,
			),
			prometheus.NewGaugeVec(
				prometheus.GaugeOpts{
					Namespace: Namespace,
					Subsystem: processesSubsystem,
					Name:      "cpu_usage_total_seconds",
					Help:      "Total CPU user and system time in seconds",
				},
				processesLabelNames,
			),
		},
	}, nil
}
开发者ID:lukaf,项目名称:node_exporter,代码行数:26,代码来源:processes.go


示例2: NewPingCollector

// NewPingCollector returns a new pingCollector
func NewPingCollector(targets targets) *pingCollector {
	return &pingCollector{
		targets: targets,
		metrics: pingers.Metrics{
			Up: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: pingers.Namespace,
				Name:      "up",
				Help:      "1 if url is reachable, 0 if not",
			}, []string{"url"}),
			Latency: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: pingers.Namespace,
				Name:      "latency_seconds",
				Help:      "Latency of request for url",
			}, []string{"url"}),
			Size: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: pingers.Namespace,
				Name:      "size_bytes",
				Help:      "Size of request for url",
			}, []string{"url"}),
			Code: prometheus.NewGaugeVec(prometheus.GaugeOpts{
				Namespace: pingers.Namespace,
				Name:      "response_code",
				Help:      "Response code for url",
			}, []string{"url"}),
		},
	}
}
开发者ID:afefelov,项目名称:blackbox_prober,代码行数:28,代码来源:main.go


示例3: NewExporter

func NewExporter(uri string) *Exporter {
	return &Exporter{
		URI: uri,
		up: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, "", "up"),
			"Could the apache server be reached",
			nil,
			nil),
		scrapeFailures: prometheus.NewCounter(prometheus.CounterOpts{
			Namespace: namespace,
			Name:      "exporter_scrape_failures_total",
			Help:      "Number of errors while scraping apache.",
		}),
		accessesTotal: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, "", "accesses_total"),
			"Current total apache accesses",
			nil,
			nil),
		kBytesTotal: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, "", "sent_kilobytes_total"),
			"Current total kbytes sent",
			nil,
			nil),
		uptime: prometheus.NewDesc(
			prometheus.BuildFQName(namespace, "", "uptime_seconds_total"),
			"Current uptime in seconds",
			nil,
			nil),
		workers: prometheus.NewGaugeVec(prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "workers",
			Help:      "Apache worker statuses",
		},
			[]string{"state"},
		),
		scoreboard: prometheus.NewGaugeVec(prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "scoreboard",
			Help:      "Apache scoreboard statuses",
		},
			[]string{"state"},
		),
		connections: prometheus.NewGaugeVec(prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "connections",
			Help:      "Apache connection statuses",
		},
			[]string{"state"},
		),
		client: &http.Client{
			Transport: &http.Transport{
				TLSClientConfig: &tls.Config{InsecureSkipVerify: *insecure},
			},
		},
	}
}
开发者ID:neezgee,项目名称:apache_exporter,代码行数:56,代码来源:apache_exporter.go


示例4: NewFilesystemCollector

// Takes a prometheus registry and returns a new Collector exposing
// network device filesystems.
func NewFilesystemCollector() (Collector, error) {
	var filesystemLabelNames = []string{"device", "mountpoint", "fstype"}

	return &filesystemCollector{
		ignoredMountPointsPattern: regexp.MustCompile(*ignoredMountPoints),
		size: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: Namespace,
				Subsystem: filesystemSubsystem,
				Name:      "size",
				Help:      "Filesystem size in bytes.",
			},
			filesystemLabelNames,
		),
		free: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: Namespace,
				Subsystem: filesystemSubsystem,
				Name:      "free",
				Help:      "Filesystem free space in bytes.",
			},
			filesystemLabelNames,
		),
		avail: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: Namespace,
				Subsystem: filesystemSubsystem,
				Name:      "avail",
				Help:      "Filesystem space available to non-root users in bytes.",
			},
			filesystemLabelNames,
		),
		files: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: Namespace,
				Subsystem: filesystemSubsystem,
				Name:      "files",
				Help:      "Filesystem total file nodes.",
			},
			filesystemLabelNames,
		),
		filesFree: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: Namespace,
				Subsystem: filesystemSubsystem,
				Name:      "files_free",
				Help:      "Filesystem total free file nodes.",
			},
			filesystemLabelNames,
		),
	}, nil
}
开发者ID:robbiet480,项目名称:node_exporter,代码行数:54,代码来源:filesystem_linux.go


示例5: NewRunitCollector

func NewRunitCollector() (Collector, error) {
	var (
		subsystem   = "service"
		constLabels = prometheus.Labels{"supervisor": "runit"}
		labelNames  = []string{"service"}
	)

	return &runitCollector{
		state: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace:   Namespace,
				Subsystem:   subsystem,
				Name:        "state",
				Help:        "State of runit service.",
				ConstLabels: constLabels,
			},
			labelNames,
		),
		stateDesired: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace:   Namespace,
				Subsystem:   subsystem,
				Name:        "desired_state",
				Help:        "Desired state of runit service.",
				ConstLabels: constLabels,
			},
			labelNames,
		),
		stateNormal: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace:   Namespace,
				Subsystem:   subsystem,
				Name:        "normal_state",
				Help:        "Normal state of runit service.",
				ConstLabels: constLabels,
			},
			labelNames,
		),
		stateTimestamp: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace:   Namespace,
				Subsystem:   subsystem,
				Name:        "state_last_change_timestamp_seconds",
				Help:        "Unix timestamp of the last runit service state change.",
				ConstLabels: constLabels,
			},
			labelNames,
		),
	}, nil
}
开发者ID:gpolaert,项目名称:node_exporter,代码行数:50,代码来源:runit.go


示例6: newAnnotationStats

func newAnnotationStats() *prometheus.GaugeVec {

	return prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "annotations_total",
		Help: "Number of annotations per tag.",
	}, []string{"tag"})
}
开发者ID:birgirst,项目名称:prom_annotation_server,代码行数:7,代码来源:prom_annotation_server.go


示例7: 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


示例8: Update

func (c *netDevCollector) Update(ch chan<- prometheus.Metric) (err error) {
	netDev, err := getNetDevStats(c.ignoredDevicesPattern)
	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.NewGaugeVec(
						prometheus.GaugeOpts{
							Namespace: Namespace,
							Subsystem: netDevSubsystem,
							Name:      key,
							Help:      fmt.Sprintf("%s %s from /proc/net/dev.", 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_linux.go


示例9: ExampleGaugeVec

func ExampleGaugeVec() {
	binaryVersion := flag.String("binary_version", "debug", "Version of the binary: debug, canary, production.")
	flag.Parse()

	opsQueued := prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace:   "our_company",
			Subsystem:   "blob_storage",
			Name:        "ops_queued",
			Help:        "Number of blob storage operations waiting to be processed, partitioned by user and type.",
			ConstLabels: prometheus.Labels{"binary_version": *binaryVersion},
		},
		[]string{
			// Which user has requested the operation?
			"user",
			// Of what type is the operation?
			"type",
		},
	)
	prometheus.MustRegister(opsQueued)

	// Increase a value using compact (but order-sensitive!) WithLabelValues().
	opsQueued.WithLabelValues("bob", "put").Add(4)
	// Increase a value with a map using WithLabels. More verbose, but order
	// doesn't matter anymore.
	opsQueued.With(prometheus.Labels{"type": "delete", "user": "alice"}).Inc()
}
开发者ID:eghobo,项目名称:kubedash,代码行数:27,代码来源:examples_test.go


示例10: registerMetrics

func registerMetrics() (err error) {
	items, err := muninList()
	if err != nil {
		return
	}

	for _, name := range items {
		graphs = append(graphs, name)
		configs, graphConfig, err := muninConfig(name)
		if err != nil {
			return err
		}

		for metric, config := range configs {
			metricName := name + "-" + metric
			desc := graphConfig["graph_title"] + ": " + config["label"]
			if config["info"] != "" {
				desc = desc + ", " + config["info"]
			}
			gv := prometheus.NewGaugeVec(
				prometheus.GaugeOpts{
					Name: metricName,
					Help: desc,
				},
				[]string{"hostname"},
			)
			log.Printf("Registered %s: %s", metricName, desc)
			gaugePerMetric[metricName] = gv
			prometheus.Register(gv)
		}
	}
	return nil
}
开发者ID:prometheus-junkyard,项目名称:munin_exporter,代码行数:33,代码来源:munin_exporter.go


示例11: setMetric

func (c *gmondCollector) setMetric(name, cluster string, metric ganglia.Metric) {
	if _, ok := c.metrics[name]; !ok {
		var desc string
		var title string
		for _, element := range metric.ExtraData.ExtraElements {
			switch element.Name {
			case "DESC":
				desc = element.Val
			case "TITLE":
				title = element.Val
			}
			if title != "" && desc != "" {
				break
			}
		}
		log.Debugf("Register %s: %s", name, desc)
		c.metrics[name] = prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: gangliaNamespace,
				Name:      name,
				Help:      desc,
			},
			[]string{"cluster"},
		)
	}
	log.Debugf("Set %s{cluster=%q}: %f", name, cluster, metric.Value)
	c.metrics[name].WithLabelValues(cluster).Set(metric.Value)
}
开发者ID:kirussel,项目名称:node_exporter,代码行数:28,代码来源:gmond.go


示例12: NewLabeledGauge

func (n *Namespace) NewLabeledGauge(name, help string, unit Unit, labels ...string) LabeledGauge {
	g := &labeledGauge{
		pg: prometheus.NewGaugeVec(n.newGaugeOpts(name, help, unit), labels),
	}
	n.addMetric(g)
	return g
}
开发者ID:Mic92,项目名称:docker,代码行数:7,代码来源:namespace.go


示例13: setMetric

func (e *exporter) setMetric(name string, labels map[string]string, metric Metric) {
	debug("%s{%s} = %f", name, labels, metric.Value)
	e.Lock()
	defer e.Unlock()
	if _, ok := e.Metrics[name]; !ok {
		var desc string
		var title string
		for _, element := range metric.ExtraData.ExtraElements {
			switch element.Name {
			case "DESC":
				desc = element.Val
			case "TITLE":
				title = element.Val
			}
			if title != "" && desc != "" {
				break
			}
		}
		debug("New metric: %s (%s)", name, desc)
		gv := prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Name: name,
				Help: desc,
			},
			prometheusLabels,
		)
		e.Metrics[name] = gv
		prometheus.Register(gv) // One GaugeVec per metric!
	}
	e.Metrics[name].With(labels).Set(metric.Value)
}
开发者ID:prometheus-junkyard,项目名称:gmond_exporter,代码行数:31,代码来源:exporter.go


示例14: New

func New(configFile string) (e exporter, err error) {

	e = exporter{
		configFile: configFile,
		Metrics:    map[string]*prometheus.GaugeVec{},
		scrapeDuration: prometheus.NewSummaryVec(
			prometheus.SummaryOpts{
				Namespace: namespace,
				Name:      "scrape_duration_seconds",
				Help:      "gmond_exporter: Duration of a scrape job.",
			},
			[]string{"endpoint", "result"},
		),
		metricsUpdated: prometheus.NewGaugeVec(
			prometheus.GaugeOpts{
				Namespace: namespace,
				Name:      "metrics_updated_count",
				Help:      "gmond_exporter: Number of metrics updated.",
			},
			[]string{"endpoint"},
		),
		metricsExported: prometheus.NewGauge(prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "metrics_exported_count",
			Help:      "gmond_exporter: Number of metrics exported.",
		}),
		configChan:            make(chan config),
		listeningAddress:      ":8080",
		gangliaScrapeInterval: 60 * time.Second,
	}

	conf, err := e.readConfig()
	if err != nil {
		return e, fmt.Errorf("Couldn't read config: %s", err)
	}
	e.conf = conf

	if conf.ListeningAddress != "" {
		e.listeningAddress = conf.ListeningAddress
	}
	if conf.GangliaScrapeInterval != 0 {
		e.gangliaScrapeInterval = time.Duration(conf.GangliaScrapeInterval) * time.Second
	}

	prometheus.MustRegister(e.scrapeDuration)
	prometheus.MustRegister(e.metricsUpdated)
	prometheus.MustRegister(e.metricsExported)
	debug("Registered internal metrics")

	sig := make(chan os.Signal, 1)
	signal.Notify(sig, syscall.SIGHUP)
	go func() {
		for _ = range sig {
			e.reloadConfig() // sends a new config to configChan
		}
	}()

	go e.serveStatus()
	return e, nil
}
开发者ID:prometheus-junkyard,项目名称:gmond_exporter,代码行数:60,代码来源:exporter.go


示例15: gauge

func gauge(subsystem, name, help string, labels ...string) *prometheus.GaugeVec {
	return prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: "mesos",
		Subsystem: subsystem,
		Name:      name,
		Help:      help,
	}, labels)
}
开发者ID:yuyulei,项目名称:mesos_exporter,代码行数:8,代码来源:common.go


示例16: NewGauge

// NewGauge returns a new Gauge backed by a Prometheus metric. The gauge is
// automatically registered via prometheus.Register.
func NewGauge(opts prometheus.GaugeOpts, fieldKeys []string) metrics.Gauge {
	m := prometheus.NewGaugeVec(opts, fieldKeys)
	prometheus.MustRegister(m)
	return prometheusGauge{
		GaugeVec: m,
		Pairs:    pairsFrom(fieldKeys),
	}
}
开发者ID:cnicolov,项目名称:kit,代码行数:10,代码来源:prometheus.go


示例17: 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


示例18: Prepare

func (p *prometheusExport) Prepare() {
	p.ProbeIsUp = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: *prometheusProbeNameSpace,
		Name:      "up",
		Help:      "Indicates success/failure of the probe. Value of 1 is a success while 0 is a failure. Value of -1 could be because of probe timeout/error.",
	}, labels)

	p.ProbeLatency = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: *prometheusProbeNameSpace,
		Name:      "latency",
		Help:      "The probe latency in milliseconds. Value of -1 could be because of probe timeout/error.",
	}, labels)

	p.ProbePayloadSize = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: *prometheusProbeNameSpace,
		Name:      "payload_size",
		Help:      "The probe response payload size in bytes. Value of -1 could be because of probe timeout/error.",
	}, labels)

	p.ProbeErrorCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: *prometheusProbeNameSpace,
		Name:      "failure_count",
		Help:      "The probe error count.",
	}, labels)

	p.ProbeTimeoutCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: *prometheusProbeNameSpace,
		Name:      "timeout_count",
		Help:      "The probe timeout count.",
	}, labels)

	p.ProbeCount = prometheus.NewCounterVec(prometheus.CounterOpts{
		Namespace: *prometheusProbeNameSpace,
		Name:      "count",
		Help:      "Total Probe count.",
	}, labels)

	prometheus.MustRegister(p.ProbeCount)
	prometheus.MustRegister(p.ProbeErrorCount)
	prometheus.MustRegister(p.ProbeTimeoutCount)
	prometheus.MustRegister(p.ProbeLatency)
	prometheus.MustRegister(p.ProbeIsUp)
	prometheus.MustRegister(p.ProbePayloadSize)
}
开发者ID:samitpal,项目名称:goProbe,代码行数:44,代码来源:prometheus_export.go


示例19: 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


示例20: initGauges

func (e *Exporter) initGauges() {

	e.metrics = map[string]*prometheus.GaugeVec{}
	e.metrics["db_keys_total"] = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: e.namespace,
		Name:      "db_keys_total",
		Help:      "Total number of keys by DB",
	}, []string{"addr", "db"})
	e.metrics["db_expiring_keys_total"] = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: e.namespace,
		Name:      "db_expiring_keys_total",
		Help:      "Total number of expiring keys by DB",
	}, []string{"addr", "db"})
	e.metrics["db_avg_ttl_seconds"] = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: e.namespace,
		Name:      "db_avg_ttl_seconds",
		Help:      "Avg TTL in seconds",
	}, []string{"addr", "db"})
}
开发者ID:DavidWittman,项目名称:redis_exporter,代码行数:19,代码来源:redis_exporter.go



注:本文中的github.com/prometheus/client_golang/prometheus.NewGaugeVec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang prometheus.NewHistogram函数代码示例发布时间:2022-05-28
下一篇:
Golang prometheus.NewGaugeFunc函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap