|
|
@ -50,28 +50,21 @@ const (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
gceSDScrapesCount = prometheus.NewCounter(
|
|
|
|
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
|
|
|
|
Namespace: namespace,
|
|
|
|
|
|
|
|
Name: "gce_sd_scrapes_total",
|
|
|
|
|
|
|
|
Help: "The number of GCE-SD scrapes.",
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
gceSDScrapeFailuresCount = prometheus.NewCounter(
|
|
|
|
gceSDScrapeFailuresCount = prometheus.NewCounter(
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
prometheus.CounterOpts{
|
|
|
|
Namespace: namespace,
|
|
|
|
Namespace: namespace,
|
|
|
|
Name: "gce_sd_scrape_failures_total",
|
|
|
|
Name: "sd_gce_scrape_failures_total",
|
|
|
|
Help: "The number of GCE-SD scrape failures.",
|
|
|
|
Help: "The number of GCE-SD scrape failures.",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
gceSDScrapeDuration = prometheus.NewSummary(
|
|
|
|
gceSDScrapeDuration = prometheus.NewSummary(
|
|
|
|
prometheus.SummaryOpts{
|
|
|
|
prometheus.SummaryOpts{
|
|
|
|
Namespace: namespace,
|
|
|
|
Namespace: namespace,
|
|
|
|
Name: "gce_sd_scrape_duration",
|
|
|
|
Name: "sd_gce_scrape_duration",
|
|
|
|
Help: "The duration of a GCE-SD scrape in seconds.",
|
|
|
|
Help: "The duration of a GCE-SD scrape in seconds.",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
prometheus.MustRegister(gceSDScrapesCount)
|
|
|
|
|
|
|
|
prometheus.MustRegister(gceSDScrapeFailuresCount)
|
|
|
|
prometheus.MustRegister(gceSDScrapeFailuresCount)
|
|
|
|
prometheus.MustRegister(gceSDScrapeDuration)
|
|
|
|
prometheus.MustRegister(gceSDScrapeDuration)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -147,7 +140,6 @@ func (gd *GCEDiscovery) refresh() (tg *config.TargetGroup, err error) {
|
|
|
|
t0 := time.Now()
|
|
|
|
t0 := time.Now()
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
gceSDScrapeDuration.Observe(time.Since(t0).Seconds())
|
|
|
|
gceSDScrapeDuration.Observe(time.Since(t0).Seconds())
|
|
|
|
gceSDScrapesCount.Inc()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
gceSDScrapeFailuresCount.Inc()
|
|
|
|
gceSDScrapeFailuresCount.Inc()
|
|
|
|
}
|
|
|
|
}
|
|
|
|