-
Notifications
You must be signed in to change notification settings - Fork 473
/
models.go
49 lines (41 loc) · 950 Bytes
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package metrics
import (
"github.com/topfreegames/pitaya/config"
)
// Summary defines a summary metric
type Summary struct {
Subsystem string
Name string
Help string
Objectives map[float64]float64
Labels []string
}
// Gauge defines a gauge metric
type Gauge struct {
Subsystem string
Name string
Help string
Labels []string
}
// Counter defines a counter metric
type Counter struct {
Subsystem string
Name string
Help string
Labels []string
}
// CustomMetricsSpec has all metrics specs
type CustomMetricsSpec struct {
Summaries []*Summary
Gauges []*Gauge
Counters []*Counter
}
// NewCustomMetricsSpec returns a *CustomMetricsSpec by reading config key
func NewCustomMetricsSpec(config *config.Config) (*CustomMetricsSpec, error) {
var spec CustomMetricsSpec
err := config.UnmarshalKey("pitaya.metrics.custom", &spec)
if err != nil {
return nil, err
}
return &spec, nil
}