Documentation ¶
Index ¶
- Constants
- func AddWarningHeaders(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 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" )
const ( // M3HeaderPrefix is the prefix all M3-specific headers that affect query or // write behavior (not necessarily m3admin headers) are guaranteed to have. M3HeaderPrefix = "M3-" // WarningsHeader is the M3 warnings header when to display a warning to a user. WarningsHeader = M3HeaderPrefix + "Warnings" // RetryHeader is the M3 retry header to display when it is safe to retry. RetryHeader = M3HeaderPrefix + "Retry" // ServedByHeader is the M3 query storage execution breakdown. ServedByHeader = M3HeaderPrefix + "Storage-By" // DeprecatedHeader is the M3 deprecated header. DeprecatedHeader = M3HeaderPrefix + "Deprecated" // MetricsTypeHeader sets the write or read metrics type to restrict // metrics to. // Valid values are "unaggregated" or "aggregated". MetricsTypeHeader = M3HeaderPrefix + "Metrics-Type" // WriteTypeHeader is a header that controls if default // writes should be written to both unaggregated and aggregated // namespaces, or if unaggregated values are skipped and // only aggregated values are written. // Valid values are "default" or "aggregate". WriteTypeHeader = M3HeaderPrefix + "Write-Type" // DefaultWriteType is the default write type. DefaultWriteType = "default" // AggregateWriteType is the aggregate write type. This writes to // only aggregated namespaces AggregateWriteType = "aggregate" // MetricsStoragePolicyHeader specifies the resolution and retention of // metrics being written or read. // In the form of a storage policy string, e.g. "1m:14d". // Only required if the metrics type header does not specify unaggregated // metrics type. MetricsStoragePolicyHeader = M3HeaderPrefix + "Storage-Policy" // RestrictByTagsJSONHeader provides tag options to enforces on queries, // in JSON format. See `handler.stringTagOptions` for definitions.` RestrictByTagsJSONHeader = M3HeaderPrefix + "Restrict-By-Tags-JSON" // MapTagsByJSONHeader provides the ability to mutate tags of timeseries in // incoming write requests. See `MapTagsOptions` for structure. MapTagsByJSONHeader = M3HeaderPrefix + "Map-Tags-JSON" // LimitMaxSeriesHeader is the M3 limit timeseries header that limits // the number of time series returned by each storage node. LimitMaxSeriesHeader = M3HeaderPrefix + "Limit-Max-Series" // LimitMaxDocsHeader is the M3 limit docs header that limits // the number of docs returned by each storage node. LimitMaxDocsHeader = M3HeaderPrefix + "Limit-Max-Docs" // LimitRequireExhaustiveHeader is the M3 limit exhaustive header that will // ensure M3 returns an error if the results set is not exhaustive. LimitRequireExhaustiveHeader = M3HeaderPrefix + "Limit-Require-Exhaustive" // UnaggregatedStoragePolicy specifies the unaggregated storage policy. UnaggregatedStoragePolicy = "unaggregated" // 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" // HeaderForce is the header used to specify whether this should be a forced operation. HeaderForce = "Force" // LimitHeader is the header added when returned series are limited. LimitHeader = M3HeaderPrefix + "Results-Limited" // LimitHeaderSeriesLimitApplied is the header applied when fetch results are // maxed. LimitHeaderSeriesLimitApplied = "max_fetch_series_limit_applied" )
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 ¶
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 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, *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.
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, headers 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.