Skip to content

Commit

Permalink
rename "Dump" to "GetAll"
Browse files Browse the repository at this point in the history
  • Loading branch information
sakateka committed Nov 28, 2017
1 parent e2a30da commit 6eef1fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions json.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// MarshalJSON returns a byte slice containing a JSON representation of all
// the metrics in the Registry.
func (r *StandardRegistry) MarshalJSON() ([]byte, error) {
return json.Marshal(r.Dump())
return json.Marshal(r.GetAll())
}

// WriteJSON writes metrics from the given registry periodically to the
Expand All @@ -27,5 +27,5 @@ func WriteJSONOnce(r Registry, w io.Writer) {
}

func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) {
return json.Marshal(p.Dump())
return json.Marshal(p.GetAll())
}
16 changes: 8 additions & 8 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type Registry interface {
// Get the metric by the given name or nil if none is registered.
Get(string) interface{}

// GetAll metrics in the Registry.
GetAll() map[string]map[string]interface{}

// Gets an existing metric or registers the given one.
// The interface can be the metric to register if not found in registry,
// or a function returning the metric for lazy instantiation.
Expand All @@ -40,9 +43,6 @@ type Registry interface {
// Run all registered healthchecks.
RunHealthchecks()

// Dump all metrics.
Dump() map[string]map[string]interface{}

// Unregister the metric with the given name.
Unregister(string)

Expand Down Expand Up @@ -112,8 +112,8 @@ func (r *StandardRegistry) RunHealthchecks() {
}
}

// Dump all the metrics in the Registry
func (r *StandardRegistry) Dump() map[string]map[string]interface{} {
// GetAll metrics in the Registry
func (r *StandardRegistry) GetAll() map[string]map[string]interface{} {
data := make(map[string]map[string]interface{})
r.Each(func(name string, i interface{}) {
values := make(map[string]interface{})
Expand Down Expand Up @@ -280,9 +280,9 @@ func (r *PrefixedRegistry) RunHealthchecks() {
r.underlying.RunHealthchecks()
}

// Dump all the metrics in the Registry
func (r *PrefixedRegistry) Dump() map[string]map[string]interface{} {
return r.underlying.Dump()
// GetAll metrics in the Registry
func (r *PrefixedRegistry) GetAll() map[string]map[string]interface{} {
return r.underlying.GetAll()
}

// Unregister the metric with the given name. The name will be prefixed.
Expand Down

0 comments on commit 6eef1fc

Please sign in to comment.