-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
197 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters