-
Notifications
You must be signed in to change notification settings - Fork 452
/
headers.go
189 lines (149 loc) · 8.42 KB
/
headers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
// Copyright (c) 2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package headers
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"
// EngineHeaderName defines header name which is used to switch between
// prometheus and m3query engines.
EngineHeaderName = M3HeaderPrefix + "Engine"
// MetricsTypeHeader sets the write or read metrics type to restrict
// metrics to.
// Valid values are "unaggregated" or "aggregated".
MetricsTypeHeader = M3HeaderPrefix + "Metrics-Type"
// PromTypeHeader sets the prometheus metric type. Valid values are
// "counter", "gauge", etc. (see src/query/api/v1/handler/prometheus/remote/write.go
// field `headerToMetricType`)
PromTypeHeader = "Prometheus-Metric-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"
// SourceHeader tracks bytes and docs read for the given source, if provided.
SourceHeader = M3HeaderPrefix + "Source"
// 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"
// MetricsRestrictByStoragePoliciesHeader provides the policies options to
// enforce on queries, in the form of a list of storage policies.
// "1m:14d;5m:60d"
MetricsRestrictByStoragePoliciesHeader = M3HeaderPrefix + "Restrict-By-Storage-Policies"
// 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"
// LimitInstanceMultipleHeader overrides the PerQueryLimitsConfiguration.InstanceMultiple for the request.
LimitInstanceMultipleHeader = M3HeaderPrefix + "Limit-Instance-Multiple"
// LimitMaxDocsHeader is the M3 limit docs header that limits
// the number of docs returned by each storage node.
LimitMaxDocsHeader = M3HeaderPrefix + "Limit-Max-Docs"
// LimitMaxRangeHeader is the M3 limit range header that limits
// the time range returned by each storage node.
LimitMaxRangeHeader = M3HeaderPrefix + "Limit-Max-Range"
// LimitMaxReturnedDatapointsHeader is the M3 header that limits
// the number of datapoints returned in total to the client.
LimitMaxReturnedDatapointsHeader = M3HeaderPrefix + "Limit-Max-Returned-Datapoints"
// LimitMaxReturnedSeriesHeader is the M3 header that limits
// the number of series returned in total to the client.
LimitMaxReturnedSeriesHeader = M3HeaderPrefix + "Limit-Max-Returned-Series"
// LimitMaxReturnedSeriesMetadataHeader is the M3 header that limits
// the number of series metadata returned in total to the client.
LimitMaxReturnedSeriesMetadataHeader = M3HeaderPrefix + "Limit-Max-Returned-SeriesMetadata"
// 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"
// LimitRequireNoWaitHeader is the M3 header that ensures
// M3 returns an error if query execution must wait for permits.
LimitRequireNoWaitHeader = M3HeaderPrefix + "Limit-Require-No-Wait"
// 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"
// ReturnedDataLimitedHeader is the header added when returned
// data are limited either by series or datapoints.
ReturnedDataLimitedHeader = M3HeaderPrefix + "Returned-Data-Limited"
// ReturnedMetadataLimitedHeader is the header added when returned
// metadata is limited.
ReturnedMetadataLimitedHeader = M3HeaderPrefix + "Returned-Metadata-Limited"
// TimeoutHeader is the header added with the effective timeout.
TimeoutHeader = M3HeaderPrefix + "Timeout"
// LimitHeaderSeriesLimitApplied is the header applied when fetch results
// are maxed.
LimitHeaderSeriesLimitApplied = "max_fetch_series_limit_applied"
// WaitedHeader is the header added when permits had to be waited for.
WaitedHeader = M3HeaderPrefix + "Waited"
// FetchedSeriesCount is the header added that tracks the total number of
// series that were fetched by the query, before computation.
FetchedSeriesCount = M3HeaderPrefix + "Series-Count"
// FetchedMetadataCount is the header added that tracks the total amount of
// metadata that was fetched by the query, before computation.
FetchedMetadataCount = M3HeaderPrefix + "Metadata-Count"
// RenderFormat is used to switch result format for query results rendering.
RenderFormat = M3HeaderPrefix + "Render-Format"
// JSONDisableDisallowUnknownFields is header if set to true that allows
// for clients to send fields unknown by a HTTP/JSON endpoint and still
// parse the request, this is helpful for sending a request with a new
// schema to an older instance and still have it respond successfully
// using the fields it knows about.
JSONDisableDisallowUnknownFields = M3HeaderPrefix + "JSON-Disable-Disallow-Unknown-Fields"
// CustomResponseMetricsType is a header that, if set, will override the `type` tag
// on the request's response metrics.
CustomResponseMetricsType = M3HeaderPrefix + "Custom-Response-Metrics-Type"
)