Documentation ¶
Index ¶
- Constants
- func AddResponseHeaders(w http.ResponseWriter, meta block.ResultMetadata, ...)
- func AllowedServices() []string
- func IsAllowedService(svc string) bool
- func ParseDuration(r *http.Request, key string) (time.Duration, error)
- func ParseLimit(req *http.Request, header, formValue string, defaultLimit int) (int, error)
- func ParseLookbackDuration(r *http.Request) (time.Duration, bool, error)
- func ParseRequestTimeout(r *http.Request, configFetchTimeout time.Duration) (time.Duration, error)
- func ParseRequireExhaustive(req *http.Request, defaultValue bool) (bool, error)
- func ParseStep(r *http.Request) (time.Duration, bool, error)
- type DropOp
- type DropWithValueOp
- type FetchOptionsBuilder
- type FetchOptionsBuilderLimitsOptions
- type FetchOptionsBuilderOptions
- type M3AggServiceOptions
- type MapTagsOptions
- type PromWriteHandlerForwardTargetOptions
- type PromWriteHandlerForwardingOptions
- type ReplaceOp
- type ServiceNameAndDefaults
- type ServiceOptions
- type ServiceOptionsDefault
- type StringMatch
- type StringTagOptions
- type TagMapper
- type WriteOp
Constants ¶
const ( // StepParam is the step parameter. StepParam = "step" // LookbackParam is the lookback parameter. LookbackParam = "lookback" // TimeoutParam is the timeout parameter. TimeoutParam = "timeout" )
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 AddResponseHeaders ¶ added in v1.0.1
func AddResponseHeaders( w http.ResponseWriter, meta block.ResultMetadata, fetchOpts *storage.FetchOptions, )
AddResponseHeaders adds any warning headers present in the result's metadata, and also effective parameters relative to the request such as effective timeout in use.
func AllowedServices ¶
func AllowedServices() []string
AllowedServices returns the list of valid M3 services.
func IsAllowedService ¶
IsAllowedService returns whether a service name is a valid M3 service.
func ParseDuration ¶
ParseDuration parses a duration HTTP parameter. nolint: unparam
func ParseLimit ¶
ParseLimit parses request limit from either header or query string.
func ParseLookbackDuration ¶
ParseLookbackDuration parses a lookback duration for an HTTP request.
func ParseRequestTimeout ¶ added in v1.0.1
func ParseRequestTimeout( r *http.Request, configFetchTimeout time.Duration, ) (time.Duration, error)
ParseRequestTimeout parses the input request timeout with a default.
func ParseRequireExhaustive ¶ added in v0.15.2
ParseRequireExhaustive parses request limit require exhaustive from header or query string.
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".
type DropWithValueOp ¶
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, error) }
FetchOptionsBuilder builds fetch options based on a request and default config.
func NewFetchOptionsBuilder ¶
func NewFetchOptionsBuilder( opts FetchOptionsBuilderOptions, ) (FetchOptionsBuilder, error)
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 Timeout time.Duration }
FetchOptionsBuilderOptions provides options to use when creating a fetch options builder.
func (FetchOptionsBuilderOptions) Validate ¶ added in v1.0.1
func (o FetchOptionsBuilderOptions) Validate() error
Validate validates the fetch options builder options.
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.
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.