func NewServer(dsn string, opts ...ServerOpt) (*Server, error) {
	fingerprint, err := parseFingerprint(dsn)
	if err != nil {
		return nil, err
	}
	db, err := sql.Open("postgres", dsn)
	if err != nil {
		return nil, err
	}
	db.SetMaxOpenConns(1)
	db.SetMaxIdleConns(1)

	log.Infof("Established new database connection to %q.", fingerprint)

	s := &Server{
		db:     db,
		master: false,
		labels: prometheus.Labels{
			serverLabelName: fingerprint,
		},
		metricCache: make(map[string]cachedMetrics),
	}

	for _, opt := range opts {
		opt(s)
	}

	return s, nil
}
// NewServer establishes a new connection using DSN.
NewServer establishes a new connection using DSN.
// NewServer establishes a new connection using DSN .
func NewServer(dsn string, opts ...ServerOpt) (*Server, error) {
	fingerprint, err := parseFingerprint(dsn)
	if err != nil {
		return nil, err
	}
	db, err := sql.Open("postgres", dsn)
	if err != nil {
		return nil, err
	}
	db.SetMaxOpenConns(1)
	db.SetMaxIdleConns(1)
	log.Infof("Established new database connection to %q.", fingerprint)
	s := &Server{
		db:     db,
		master: false,
		labels: prometheus.Labels{
			serverLabelName: fingerprint,
		},
		metricCache: make(map[string]cachedMetrics),
	}
	for _, opt := range opts {
		opt(s)
	}
	return s, nil
}
func NewServer ( dsn string , opts ... ServerOpt ) ( * Server , error ) { fingerprint , err := parseFingerprint ( dsn ) if err != nil { return nil , err } db , err := sql . Open ( " " , dsn ) if err != nil { return nil , err } db . SetMaxOpenConns ( 1 ) db . SetMaxIdleConns ( 1 ) log . Infof ( " " , fingerprint ) s := & Server { db : db , master : false , labels : prometheus . Labels { serverLabelName : fingerprint , } , metricCache : make ( map [ string ] cachedMetrics ) , } for _ , opt := range opts { opt ( s ) } return s , nil }
NewServer establishes a new connection using DSN.
NewServer establishes a new connection using DSN .