forked from fiorix/freegeoip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
48 lines (40 loc) · 1.23 KB
/
metrics.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2009 The freegeoip authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package apiserver
import "github.com/prometheus/client_golang/prometheus"
// Experimental metrics for Prometheus, might change in the future.
var dbEventCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "freegeoip_db_events_total",
Help: "Database events",
},
[]string{"event"},
)
var clientCountryCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "freegeoip_client_country_code_total",
Help: "Country ISO code of clients",
},
[]string{"country_code"},
)
var clientIPProtoCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "freegeoip_client_ipproto_version_total",
Help: "IP version (4 or 6) of clients",
},
[]string{"ip"},
)
var clientConnsGauge = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Name: "freegeoip_client_connections",
Help: "Number of active client connections per protocol",
},
[]string{"proto"},
)
func init() {
prometheus.MustRegister(dbEventCounter)
prometheus.MustRegister(clientCountryCounter)
prometheus.MustRegister(clientConnsGauge)
prometheus.MustRegister(clientIPProtoCounter)
}