code: func NewAggMetric(store Store, cachePusher cache.CachePusher, key schema.AMKey, retentions conf.Retentions, reorderWindow, interval uint32, agg *conf.Aggregation, dropFirstChunk bool) *AggMetric {
  
  	// note: during parsing of retentions, we assure there's at least 1.
  	ret := retentions[0]
  
  	m := AggMetric{
  		cachePusher:    cachePusher,
  		store:          store,
  		key:            key,
  		chunkSpan:      ret.ChunkSpan,
  		numChunks:      ret.NumChunks,
  		chunks:         make([]*chunk.Chunk, 0, ret.NumChunks),
  		dropFirstChunk: dropFirstChunk,
  		ttl:            uint32(ret.MaxRetention()),
  		// we set LastWrite here to make sure a new Chunk doesn't get immediately
  		// garbage collected right after creating it, before we can push to it.
  		lastWrite: uint32(time.Now().Unix()),
  	}
  	if reorderWindow != 0 {
  		m.rob = NewReorderBuffer(reorderWindow, interval)
  	}
  
  	for _, ret := range retentions[1:] {
  		m.aggregators = append(m.aggregators, NewAggregator(store, cachePusher, key, ret, *agg, dropFirstChunk))
  	}
  
  	return &m
  }
docs: // NewAggMetric creates a metric with given key, it retains the given number of chunks each chunkSpan seconds long
  // it optionally also creates aggregations with the given settings
  // the 0th retention is the native archive of this metric. if there's several others, we create aggregators, using agg.
  // it's the callers responsibility to make sure agg is not nil in that case!