Documentation ¶
Index ¶
- Constants
- Variables
- func Init()
- func IsEnableRateLimit() bool
- func SetEnableEventSchemasFeature(b bool) bool
- func SetEnableRateLimit(b bool) bool
- func SetEnableSuppressUserFeature(b bool) bool
- func WithContentType(contentType string, delegate http.HandlerFunc) http.HandlerFunc
- type HandleT
- func (*HandleT) GetWebhookSourceDefName(writeKey string) (name string, ok bool)
- func (gateway *HandleT) IncrementAckCount(count uint64)
- func (gateway *HandleT) IncrementRecvCount(count uint64)
- func (*HandleT) MaxReqSize() int
- func (gateway *HandleT) NewSourceStat(writeKey, reqType string) *gwstats.SourceStat
- func (gateway *HandleT) ProcessWebRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, ...) string
- func (gateway *HandleT) Setup(ctx context.Context, application app.App, ...) error
- func (gateway *HandleT) Shutdown() error
- func (gateway *HandleT) StartAdminHandler(ctx context.Context) error
- func (gateway *HandleT) StartWebHandler(ctx context.Context) error
- func (gateway *HandleT) TrackRequestMetrics(errorMessage string)
- type ImportRequestHandler
- type RegularRequestHandler
- type RequestHandler
Constants ¶
const (
DELIMITER = string("<<>>")
)
Variables ¶
var ( ReadTimeout time.Duration ReadHeaderTimeout time.Duration WriteTimeout time.Duration IdleTimeout time.Duration Diagnostics diagnostics.DiagnosticsI )
var BatchEvent = []byte(`
{
"batch": [
]
}
`)
var CustomVal string
CustomVal is used as a key in the jobsDB customval column
Functions ¶
func IsEnableRateLimit ¶ added in v0.1.10
func IsEnableRateLimit() bool
IsEnableRateLimit is true if rate limiting is enabled on gateway
func SetEnableEventSchemasFeature ¶ added in v0.1.10
SetEnableEventSchemasFeature overrides enableEventSchemasFeature configuration and returns previous value
func SetEnableRateLimit ¶ added in v0.1.10
SetEnableRateLimit overrides enableRateLimit configuration and returns previous value
func SetEnableSuppressUserFeature ¶ added in v0.1.10
SetEnableSuppressUserFeature overrides enableSuppressUserFeature configuration and returns previous value
func WithContentType ¶ added in v1.2.0
func WithContentType(contentType string, delegate http.HandlerFunc) http.HandlerFunc
Types ¶
type HandleT ¶
type HandleT struct {
// contains filtered or unexported fields
}
HandleT is the struct returned by the Setup call
func (*HandleT) GetWebhookSourceDefName ¶ added in v0.1.10
GetWebhookSourceDefName returns the webhook source definition name by write key
func (*HandleT) IncrementAckCount ¶ added in v0.1.10
IncrementAckCount increments the acknowledged count for gateway requests
func (*HandleT) IncrementRecvCount ¶ added in v0.1.10
IncrementRecvCount increments the received count for gateway requests
func (*HandleT) MaxReqSize ¶ added in v0.1.10
MaxReqSize is the maximum request body size, in bytes, accepted by gateway web handlers
func (*HandleT) NewSourceStat ¶ added in v1.5.0
func (gateway *HandleT) NewSourceStat(writeKey, reqType string) *gwstats.SourceStat
func (*HandleT) ProcessWebRequest ¶ added in v0.1.10
func (gateway *HandleT) ProcessWebRequest(w *http.ResponseWriter, r *http.Request, reqType string, payload []byte, writeKey string) string
ProcessWebRequest is an Interface wrapper for webhook
func (*HandleT) Setup ¶
func (gateway *HandleT) Setup( ctx context.Context, application app.App, backendConfig backendconfig.BackendConfig, jobsDB 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 (*HandleT) StartAdminHandler ¶ added in v0.1.10
StartAdminHandler for Admin Operations
func (*HandleT) StartWebHandler ¶ added in v0.1.10
StartWebHandler starts all gateway web handlers, listening on gateway port. Supports CORS from all origins. This function will block.
func (*HandleT) TrackRequestMetrics ¶ added in v0.1.10
TrackRequestMetrics provides access to add request success/failure telemetry
type ImportRequestHandler ¶ added in v0.1.10
type ImportRequestHandler struct{}
ImportRequestHandler is an empty struct to capture import specific request handling functionality
func (*ImportRequestHandler) ProcessRequest ¶ added in v0.1.10
func (*ImportRequestHandler) ProcessRequest(gateway *HandleT, 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{}
RegularRequestHandler is an empty struct to capture non-import specific request handling functionality
func (*RegularRequestHandler) ProcessRequest ¶ added in v0.1.10
func (*RegularRequestHandler) ProcessRequest(gateway *HandleT, 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(gateway *HandleT, 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