WriteJSONOnce writes metrics from the given registry to the specified io.Writer as JSON.
(r Registry, w io.Writer)
| 23 | // WriteJSONOnce writes metrics from the given registry to the specified |
| 24 | // io.Writer as JSON. |
| 25 | func WriteJSONOnce(r Registry, w io.Writer) { |
| 26 | json.NewEncoder(w).Encode(r) |
| 27 | } |
| 28 | |
| 29 | func (p *PrefixedRegistry) MarshalJSON() ([]byte, error) { |
| 30 | return json.Marshal(p.GetAll()) |