Documentation ¶
Index ¶
- type EdgeLoggers
- type RequestContext
- type SpadeHandler
- func (s *SpadeHandler) ExtractEvent(r *http.Request, values url.Values, context *RequestContext, ...) (*spade.Event, int)
- func (s *SpadeHandler) RequestSetup(w http.ResponseWriter, r *http.Request) *RequestContext
- func (s *SpadeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *SpadeHandler) WriteCrossDomainPolicy(w http.ResponseWriter) int
- func (s *SpadeHandler) WriteRobotsTxt(w http.ResponseWriter) int
- type TimerInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EdgeLoggers ¶
type EdgeLoggers struct { sync.WaitGroup S3EventLogger loggers.SpadeEdgeLogger KinesisEventLogger loggers.SpadeEdgeLogger // contains filtered or unexported fields }
EdgeLoggers represent the different kind of loggers for Spade events
func NewEdgeLoggers ¶
func NewEdgeLoggers() *EdgeLoggers
NewEdgeLoggers returns a new instance of an EdgeLoggers struct pre-filled wuth UndefinedLogger logger instances
type RequestContext ¶
type RequestContext struct { Now time.Time Method string IPHeader string Endpoint string Timers map[string]time.Duration FailedLoggers []string Status int BadClient bool }
RequestContext is contextual information for a request.
func (*RequestContext) RecordLoggerAttempt ¶
func (r *RequestContext) RecordLoggerAttempt(err error, name string)
RecordLoggerAttempt records failed logging attempts for later reporting.
func (*RequestContext) RecordStats ¶
func (r *RequestContext) RecordStats(statter statsd.StatSender)
RecordStats sends the request's stats to the statter.
type SpadeHandler ¶
type SpadeHandler struct { StatLogger statsd.StatSender EdgeLoggers *EdgeLoggers Time func() time.Time // Defaults to time.Now EdgeType string // contains filtered or unexported fields }
SpadeHandler handles http requests and forwards them to the EdgeLoggers
func NewSpadeHandler ¶
func NewSpadeHandler(stats statsd.StatSender, loggers *EdgeLoggers, instanceID string, CORSOrigins []string, eventInURISamplingRate float32, crossDomainPolicy string, edgeType string, handleLargeEvents bool) *SpadeHandler
NewSpadeHandler returns a new instance of SpadeHandler
func (*SpadeHandler) ExtractEvent ¶
func (s *SpadeHandler) ExtractEvent(r *http.Request, values url.Values, context *RequestContext, statTimer *TimerInstance) (*spade.Event, int)
ExtractEvent returns the spade Event from the request or splits the request and writes out each event.
func (*SpadeHandler) RequestSetup ¶
func (s *SpadeHandler) RequestSetup(w http.ResponseWriter, r *http.Request) *RequestContext
RequestSetup initializes a Request, writing headers and returning a RequestContext.
func (*SpadeHandler) ServeHTTP ¶
func (s *SpadeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP services an HTTP request.
func (*SpadeHandler) WriteCrossDomainPolicy ¶
func (s *SpadeHandler) WriteCrossDomainPolicy(w http.ResponseWriter) int
WriteCrossDomainPolicy writes the handler's cross-domain policy to the writer.
func (*SpadeHandler) WriteRobotsTxt ¶
func (s *SpadeHandler) WriteRobotsTxt(w http.ResponseWriter) int
WriteRobotsTxt writes the handler's robot policy to the writer.
type TimerInstance ¶
type TimerInstance struct {
// contains filtered or unexported fields
}
TimerInstance returns the time since the start or last time it was stopped.
func NewTimerInstance ¶
func NewTimerInstance() *TimerInstance
NewTimerInstance builds a TimerInstance.
func (*TimerInstance) StopTiming ¶
func (t *TimerInstance) StopTiming() (r time.Duration)
StopTiming returns the time since start/the last StopTiming call and starts a new timer.