mox/vendor/github.com/mjl-/sherpa/collector.go
Mechiel Lukkien cb229cb6cf
mox!
2023-01-30 14:27:06 +01:00

21 lines
1.1 KiB
Go

package sherpa
// Collector facilitates collection of metrics. Functions are called by the library as such events or errors occur.
// See https://github.com/irias/sherpa-prometheus-collector for an implementation for prometheus.
type Collector interface {
ProtocolError() // Invalid request at protocol-level, e.g. wrong mimetype or request body.
BadFunction() // Function does not exist.
JavaScript() // Sherpa.js is requested.
JSON() // Sherpa.json is requested.
// Call of function, how long it took, and in case of failure, the error code.
FunctionCall(name string, durationSec float64, errorCode string)
}
type ignoreCollector struct{}
func (ignoreCollector) ProtocolError() {}
func (ignoreCollector) BadFunction() {}
func (ignoreCollector) JavaScript() {}
func (ignoreCollector) JSON() {}
func (ignoreCollector) FunctionCall(name string, durationSec float64, errorCode string) {}