Skip to content

blaargh/go-quickwit

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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.

About

๐Ÿฑ A Go ingestion client for Quickwit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 89.4%
  • Makefile 10.6%