anz-bank / pkg

Common ANZ Go packages
https://pkg.go.dev/github.com/anz-bank/pkg
Apache License 2.0
1 stars 9 forks source link

health: Add OpenCensus provider for health state #58

Closed camscale closed 4 years ago

camscale commented 4 years ago

Add an ochealth package that adds a producer to the OpenCensus producer global manager so that a health server's state can be exported as metrics. Export the healthData struct as State to support this.

Also add an IsHealthEndpoint() function that can be used with the OpenCensus ochttp plugin for collecting http server stats and injecting trace headers so that it ignores requests to the health endpoints and does not accumulate stats or traces on them.