Skip to content

botastic/keel

 
 

Repository files navigation

keel

Go Report Card godoc GitHub Super-Linter

Opinionated way to run services.

Stack

  • Metrics: Prometheus
  • Logging: Zap
  • Telemetry: Open Telemetry
  • Configuration: Viper

Example

package main

import (
	"net/http"
	"os"

	"github.com/foomo/keel"
	"github.com/foomo/keel/log"
)

func main() {
	svr := keel.NewServer()

	l := svr.Logger()

	// add zap service listening on localhost:9100
	// allows you to view / change the log level: GET / PUT localhost:9100/log
	svr.AddServices(keel.NewDefaultServiceHTTPZap())

	// add viper service listening on localhost:9300
	// allows you to view / change the configuration: GET / PUT localhost:9300/config
	svr.AddServices(keel.NewDefaultServiceHTTPViper())

	// add prometheus service listening on 0.0.0.0:9200
	// allows you to collect prometheus metrics: GET 0.0.0.0:9200/metrics
	svr.AddServices(keel.NewDefaultServiceHTTPPrometheus())

	svr.AddService(
		keel.NewServiceHTTP(log.WithServiceName(l, "demo"), ":8080", newService()),
	)

	svr.Run()
}

func newService() *http.ServeMux {
	s := http.NewServeMux()
	s.HandleFunc("/panic", func(w http.ResponseWriter, r *http.Request) {
		panic("exiting")
	})
	s.HandleFunc("/exit", func(w http.ResponseWriter, r *http.Request) {
		os.Exit(1)
	})
	return s
}

How to Contribute

Make a pull request...

License

Distributed under MIT License, please see license file within the code for more details.

About

Opinionated go micro services.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Go 97.8%
  • Makefile 2.2%