Documentation ¶
Index ¶
- Constants
- Variables
- func CloseWatcher(ctx context.Context, w http.ResponseWriter) (<-chan bool, <-chan bool)
- func DurationToNanosBytes(r io.Reader) ([]byte, error)
- func DurationToNanosMap(input map[string]interface{}) (map[string]interface{}, error)
- 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 HeaderKeyType
- 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" // SearchHTTPMethod is the HTTP method used with this resource. SearchHTTPMethod = http.MethodPost )
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 DurationToNanosBytes ¶
DurationToNanosBytes transforms a json byte slice with Duration keys into Nanos
func DurationToNanosMap ¶
DurationToNanosMap transforms keys with a Duration into Nanos
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 HeaderKeyType ¶ added in v0.4.5
type HeaderKeyType int
HeaderKeyType is the type for the header key
const ( // RoutePrefixV1 is the v1 prefix for all coordinator routes RoutePrefixV1 = "/api/v1" // HeaderKey is the key which headers will be added to in the request context HeaderKey HeaderKeyType = iota )
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)