Documentation ¶
Index ¶
- func WithContentType(contentType string, delegate http.HandlerFunc) http.HandlerFunc
- type Handle
- func (gateway *Handle) GetWebhookSourceDefName(writeKey string) (name string, ok bool)
- func (gateway *Handle) IncrementAckCount(count uint64)
- func (gateway *Handle) IncrementRecvCount(count uint64)
- func (gateway *Handle) NewSourceStat(writeKey, reqType string) *gwstats.SourceStat
- func (gateway *Handle) ProcessWebRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, ...) string
- func (gateway *Handle) SaveWebhookFailures(reqs []*model.FailedWebhookPayload) error
- func (gateway *Handle) Setup(ctx context.Context, config *config.Config, logger logger.Logger, ...) error
- func (gateway *Handle) Shutdown() error
- func (gateway *Handle) StartAdminHandler(ctx context.Context) error
- func (gateway *Handle) StartWebHandler(ctx context.Context) error
- func (gateway *Handle) TrackRequestMetrics(errorMessage string)
- type ImportRequestHandler
- type RegularRequestHandler
- type RequestHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithContentType ¶ added in v1.2.0
func WithContentType(contentType string, delegate http.HandlerFunc) http.HandlerFunc
Types ¶
type Handle ¶ added in v1.12.0
type Handle struct {
// contains filtered or unexported fields
}
func (*Handle) GetWebhookSourceDefName ¶ added in v1.12.0
GetWebhookSourceDefName returns the webhook source definition name by write key
func (*Handle) IncrementAckCount ¶ added in v1.12.0
IncrementAckCount increments the acknowledged count for gateway requests
func (*Handle) IncrementRecvCount ¶ added in v1.12.0
IncrementRecvCount increments the received count for gateway requests
func (*Handle) NewSourceStat ¶ added in v1.12.0
func (gateway *Handle) NewSourceStat(writeKey, reqType string) *gwstats.SourceStat
func (*Handle) ProcessWebRequest ¶ added in v1.12.0
func (gateway *Handle) ProcessWebRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, writeKey string) string
ProcessWebRequest is an interface wrapper for webhook
func (*Handle) SaveWebhookFailures ¶ added in v1.12.0
func (gateway *Handle) SaveWebhookFailures(reqs []*model.FailedWebhookPayload) error
SaveErrors saves errors to the error db
func (*Handle) Setup ¶ added in v1.12.0
func (gateway *Handle) Setup( ctx context.Context, config *config.Config, logger logger.Logger, stat stats.Stats, application app.App, backendConfig backendconfig.BackendConfig, jobsDB, errDB jobsdb.JobsDB, rateLimiter throttler.Throttler, versionHandler func(w http.ResponseWriter, r *http.Request), rsourcesService rsources.JobService, sourcehandle sourcedebugger.SourceDebugger, ) error
Setup initializes this module: - Monitors backend config for changes. - Starts web request batching goroutine, that batches incoming messages. - Starts web request batch db writer goroutine, that writes incoming batches to JobsDB. - Starts debugging goroutine that prints gateway stats.
This function will block until backend config is initially received.
func (*Handle) StartAdminHandler ¶ added in v1.12.0
StartAdminHandler for Admin Operations
func (*Handle) StartWebHandler ¶ added in v1.12.0
StartWebHandler starts all gateway web handlers, listening on gateway port. Supports CORS from all origins. This function will block.
func (*Handle) TrackRequestMetrics ¶ added in v1.12.0
TrackRequestMetrics updates the track counters (success and failure counts)
type ImportRequestHandler ¶ added in v0.1.10
type ImportRequestHandler struct {
*Handle
}
ImportRequestHandler is an empty struct to capture import specific request handling functionality
func (*ImportRequestHandler) ProcessRequest ¶ added in v0.1.10
func (irh *ImportRequestHandler) ProcessRequest(w *http.ResponseWriter, r *http.Request, _ string, payload []byte, writeKey string) string
ProcessRequest on ImportRequestHandler splits payload by user and throws them into the webrequestQ and waits for all their responses before returning
type RegularRequestHandler ¶ added in v0.1.10
type RegularRequestHandler struct {
*Handle
}
RegularRequestHandler is an empty struct to capture non-import specific request handling functionality
func (*RegularRequestHandler) ProcessRequest ¶ added in v0.1.10
func (rrh *RegularRequestHandler) ProcessRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, writeKey string) string
ProcessRequest throws a webRequest into the queue and waits for the response before returning
type RequestHandler ¶ added in v0.1.10
type RequestHandler interface {
ProcessRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, writeKey string) string
}
RequestHandler interface for abstracting out server-side import request processing and rest of the calls