You've already forked postgres_exporter
							
							
				mirror of
				https://github.com/prometheus-community/postgres_exporter.git
				synced 2025-11-03 07:53:12 +03:00 
			
		
		
		
	Bug Fix: Fix lingering type issues (#828)
* Fix postmaster type issue * Disable postmaster collector by default --------- Signed-off-by: Felix Yuan <felix.yuan@reddit.com>
This commit is contained in:
		@@ -23,7 +23,7 @@ import (
 | 
				
			|||||||
const postmasterSubsystem = "postmaster"
 | 
					const postmasterSubsystem = "postmaster"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	registerCollector(postmasterSubsystem, defaultEnabled, NewPGPostmasterCollector)
 | 
						registerCollector(postmasterSubsystem, defaultDisabled, NewPGPostmasterCollector)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type PGPostmasterCollector struct {
 | 
					type PGPostmasterCollector struct {
 | 
				
			||||||
@@ -44,7 +44,7 @@ var (
 | 
				
			|||||||
		[]string{}, nil,
 | 
							[]string{}, nil,
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pgPostmasterQuery = "SELECT pg_postmaster_start_time from pg_postmaster_start_time();"
 | 
						pgPostmasterQuery = "SELECT extract(epoch from pg_postmaster_start_time) from pg_postmaster_start_time();"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (c *PGPostmasterCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
 | 
					func (c *PGPostmasterCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,7 +84,7 @@ func (PGProcessIdleCollector) Update(ctx context.Context, instance *instance, ch
 | 
				
			|||||||
	var applicationName sql.NullString
 | 
						var applicationName sql.NullString
 | 
				
			||||||
	var secondsSum sql.NullInt64
 | 
						var secondsSum sql.NullInt64
 | 
				
			||||||
	var secondsCount sql.NullInt64
 | 
						var secondsCount sql.NullInt64
 | 
				
			||||||
	var seconds []int64
 | 
						var seconds []uint64
 | 
				
			||||||
	var secondsBucket []uint64
 | 
						var secondsBucket []uint64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err := row.Scan(&applicationName, &secondsSum, &secondsCount, &seconds, &secondsBucket)
 | 
						err := row.Scan(&applicationName, &secondsSum, &secondsCount, &seconds, &secondsBucket)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user