This metrics client provides io.Writer
interface which writes documents to ZincSearch
service.
go get github.com/PauliusLozys/zincsearch-metrics-client
func main() {
w, err := zincmetric.New("http://localhost:4080", "admin", "admin", "test-service")
if err != nil {
panic(err)
}
defer w.Close()
jsonLogger := slog.NewJSONHandler(w, nil)
slog.SetDefault(slog.New(jsonLogger))
slog.Info("test")
slog.Info("test2")
slog.Info("test3")
}
Custom HTTP client can be passed using WithHttpClient
Custom metrics flush interval to ZincSearch
service can be passed using WithFlushDuration
(default: time.Second)