mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
23 lines
408 B
Go
23 lines
408 B
Go
package metrics
|
|
|
|
import "fmt"
|
|
|
|
type CounterMetric struct {
|
|
Name string
|
|
Value int64
|
|
Desc string
|
|
Labels Labels
|
|
}
|
|
|
|
func (c CounterMetric) Key() string {
|
|
return c.Name
|
|
}
|
|
|
|
func (c CounterMetric) Print() string {
|
|
return fmt.Sprintf("%s%s %d", c.Name, c.Labels.Print(), c.Value)
|
|
}
|
|
|
|
func (c CounterMetric) Header() string {
|
|
return fmt.Sprintf("# HELP %s %s\n# TYPE %s counter", c.Name, c.Desc, c.Name)
|
|
}
|