handleroptions

package
v0.15.13 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StepParam is the step parameter.
	StepParam = "step"
	// LookbackParam is the lookback parameter.
	LookbackParam = "lookback"
)
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"
)

Variables

This section is empty.

Functions

func AddWarningHeaders

func AddWarningHeaders(w http.ResponseWriter, meta block.ResultMetadata)

AddWarningHeaders adds any warning headers present in the result's metadata. No-op if no warnings encountered.

func AllowedServices

func AllowedServices() []string

AllowedServices returns the list of valid M3 services.

func IsAllowedService

func IsAllowedService(svc string) bool

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

func ParseDuration

func ParseDuration(r *http.Request, key string) (time.Duration, error)

ParseDuration parses a duration HTTP parameter. nolint: unparam

func ParseLimit

func ParseLimit(req *http.Request, header, formValue string, defaultLimit int) (int, error)

ParseLimit parses request limit from either header or query string.

func ParseLookbackDuration

func ParseLookbackDuration(r *http.Request) (time.Duration, bool, error)

ParseLookbackDuration parses a lookback duration for an HTTP request.

func ParseRequireExhaustive added in v0.15.2

func ParseRequireExhaustive(req *http.Request, defaultValue bool) (bool, error)

ParseRequireExhaustive parses request limit require exhaustive from header or query string.

func ParseStep

func ParseStep(r *http.Request) (time.Duration, bool, error)

ParseStep parses the step duration for an HTTP request.

Types

type DropOp

type DropOp struct {
	Tag string `json:"tag"`
}

DropOp with tag="foo" and an empty value will remove all tag-value pairs in all timeseries in the write request where the tag was "foo".

func (DropOp) IsEmpty

func (op DropOp) IsEmpty() bool

IsEmpty returns true if the operation is empty.

type DropWithValueOp

type DropWithValueOp struct {
	Tag   string `json:"tag"`
	Value string `json:"value"`
}

DropWithValueOp will remove all tag-value pairs in all timeseries in the writer equest if and only if the tag AND value in the timeseries is equal to those on the operation.

func (DropWithValueOp) IsEmpty

func (op DropWithValueOp) IsEmpty() bool

IsEmpty returns true if the operation is empty.

type FetchOptionsBuilder

type FetchOptionsBuilder interface {
	// NewFetchOptions parses an http request into fetch options.
	NewFetchOptions(req *http.Request) (*storage.FetchOptions, *xhttp.ParseError)
}

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

func NewFetchOptionsBuilder

func NewFetchOptionsBuilder(
	opts FetchOptionsBuilderOptions,
) FetchOptionsBuilder

NewFetchOptionsBuilder returns a new fetch options builder.

type FetchOptionsBuilderLimitsOptions added in v0.15.4

type FetchOptionsBuilderLimitsOptions struct {
	SeriesLimit       int
	DocsLimit         int
	RequireExhaustive bool
}

FetchOptionsBuilderLimitsOptions provides limits options to use when creating a fetch options builder.

type FetchOptionsBuilderOptions

type FetchOptionsBuilderOptions struct {
	Limits        FetchOptionsBuilderLimitsOptions
	RestrictByTag *storage.RestrictByTag
}

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

type M3AggServiceOptions

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

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

type MapTagsOptions

type MapTagsOptions struct {
	TagMappers []TagMapper `json:"tagMappers"`
}

MapTagsOptions representations mutations to be applied to all timeseries in a write request.

type PromWriteHandlerForwardTargetOptions

type PromWriteHandlerForwardTargetOptions struct {
	// URL of the target to send to.
	URL string `yaml:"url"`
	// Method defaults to POST if not set.
	Method string `yaml:"method"`
	// Headers to send along with requests to the target.
	Headers map[string]string `yaml:"headers"`
}

PromWriteHandlerForwardTargetOptions is a prometheus write handler forwarder target.

type PromWriteHandlerForwardingOptions

type PromWriteHandlerForwardingOptions struct {
	// MaxConcurrency is the max parallel forwarding and if zero will be unlimited.
	MaxConcurrency int                                    `yaml:"maxConcurrency"`
	Timeout        time.Duration                          `yaml:"timeout"`
	Retry          *retry.Configuration                   `yaml:"retry"`
	Targets        []PromWriteHandlerForwardTargetOptions `yaml:"targets"`
}

PromWriteHandlerForwardingOptions is the forwarding options for prometheus write handler.

type ReplaceOp

type ReplaceOp struct {
	Tag      string `json:"tag"`
	OldValue string `json:"old"`
	NewValue string `json:"new"`
}

ReplaceOp with tag="foo", an empty old field, and a non-empty new field will unconditionally replace the value of any tag-value pair of any timeseries in the write request where the tag is "foo" with the value of new. If old is non-empty, a value will only be replaced if the value was equal to old.

func (ReplaceOp) IsEmpty

func (op ReplaceOp) IsEmpty() bool

IsEmpty returns true if the operation is empty.

type ServiceNameAndDefaults

type ServiceNameAndDefaults struct {
	ServiceName string
	Defaults    []ServiceOptionsDefault
}

ServiceNameAndDefaults is the params used when identifying a service and it's service option defaults.

type ServiceOptions

type ServiceOptions struct {
	ServiceName        string
	ServiceEnvironment string
	ServiceZone        string

	M3Agg *M3AggServiceOptions

	DryRun bool
	Force  bool
}

ServiceOptions are the options for Service.

func NewServiceOptions

func NewServiceOptions(
	service ServiceNameAndDefaults,
	header http.Header,
	m3AggOpts *M3AggServiceOptions,
) ServiceOptions

NewServiceOptions returns a ServiceOptions based on the provided values.

func (*ServiceOptions) KVOverrideOptions added in v0.15.1

func (opts *ServiceOptions) KVOverrideOptions() kv.OverrideOptions

KVOverrideOptions constructs KV overrides from the current service options.

func (*ServiceOptions) ServiceID

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

ServiceID constructs a cluster services ID from the options.

func (*ServiceOptions) Validate

func (opts *ServiceOptions) Validate() error

Validate ensures the service options are valid.

type ServiceOptionsDefault

type ServiceOptionsDefault func(o ServiceOptions) ServiceOptions

ServiceOptionsDefault is a default to apply to service options.

func WithDefaultServiceEnvironment

func WithDefaultServiceEnvironment(env string) ServiceOptionsDefault

WithDefaultServiceEnvironment returns the default service environment.

func WithDefaultServiceZone

func WithDefaultServiceZone(zone string) ServiceOptionsDefault

WithDefaultServiceZone returns the default service zone.

type StringMatch

type StringMatch struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

StringMatch is an easy to use JSON representation of models.Matcher that allows plaintext fields rather than forcing base64 encoded values.

type StringTagOptions

type StringTagOptions struct {
	Restrict []StringMatch `json:"match"`
	Strip    []string      `json:"strip"`
}

StringTagOptions is an easy to use JSON representation of storage.RestrictByTag that allows plaintext string fields rather than forcing base64 encoded values.

func (*StringTagOptions) StorageOptions added in v0.15.4

func (o *StringTagOptions) StorageOptions() (*storage.RestrictByTag, error)

StorageOptions returns the corresponding storage.RestrictByTag options.

func (*StringTagOptions) Validate added in v0.15.4

func (o *StringTagOptions) Validate() error

Validate validates the string tag options.

type TagMapper

type TagMapper struct {
	Write         WriteOp         `json:"write,omitEmpty"`
	Drop          DropOp          `json:"drop,omitEmpty"`
	DropWithValue DropWithValueOp `json:"dropWithValue,omitEmpty"`
	Replace       ReplaceOp       `json:"replace,omitEmpty"`
}

TagMapper represents one of a variety of tag mapping operations.

func (TagMapper) Validate

func (t TagMapper) Validate() error

Validate ensures the mapper is valid.

type WriteOp

type WriteOp struct {
	Tag   string `json:"tag"`
	Value string `json:"value"`
}

WriteOp with value tag="foo" and value="bar" will unconditionally add tag-value pair "foo":"bar" to all timeseries included in the write request. Any timeseries with a non-empty "foo" tag will have its value for that tag replaced.

func (WriteOp) IsEmpty

func (op WriteOp) IsEmpty() bool

IsEmpty returns true if the operation is empty.

Jump to

Keyboard shortcuts

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