forked from pingcap/dumpling
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more log and compress option (pingcap#202)
* add percentage log * add summary * redirect log to dumpling's logger * add --compress option and relative integration test * add prometheus metrics in dumpling
- Loading branch information
Showing
14 changed files
with
341 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package export | ||
|
||
import ( | ||
"github.com/prometheus/client_golang/prometheus" | ||
) | ||
|
||
var ( | ||
finishedSizeCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "dumpling", | ||
Subsystem: "dump", | ||
Name: "finished_size", | ||
Help: "counter for dumpling finished file size", | ||
}, []string{}) | ||
finishedRowsCounter = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "dumpling", | ||
Subsystem: "dump", | ||
Name: "finished_rows", | ||
Help: "counter for dumpling finished rows", | ||
}, []string{}) | ||
writeTimeHistogram = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "dumpling", | ||
Subsystem: "write", | ||
Name: "write_duration_time", | ||
Help: "Bucketed histogram of write time (s) of files", | ||
Buckets: prometheus.ExponentialBuckets(0.00005, 2, 20), | ||
}, []string{}) | ||
receiveWriteChunkTimeHistogram = prometheus.NewHistogramVec( | ||
prometheus.HistogramOpts{ | ||
Namespace: "dumpling", | ||
Subsystem: "write", | ||
Name: "receive_chunk_duration_time", | ||
Help: "Bucketed histogram of write time (s) of files", | ||
Buckets: prometheus.ExponentialBuckets(0.00005, 2, 20), | ||
}, []string{}) | ||
errorCount = prometheus.NewCounterVec( | ||
prometheus.CounterOpts{ | ||
Namespace: "dumpling", | ||
Subsystem: "dump", | ||
Name: "error_count", | ||
Help: "Total error count during dumping progress", | ||
}, []string{}) | ||
) | ||
|
||
// RegisterMetrics registers metrics. | ||
func RegisterMetrics(registry *prometheus.Registry) { | ||
registry.MustRegister(finishedSizeCounter) | ||
registry.MustRegister(finishedRowsCounter) | ||
registry.MustRegister(writeTimeHistogram) | ||
registry.MustRegister(receiveWriteChunkTimeHistogram) | ||
registry.MustRegister(errorCount) | ||
} | ||
|
||
func RemoveLabelValuesWithTaskInMetrics(labels prometheus.Labels) { | ||
finishedSizeCounter.Delete(labels) | ||
finishedRowsCounter.Delete(labels) | ||
writeTimeHistogram.Delete(labels) | ||
receiveWriteChunkTimeHistogram.Delete(labels) | ||
errorCount.Delete(labels) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.