// GetMetrics returns json from encoded metrics
GetMetrics returns json from encoded metrics
// GetMetrics returns json from encoded metrics
func (c *SimpleCollector) GetMetrics(key string) ([]byte, error) {
	c.mu.RLock()
	defer c.mu.RUnlock()
	m, ok := c.metrics[key]
	if !ok {
		return nil, ErrNotFoundMetrics
	}
	switch m := m.(type) {
	case *HistogramMetrics:
		return m.MarshalJSONWithOrder()
	default:
		return json.Marshal(m.Aggregate())
	}
}
func ( c * SimpleCollector ) GetMetrics ( key string ) ( [ ] byte , error ) { c . mu . RLock ( ) defer c . mu . RUnlock ( ) m , ok := c . metrics [ key ] if ! ok { return nil , ErrNotFoundMetrics } switch m := m . ( type ) { case * HistogramMetrics : return m . MarshalJSONWithOrder ( ) default : return json . Marshal ( m . Aggregate ( ) ) } }
GetMetrics returns json from encoded metrics
GetMetrics returns json from encoded metrics
// need sort keys?