Skip to content

Commit

Permalink
signal when ready
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Jul 13, 2024
1 parent d0c2a12 commit f9e8d61
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func newMetrics(db *metrics.Store) *Metrics {

func (m *Metrics) Start(ctx context.Context) {
slog.Info("starting metrics processing loop")
start := true
for {
select {
case <-ctx.Done():
Expand All @@ -60,10 +61,19 @@ func (m *Metrics) Start(ctx context.Context) {
if err != nil {
slog.Error("failed saving metrics sample", "err", err)
}
if start {
start = false
slog.Info("ready to start querying")
}
}
}
}

func (m *Metrics) Export(_ context.Context, req pmetricotlp.ExportRequest) (pmetricotlp.ExportResponse, error) {
m.buffer <- &req
return pmetricotlp.NewExportResponse(), nil
}

func Main() *cli.Command {
return &cli.Command{
Name: "frieren",
Expand Down

0 comments on commit f9e8d61

Please sign in to comment.