handler

package
v0.9.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 13 Imported by: 35

Documentation

Index

Constants

View Source
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"

	// LimitMaxSeriesHeader is the M3 limit timeseries header that limits
	// the number of time series returned by each storage node.
	LimitMaxSeriesHeader = "M3-Limit-Max-Series"

	// DefaultServiceEnvironment is the default service ID environment.
	DefaultServiceEnvironment = "default_env"
	// DefaultServiceZone is the default service ID zone.
	DefaultServiceZone = "embedded"

	// HeaderClusterEnvironmentName is the header used to specify the environment
	// name.
	HeaderClusterEnvironmentName = "Cluster-Environment-Name"
	// HeaderClusterZoneName is the header used to specify the zone name.
	HeaderClusterZoneName = "Cluster-Zone-Name"
	// HeaderDryRun is the header used to specify whether this should be a dry
	// run.
	HeaderDryRun = "Dry-Run"
)
View Source
const (
	// M3DBServiceName is the service name for M3DB.
	M3DBServiceName = "m3db"
	// M3AggregatorServiceName is the service name for M3Aggregator.
	M3AggregatorServiceName = "m3aggregator"
	// M3CoordinatorServiceName is the service name for M3Coordinator.
	M3CoordinatorServiceName = "m3coordinator"
)
View Source
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

This section is empty.

Functions

func AllowedServices added in v0.7.0

func AllowedServices() []string

AllowedServices returns the list of valid M3 services.

func CloseWatcher

func CloseWatcher(ctx context.Context, cancel context.CancelFunc, w http.ResponseWriter)

CloseWatcher watches for CloseNotify and context timeout. It is best effort and may sometimes not close the channel relying on gc

func IsAllowedService added in v0.7.0

func IsAllowedService(svc string) bool

IsAllowedService returns whether a service name is a valid M3 service.

func NewSearchHandler

func NewSearchHandler(
	storage storage.Storage,
	fetchOptionsBuilder FetchOptionsBuilder,
) http.Handler

NewSearchHandler returns a new instance of handler

Types

type FetchOptionsBuilder added in v0.9.2

type FetchOptionsBuilder interface {
	NewFetchOptions(req *http.Request) (*storage.FetchOptions, *xhttp.ParseError)
}

FetchOptionsBuilder builds fetch options based on a request and default config.

func NewFetchOptionsBuilder added in v0.9.2

func NewFetchOptionsBuilder(
	opts FetchOptionsBuilderOptions,
) FetchOptionsBuilder

NewFetchOptionsBuilder returns a new fetch options builder.

type FetchOptionsBuilderOptions added in v0.9.2

type FetchOptionsBuilderOptions struct {
	Limit int
}

FetchOptionsBuilderOptions provides options to use when creating a fetch options builder.

type HeaderKeyType added in v0.4.5

type HeaderKeyType int

HeaderKeyType is the type for the header key

const (
	// HeaderKey is the key which headers will be added to in the request context
	HeaderKey HeaderKeyType = iota

	// RoutePrefixV1 is the v1 prefix for all coordinator routes
	RoutePrefixV1 = "/api/v1"
)

type M3AggServiceOptions added in v0.7.0

type M3AggServiceOptions struct {
	MaxAggregationWindowSize time.Duration
	WarmupDuration           time.Duration
}

M3AggServiceOptions contains the service options that are specific to the M3Agg service.

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)

type ServiceOptions added in v0.7.0

type ServiceOptions struct {
	ServiceName        string
	ServiceEnvironment string
	ServiceZone        string

	M3Agg *M3AggServiceOptions

	DryRun bool
}

ServiceOptions are the options for Service.

func NewServiceOptions added in v0.7.0

func NewServiceOptions(
	serviceName string, headers http.Header, m3AggOpts *M3AggServiceOptions) ServiceOptions

NewServiceOptions returns a ServiceOptions based on the provided values.

func (*ServiceOptions) ServiceID added in v0.7.0

func (opts *ServiceOptions) ServiceID() services.ServiceID

ServiceID constructs a cluster services ID from the options.

func (*ServiceOptions) Validate added in v0.7.0

func (opts *ServiceOptions) Validate() error

Validate ensures the service options are valid.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL