diff --git a/cmd/ccache_exporter/main.go b/cmd/ccache_exporter/main.go index 2ad92ab..3ba01cb 100644 --- a/cmd/ccache_exporter/main.go +++ b/cmd/ccache_exporter/main.go @@ -1,3 +1,7 @@ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + package main import ( diff --git a/cmd/ccacheparser/main.go b/cmd/ccacheparser/main.go index 06c8630..231f0eb 100644 --- a/cmd/ccacheparser/main.go +++ b/cmd/ccacheparser/main.go @@ -1,3 +1,7 @@ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + package main import ( diff --git a/collector.go b/collector.go index bf888f8..e44239a 100644 --- a/collector.go +++ b/collector.go @@ -1,8 +1,7 @@ -// Prometheus metrics collection. -// -// See: -// - https://ccache.samba.org/ -// - https://prometheus.io/ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + package ccache import ( @@ -30,6 +29,8 @@ type collector struct { maxCacheSizeBytes *prometheus.Desc } +// NewCollector initializes and returns a Prometheus collector for ccache +// metrics. func NewCollector() *collector { return &collector{ call: prometheus.NewDesc( @@ -101,6 +102,8 @@ func NewCollector() *collector { } } +// Describe publishes the description of each ccache metric to a metrics +// channel. func (c *collector) Describe(ch chan<- *prometheus.Desc) { ch <- c.call ch <- c.callHit @@ -115,6 +118,7 @@ func (c *collector) Describe(ch chan<- *prometheus.Desc) { ch <- c.maxCacheSizeBytes } +// Collect gathers metrics from ccache. func (c *collector) Collect(ch chan<- prometheus.Metric) { out, err := exec.Command("ccache", "-s").Output() if err != nil { diff --git a/doc.go b/doc.go new file mode 100644 index 0000000..b875176 --- /dev/null +++ b/doc.go @@ -0,0 +1,7 @@ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + +// Package ccache provides a simple parser for ccache metrics, and a Prometheus +// collector to expose these metrics for scraping. +package ccache diff --git a/parser.go b/parser.go index f390b3e..7d675a1 100644 --- a/parser.go +++ b/parser.go @@ -1,3 +1,7 @@ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + package ccache import ( diff --git a/parser_test.go b/parser_test.go index b989640..626bc09 100644 --- a/parser_test.go +++ b/parser_test.go @@ -1,3 +1,7 @@ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + package ccache import ( diff --git a/statistics.go b/statistics.go index 4cea930..be28a71 100644 --- a/statistics.go +++ b/statistics.go @@ -1,3 +1,7 @@ +// Copyright 2018 VirtualTam. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + package ccache import (