github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/parser/parser.go (about) 1 // Package parser deals with parsing various incoming formats 2 package parser 3 4 import ( 5 "context" 6 7 "github.com/sirupsen/logrus" 8 9 "github.com/pyroscope-io/pyroscope/pkg/ingestion" 10 "github.com/pyroscope-io/pyroscope/pkg/storage" 11 ) 12 13 type Parser struct { 14 log *logrus.Logger 15 putter storage.Putter 16 exporter storage.MetricsExporter 17 } 18 19 func New(log *logrus.Logger, s storage.Putter, exporter storage.MetricsExporter) *Parser { 20 return &Parser{ 21 log: log, 22 putter: s, 23 exporter: exporter, 24 } 25 } 26 27 func (p *Parser) Ingest(ctx context.Context, in *ingestion.IngestInput) error { 28 updateMetrics(in) 29 return in.Profile.Parse(ctx, p.putter, p.exporter, in.Metadata) 30 }