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
|
||||
|
||||
import (
|
||||
|
|
@ -17,14 +30,6 @@ const (
|
|||
zfsArcstatsProcpath = "spl/kstat/zfs/arcstats"
|
||||
)
|
||||
|
||||
func (c *zfsCollector) zfsAvailable() (err error) {
|
||||
file, err := c.openArcstatsFile()
|
||||
if err != nil {
|
||||
file.Close()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *zfsCollector) openArcstatsFile() (file *os.File, err error) {
|
||||
file, err = os.Open(procFilePath(zfsArcstatsProcpath))
|
||||
if err != nil {
|
||||
|
|
@ -35,7 +40,6 @@ func (c *zfsCollector) openArcstatsFile() (file *os.File, err error) {
|
|||
}
|
||||
|
||||
func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) {
|
||||
|
||||
file, err := c.openArcstatsFile()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -43,13 +47,11 @@ func (c *zfsCollector) updateArcstats(ch chan<- prometheus.Metric) (err error) {
|
|||
defer file.Close()
|
||||
|
||||
return c.parseArcstatsProcfsFile(file, func(s zfsSysctl, v zfsMetricValue) {
|
||||
ch <- c.ConstSysctlMetric(arc, s, v)
|
||||
ch <- c.constSysctlMetric(arc, s, v)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func (c *zfsCollector) parseArcstatsProcfsFile(reader io.Reader, handler func(zfsSysctl, zfsMetricValue)) (err error) {
|
||||
|
||||
scanner := bufio.NewScanner(reader)
|
||||
|
||||
parseLine := false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue