This repository was archived by the owner on Dec 1, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,13 @@ var (
4040 []string {"exporter" },
4141 )
4242
43- // Time spent exporting data to sink in microseconds .
43+ // Time spent exporting data to sink in milliseconds .
4444 exporterDuration = prometheus .NewSummaryVec (
4545 prometheus.SummaryOpts {
4646 Namespace : "heapster" ,
4747 Subsystem : "exporter" ,
48- Name : "duration_microseconds " ,
49- Help : "Time spent exporting data to sink in microseconds ." ,
48+ Name : "duration_milliseconds " ,
49+ Help : "Time spent exporting data to sink in milliseconds ." ,
5050 },
5151 []string {"exporter" },
5252 )
@@ -148,12 +148,17 @@ func (this *sinkManager) Stop() {
148148
149149func export (s core.DataSink , data * core.DataBatch ) {
150150 startTime := time .Now ()
151- defer lastExportTimestamp .
152- WithLabelValues (s .Name ()).
153- Set (float64 (time .Now ().Unix ()))
154- defer exporterDuration .
155- WithLabelValues (s .Name ()).
156- Observe (float64 (time .Since (startTime )) / float64 (time .Microsecond ))
151+
152+ defer func () {
153+ lastExportTimestamp .
154+ WithLabelValues (s .Name ()).
155+ Set (float64 (time .Now ().Unix ()))
156+ }()
157+ defer func () {
158+ exporterDuration .
159+ WithLabelValues (s .Name ()).
160+ Observe (float64 (time .Since (startTime )) / float64 (time .Millisecond ))
161+ }()
157162
158163 s .ExportData (data )
159164}
You can’t perform that action at this time.
0 commit comments