Skip to content

Commit

Permalink
feat: create ingest limits service
Browse files Browse the repository at this point in the history
  • Loading branch information
grobinson-grafana committed Jan 9, 2025
1 parent 70d8206 commit ac85ade
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/limits/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package limits

type Config struct {
}
37 changes: 37 additions & 0 deletions pkg/limits/limiter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package limits

import (
"context"

"github.com/go-kit/log"
"github.com/grafana/dskit/services"
"github.com/prometheus/client_golang/prometheus"
)

type IngestLimiter struct {
cfg Config
logger log.Logger

services.Service
}

func New(cfg Config, logger log.Logger, r prometheus.Registerer) (*IngestLimiter, error) {

Check warning on line 18 in pkg/limits/limiter.go

View workflow job for this annotation

GitHub Actions / check / golangciLint

unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
l := &IngestLimiter{
cfg: cfg,
logger: logger,
}
l.Service = services.NewBasicService(l.starting, l.running, l.stopping)
return l, nil
}

func (l *IngestLimiter) starting(ctx context.Context) error {

Check warning on line 27 in pkg/limits/limiter.go

View workflow job for this annotation

GitHub Actions / check / golangciLint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
return nil
}

func (l *IngestLimiter) running(ctx context.Context) error {

Check warning on line 31 in pkg/limits/limiter.go

View workflow job for this annotation

GitHub Actions / check / golangciLint

unused-parameter: parameter 'ctx' seems to be unused, consider removing or renaming it as _ (revive)
return nil
}

func (l *IngestLimiter) stopping(_ error) error {
return nil
}

0 comments on commit ac85ade

Please sign in to comment.