2021-05-20 23:22:17 +03:00
|
|
|
// Copyright 2021 The Prometheus Authors
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2021-12-18 01:07:49 +03:00
|
|
|
//go:build go1.15
|
2021-05-20 23:22:17 +03:00
|
|
|
// +build go1.15
|
|
|
|
|
|
|
|
package collectors
|
|
|
|
|
2021-05-20 23:31:53 +03:00
|
|
|
import (
|
|
|
|
"database/sql"
|
2021-05-20 23:22:17 +03:00
|
|
|
|
2021-05-20 23:31:53 +03:00
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (c *dbStatsCollector) describeNewInGo115(ch chan<- *prometheus.Desc) {
|
2021-05-20 23:22:17 +03:00
|
|
|
ch <- c.maxIdleTimeClosed
|
|
|
|
}
|
|
|
|
|
2021-05-20 23:31:53 +03:00
|
|
|
func (c *dbStatsCollector) collectNewInGo115(ch chan<- prometheus.Metric, stats sql.DBStats) {
|
2021-05-20 23:22:17 +03:00
|
|
|
ch <- prometheus.MustNewConstMetric(c.maxIdleTimeClosed, prometheus.CounterValue, float64(stats.MaxIdleTimeClosed))
|
|
|
|
}
|