mirror of
				https://github.com/etcd-io/etcd.git
				synced 2024-09-27 06:25:44 +00:00 
			
		
		
		
	storage/backend: Add a gauge to indicate if defrag is active (backport from 3.6)
This commit is contained in:
		
							parent
							
								
									1eac258f58
								
							
						
					
					
						commit
						85abf6e46d
					
				| @ -354,6 +354,8 @@ func (b *backend) Defrag() error { | |||||||
| 
 | 
 | ||||||
| func (b *backend) defrag() error { | func (b *backend) defrag() error { | ||||||
| 	now := time.Now() | 	now := time.Now() | ||||||
|  | 	isDefragActive.Set(1) | ||||||
|  | 	defer isDefragActive.Set(0) | ||||||
| 
 | 
 | ||||||
| 	// TODO: make this non-blocking? | 	// TODO: make this non-blocking? | ||||||
| 	// lock batchTx to ensure nobody is using previous tx, and then | 	// lock batchTx to ensure nobody is using previous tx, and then | ||||||
|  | |||||||
| @ -83,6 +83,13 @@ var ( | |||||||
| 		// highest bucket start of 0.01 sec * 2^16 == 655.36 sec | 		// highest bucket start of 0.01 sec * 2^16 == 655.36 sec | ||||||
| 		Buckets: prometheus.ExponentialBuckets(.01, 2, 17), | 		Buckets: prometheus.ExponentialBuckets(.01, 2, 17), | ||||||
| 	}) | 	}) | ||||||
|  | 
 | ||||||
|  | 	isDefragActive = prometheus.NewGauge(prometheus.GaugeOpts{ | ||||||
|  | 		Namespace: "etcd", | ||||||
|  | 		Subsystem: "disk", | ||||||
|  | 		Name:      "defrag_inflight", | ||||||
|  | 		Help:      "Whether or not defrag is active on the member. 1 means active, 0 means not.", | ||||||
|  | 	}) | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| func init() { | func init() { | ||||||
| @ -92,4 +99,5 @@ func init() { | |||||||
| 	prometheus.MustRegister(writeSec) | 	prometheus.MustRegister(writeSec) | ||||||
| 	prometheus.MustRegister(defragSec) | 	prometheus.MustRegister(defragSec) | ||||||
| 	prometheus.MustRegister(snapshotTransferSec) | 	prometheus.MustRegister(snapshotTransferSec) | ||||||
|  | 	prometheus.MustRegister(isDefragActive) | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Geeta Gharpure
						Geeta Gharpure