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 
			
		
		
		
	Adjust collector to use separate connection per scrape (#931)
Fixes #921 Signed-off-by: Joe Adams <github@joeadams.io>
This commit is contained in:
		@@ -43,6 +43,13 @@ func newInstance(dsn string) (*instance, error) {
 | 
			
		||||
	return i, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// copy returns a copy of the instance.
 | 
			
		||||
func (i *instance) copy() *instance {
 | 
			
		||||
	return &instance{
 | 
			
		||||
		dsn: i.dsn,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (i *instance) setup() error {
 | 
			
		||||
	db, err := sql.Open("postgres", i.dsn)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user