Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/utilitywarehouse/go-operational
https://github.com/utilitywarehouse/go-operational
golang shared-library
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/utilitywarehouse/go-operational
- Owner: utilitywarehouse
- License: mit
- Created: 2016-12-01T10:34:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-13T15:33:04.000Z (7 months ago)
- Last Synced: 2024-12-21T22:33:13.951Z (12 days ago)
- Topics: golang, shared-library
- Language: Go
- Size: 79.1 KB
- Stars: 3
- Watchers: 24
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-operational
==============Go implementation of [operational-endpoints-spec](https://github.com/utilitywarehouse/operational-endpoints-spec) making it easy to add the standard endpoints to your application
Installation
------------`go get github.com/utilitywarehouse/go-operational/op`
Example
-------```
package mainimport (
"net/http""github.com/prometheus/client_golang/prometheus"
"github.com/utilitywarehouse/go-operational/op"
)func main() {
dm := prometheus.NewCounter(prometheus.CounterOpts{
Name: "dummy_metric",
Help: "Dummy counter",
})
http.Handle("/__/", op.NewHandler(
op.NewStatus("My application", "application that does stuff").
AddOwner("team x", "#team-x").
SetRevision("7470d3dc24ce7876a9fc53ca7934401273a4017a").
AddChecker("db check", func(cr *op.CheckResponse) { cr.Healthy("dummy db connection check succeesed") }).
AddMetrics(dm).
ReadyUseHealthCheck(),
),
)http.ListenAndServe(":8080", nil)
}
```PPROF
-------
By default go operational will bind PPROFs handlers to the path `/__/extended/pprof/`
We also overload the default mux in order to stop the handlers binding to the default paths.