Skip to content

Commit

Permalink
feat: option to send tenant id in generator
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorwhitney committed Jan 10, 2025
1 parent c435654 commit fa3ceb4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
func main() {
url := flag.String("url", "http://localhost:3100/loki/api/v1/push", "Loki URL")
dry := flag.Bool("dry", false, "Dry run: log to stdout instead of Loki")
tenantId := flag.String("tenant-id", "", "Loki tenant ID")
flag.Parse()

cfg, err := loki.NewDefaultConfig(*url)
Expand All @@ -27,6 +28,11 @@ func main() {
cfg.BackoffConfig.MaxRetries = 1
cfg.BackoffConfig.MinBackoff = 100 * time.Millisecond
cfg.BackoffConfig.MaxBackoff = 100 * time.Millisecond

if *tenantId != "" {
cfg.TenantID = *tenantId
}

client, err := loki.New(cfg)
if err != nil {
panic(err)
Expand Down

0 comments on commit fa3ceb4

Please sign in to comment.