@@ -20,6 +20,7 @@ import (
2020 "net/http/pprof"
2121 "time"
2222
23+ "github.com/aws/aws-sdk-go/service/cloudwatch"
2324 "github.com/prometheus/client_golang/prometheus"
2425 "github.com/prometheus/client_golang/prometheus/promhttp"
2526 "github.com/slashdevops/aws_cloudwatch_exporter/internal/awshelper"
@@ -122,9 +123,11 @@ func startCmd(cmd *cobra.Command, args []string) {
122123
123124 m := metrics .New (& conf )
124125 sess := awshelper .NewSession (& conf .AWS )
126+ cwc := cloudwatch .New (sess )
125127
126- collector := collector .New (& conf , m , sess )
127- prometheus .MustRegister (collector )
128+ c := collector .New (& conf , m , cwc )
129+
130+ prometheus .MustRegister (c )
128131
129132 handlers := web .NewHandlers (& conf )
130133
@@ -134,20 +137,18 @@ func startCmd(cmd *cobra.Command, args []string) {
134137 mux .Handle (conf .Application .MetricsPath , promhttp .Handler ())
135138
136139 // Debug & Profiling
137- if conf .Server .Debug {
138- mux .HandleFunc ("/debug/pprof/" , pprof .Index )
139- mux .HandleFunc ("/debug/pprof/heap" , pprof .Index )
140- mux .HandleFunc ("/debug/pprof/mutex" , pprof .Index )
141- mux .HandleFunc ("/debug/pprof/goroutine" , pprof .Index )
142- mux .HandleFunc ("/debug/pprof/threadcreate" , pprof .Index )
143- mux .HandleFunc ("/debug/pprof/block" , pprof .Index )
144- mux .HandleFunc ("/debug/pprof/cmdline" , pprof .Cmdline )
145- mux .HandleFunc ("/debug/pprof/profile" , pprof .Profile )
146- mux .HandleFunc ("/debug/pprof/symbol" , pprof .Symbol )
147- mux .HandleFunc ("/debug/pprof/trace" , pprof .Trace )
148- }
149-
150- // this channel is to wait routines before finis this
140+ mux .HandleFunc ("/debug/pprof/" , pprof .Index )
141+ mux .HandleFunc ("/debug/pprof/heap" , pprof .Index )
142+ mux .HandleFunc ("/debug/pprof/mutex" , pprof .Index )
143+ mux .HandleFunc ("/debug/pprof/goroutine" , pprof .Index )
144+ mux .HandleFunc ("/debug/pprof/threadcreate" , pprof .Index )
145+ mux .HandleFunc ("/debug/pprof/block" , pprof .Index )
146+ mux .HandleFunc ("/debug/pprof/cmdline" , pprof .Cmdline )
147+ mux .HandleFunc ("/debug/pprof/profile" , pprof .Profile )
148+ mux .HandleFunc ("/debug/pprof/symbol" , pprof .Symbol )
149+ mux .HandleFunc ("/debug/pprof/trace" , pprof .Trace )
150+
151+ // this channel is to wait routines
151152 done := make (chan bool , 1 )
152153 s := server .New (mux , & conf )
153154
0 commit comments