Skip to content

Latest commit

 

History

History
122 lines (88 loc) · 3.47 KB

README.md

File metadata and controls

122 lines (88 loc) · 3.47 KB

A Go ingestion client for Quickwit

tag Go Version GoDoc Build Status Go report Coverage Contributors License

A Quickwit push client for Go. See slog-quickwit for a slog handler implementation.

If you're looking for a search library or Quickwit management interface, check the official library.

🚀 Install

go get github.com/samber/go-quickwit

This library is v0 and follows SemVer strictly. Some breaking changes might be made to exported APIs before v1.0.0.

💡 Spec

GoDoc: https://pkg.go.dev/github.com/samber/go-quickwit

type Config struct {
	URL    string
	Client http.Client

	BatchWait  time.Duration
	BatchBytes int
	Commit     CommitMode   // either quickwit.Auto, quickwit.WaitFor or quickwit.Force

	BackoffConfig BackoffConfig
	Timeout       time.Duration
}

type BackoffConfig struct {
	// start backoff at this level
	MinBackoff time.Duration
	// increase exponentially to this level
	MaxBackoff time.Duration
	// give up after this many; zero means infinite retries
	MaxRetries int
}

Example

First, start Quickwit:

docker-compose up -d
curl -X POST \
    'http://localhost:7280/api/v1/indexes' \
    -H 'Content-Type: application/yaml' \
    --data-binary @test-config.yaml

Then push logs:

import "github.com/samber/go-quickwit"

func main() {
	client := quickwit.NewWithDefault("http://localhost:7280")
	defer client.Stop() // flush and stop

	for i := 0; i < 10; i++ {
		client.Push(map[string]any{
			"timestamp": time.Now().Unix(),
			"message":   fmt.Sprintf("hello %d", i),
		})
		time.Sleep(1 * time.Second)
	}
}

🤝 Contributing

Don't hesitate ;)

# start quickwit
docker-compose up -d
curl -X POST \
    'http://localhost:7280/api/v1/indexes' \
    -H 'Content-Type: application/yaml' \
    --data-binary @test-config.yaml

# Install some dev dependencies
make tools

# Run tests
make test
# or
make watch-test

👤 Contributors

Contributors

💫 Show your support

Give a ⭐️ if this project helped you!

GitHub Sponsors

📝 License

Copyright © 2024 Samuel Berthe.

This project is MIT licensed.