-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
84 lines (79 loc) · 1.92 KB
/
main.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package main
import (
"log"
"os"
"time"
"github.com/jbub/pgbouncer_exporter/cmd"
"github.com/jbub/pgbouncer_exporter/internal/collector"
_ "github.com/lib/pq"
"github.com/prometheus/common/version"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: collector.Name,
Usage: collector.Name,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "web.listen-address",
Usage: "Address on which to expose metrics and web interface.",
EnvVars: []string{"WEB_LISTEN_ADDRESS"},
Value: ":9127",
},
&cli.StringFlag{
Name: "web.telemetry-path",
Usage: "Path under which to expose metrics.",
EnvVars: []string{"WEB_TELEMETRY_PATH"},
Value: "/metrics",
},
&cli.StringFlag{
Name: "database-url",
Usage: "Database connection url.",
EnvVars: []string{"DATABASE_URL"},
},
&cli.BoolFlag{
Name: "export-stats",
Usage: "Export stats.",
EnvVars: []string{"EXPORT_STATS"},
Value: true,
},
&cli.BoolFlag{
Name: "export-pools",
Usage: "Export pools.",
EnvVars: []string{"EXPORT_POOLS"},
Value: true,
},
&cli.BoolFlag{
Name: "export-databases",
Usage: "Export databases.",
EnvVars: []string{"EXPORT_DATABASES"},
Value: true,
},
&cli.BoolFlag{
Name: "export-lists",
Usage: "Export lists.",
EnvVars: []string{"EXPORT_LISTS"},
Value: true,
},
&cli.DurationFlag{
Name: "store-timeout",
Usage: "Per method store timeout.",
EnvVars: []string{"STORE_TIMEOUT"},
Value: time.Second * 2,
},
&cli.StringFlag{
Name: "default-labels",
Usage: "Default prometheus labels applied to all metrics. Format: label1=value1 label2=value2",
EnvVars: []string{"DEFAULT_LABELS"},
},
},
Commands: []*cli.Command{
cmd.Server,
cmd.Health,
},
Version: version.Info(),
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}