Style changes and cleanup
This patch makes stylistic changes to error strings, unexports method names by lower casing them, removes unused dataSetMetric, and adds copyright/licence information. Signed-Off-By: Corey Stewart <stewa169@purdue.edu>
This commit is contained in:
parent
c95bfa705e
commit
a8c94d48e6
7 changed files with 76 additions and 50 deletions
|
|
@ -1,3 +1,16 @@
|
|||
// Copyright 2016 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.
|
||||
|
||||
package collector
|
||||
|
||||
// +build linux freebsd
|
||||
|
|
@ -33,11 +46,6 @@ type zfsMetric struct {
|
|||
sysctl zfsSysctl // The sysctl of the ZFS metric.
|
||||
}
|
||||
|
||||
type datasetMetric struct {
|
||||
subsystem zfsSubsystemName
|
||||
name string
|
||||
}
|
||||
|
||||
// Collector
|
||||
|
||||
func init() {
|
||||
|
|
@ -53,8 +61,12 @@ func NewZFSCollector() (Collector, error) {
|
|||
}
|
||||
|
||||
func (c *zfsCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
||||
// Arcstats
|
||||
err = c.updateArcstats(ch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = c.zfsAvailable()
|
||||
switch {
|
||||
case err == zfsNotAvailableError:
|
||||
log.Debug(err)
|
||||
|
|
@ -63,12 +75,6 @@ func (c *zfsCollector) Update(ch chan<- prometheus.Metric) (err error) {
|
|||
return err
|
||||
}
|
||||
|
||||
// Arcstats
|
||||
err = c.updateArcstats(ch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Pool stats
|
||||
return c.updatePoolStats(ch)
|
||||
}
|
||||
|
|
@ -78,8 +84,7 @@ func (s zfsSysctl) metricName() string {
|
|||
return parts[len(parts)-1]
|
||||
}
|
||||
|
||||
func (c *zfsCollector) ConstSysctlMetric(subsystem zfsSubsystemName, sysctl zfsSysctl, value zfsMetricValue) prometheus.Metric {
|
||||
|
||||
func (c *zfsCollector) constSysctlMetric(subsystem zfsSubsystemName, sysctl zfsSysctl, value zfsMetricValue) prometheus.Metric {
|
||||
metricName := sysctl.metricName()
|
||||
|
||||
return prometheus.MustNewConstMetric(
|
||||
|
|
@ -93,17 +98,3 @@ func (c *zfsCollector) ConstSysctlMetric(subsystem zfsSubsystemName, sysctl zfsS
|
|||
float64(value),
|
||||
)
|
||||
}
|
||||
|
||||
func (c *zfsCollector) ConstZpoolMetric(pool, name string, value float64) prometheus.Metric {
|
||||
return prometheus.MustNewConstMetric(
|
||||
prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, string(zpoolSubsystem), name),
|
||||
name,
|
||||
[]string{"pool"},
|
||||
nil,
|
||||
),
|
||||
prometheus.UntypedValue,
|
||||
float64(value),
|
||||
pool,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue