github.com/yandex/pandora@v0.5.32/core/aggregator/discard.go (about)

     1  package aggregator
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/yandex/pandora/core"
     7  	"github.com/yandex/pandora/core/coreutil"
     8  )
     9  
    10  // NewDiscard returns Aggregator that just throws reported ammo away.
    11  func NewDiscard() core.Aggregator {
    12  	return discard{}
    13  }
    14  
    15  type discard struct{}
    16  
    17  func (discard) Run(ctx context.Context, _ core.AggregatorDeps) error {
    18  	<-ctx.Done()
    19  	return nil
    20  }
    21  
    22  func (discard) Report(s core.Sample) {
    23  	coreutil.ReturnSampleIfBorrowed(s)
    24  }