callbacks service draft
This commit is contained in:
36
api/edge/callbacks/internal/ops/module.go
Normal file
36
api/edge/callbacks/internal/ops/module.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package ops
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/tech/sendico/pkg/api/routers/health"
|
||||
"github.com/tech/sendico/pkg/mlogger"
|
||||
)
|
||||
|
||||
// Observer records service metrics.
|
||||
type Observer interface {
|
||||
ObserveIngest(result string, duration time.Duration)
|
||||
ObserveDelivery(result string, statusCode int, duration time.Duration)
|
||||
}
|
||||
|
||||
// HTTPServer exposes /metrics and /health.
|
||||
type HTTPServer interface {
|
||||
SetStatus(status health.ServiceStatus)
|
||||
Close(ctx context.Context)
|
||||
}
|
||||
|
||||
// HTTPServerConfig configures observability endpoint.
|
||||
type HTTPServerConfig struct {
|
||||
Address string
|
||||
}
|
||||
|
||||
// NewObserver creates process metrics observer.
|
||||
func NewObserver() Observer {
|
||||
return newObserver()
|
||||
}
|
||||
|
||||
// NewHTTPServer creates observability HTTP server.
|
||||
func NewHTTPServer(logger mlogger.Logger, cfg HTTPServerConfig) (HTTPServer, error) {
|
||||
return newHTTPServer(logger, cfg)
|
||||
}
|
||||
Reference in New Issue
Block a user