Documentation ¶
Index ¶
- Constants
- Variables
- func CloseWatcher(ctx context.Context, w http.ResponseWriter) (<-chan bool, <-chan bool)
- func Error(w http.ResponseWriter, err error, code int)
- func IsInvalidParams(err error) bool
- func NewSearchHandler(storage storage.Storage) http.Handler
- func WriteJSONResponse(w http.ResponseWriter, data interface{}, logger *zap.Logger)
- func WriteProtoMsgJSONResponse(w http.ResponseWriter, data proto.Message, logger *zap.Logger)
- func WriteUninitializedResponse(w http.ResponseWriter, logger *zap.Logger)
- type ParseError
- type SearchHandler
Constants ¶
const ( // WarningsHeader is the M3 warnings header when to display a warning to a user WarningsHeader = "M3-Warnings" // RetryHeader is the M3 retry header to display when it is safe to retry RetryHeader = "M3-Retry" // ServedByHeader is the M3 query storage execution breakdown ServedByHeader = "M3-Storage-By" // DeprecatedHeader is the M3 deprecated header DeprecatedHeader = "M3-Deprecated" )
const (
// SearchURL is the url to search for metric ids
SearchURL = "/search"
)
Variables ¶
var ( // ErrInvalidParams is returned when input parameters are invalid ErrInvalidParams = errors.New("invalid request params") )
Functions ¶
func CloseWatcher ¶
CloseWatcher watches for CloseNotify and context timeout. It is best effort and may sometimes not close the channel relying on gc
func IsInvalidParams ¶
IsInvalidParams returns true if this is an invalid params error
func NewSearchHandler ¶
NewSearchHandler returns a new instance of handler
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, data interface{}, logger *zap.Logger)
WriteJSONResponse writes generic data to the ResponseWriter
func WriteProtoMsgJSONResponse ¶
WriteProtoMsgJSONResponse writes a protobuf message to the ResponseWriter. This uses jsonpb for json marshalling, which encodes fields with default values, even with the omitempty tag.
func WriteUninitializedResponse ¶
func WriteUninitializedResponse(w http.ResponseWriter, logger *zap.Logger)
WriteUninitializedResponse writes a protobuf message to the ResponseWriter
Types ¶
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
ParseError is the error from parsing requests
func NewParseError ¶
func NewParseError(inner error, code int) *ParseError
NewParseError creates a new parse error
type SearchHandler ¶
type SearchHandler struct {
// contains filtered or unexported fields
}
SearchHandler represents a handler for the search endpoint
func (*SearchHandler) ServeHTTP ¶
func (h *SearchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)