github.com/m3db/m3@v1.5.0/src/x/headers/headers.go (about) 1 // Copyright (c) 2020 Uber Technologies, Inc. 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 // 10 // The above copyright notice and this permission notice shall be included in 11 // all copies or substantial portions of the Software. 12 // 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 // THE SOFTWARE. 20 21 package headers 22 23 const ( 24 // M3HeaderPrefix is the prefix all M3-specific headers that affect query or 25 // write behavior (not necessarily m3admin headers) are guaranteed to have. 26 M3HeaderPrefix = "M3-" 27 28 // WarningsHeader is the M3 warnings header when to display a warning to a 29 // user. 30 WarningsHeader = M3HeaderPrefix + "Warnings" 31 32 // RetryHeader is the M3 retry header to display when it is safe to retry. 33 RetryHeader = M3HeaderPrefix + "Retry" 34 35 // ServedByHeader is the M3 query storage execution breakdown. 36 ServedByHeader = M3HeaderPrefix + "Storage-By" 37 38 // DeprecatedHeader is the M3 deprecated header. 39 DeprecatedHeader = M3HeaderPrefix + "Deprecated" 40 41 // EngineHeaderName defines header name which is used to switch between 42 // prometheus and m3query engines. 43 EngineHeaderName = M3HeaderPrefix + "Engine" 44 45 // MetricsTypeHeader sets the write or read metrics type to restrict 46 // metrics to. 47 // Valid values are "unaggregated" or "aggregated". 48 MetricsTypeHeader = M3HeaderPrefix + "Metrics-Type" 49 50 // PromTypeHeader sets the prometheus metric type. Valid values are 51 // "counter", "gauge", etc. (see src/query/api/v1/handler/prometheus/remote/write.go 52 // field `headerToMetricType`) 53 PromTypeHeader = "Prometheus-Metric-Type" 54 55 // WriteTypeHeader is a header that controls if default 56 // writes should be written to both unaggregated and aggregated 57 // namespaces, or if unaggregated values are skipped and 58 // only aggregated values are written. 59 // Valid values are "default" or "aggregate". 60 WriteTypeHeader = M3HeaderPrefix + "Write-Type" 61 62 // SourceHeader tracks bytes and docs read for the given source, if provided. 63 SourceHeader = M3HeaderPrefix + "Source" 64 65 // DefaultWriteType is the default write type. 66 DefaultWriteType = "default" 67 68 // AggregateWriteType is the aggregate write type. This writes to 69 // only aggregated namespaces 70 AggregateWriteType = "aggregate" 71 72 // MetricsStoragePolicyHeader specifies the resolution and retention of 73 // metrics being written or read. 74 // In the form of a storage policy string, e.g. "1m:14d". 75 // Only required if the metrics type header does not specify unaggregated 76 // metrics type. 77 MetricsStoragePolicyHeader = M3HeaderPrefix + "Storage-Policy" 78 79 // MetricsRestrictByStoragePoliciesHeader provides the policies options to 80 // enforce on queries, in the form of a list of storage policies. 81 // "1m:14d;5m:60d" 82 MetricsRestrictByStoragePoliciesHeader = M3HeaderPrefix + "Restrict-By-Storage-Policies" 83 84 // RestrictByTagsJSONHeader provides tag options to enforces on queries, 85 // in JSON format. See `handler.stringTagOptions` for definitions.` 86 RestrictByTagsJSONHeader = M3HeaderPrefix + "Restrict-By-Tags-JSON" 87 88 // MapTagsByJSONHeader provides the ability to mutate tags of timeseries in 89 // incoming write requests. See `MapTagsOptions` for structure. 90 MapTagsByJSONHeader = M3HeaderPrefix + "Map-Tags-JSON" 91 92 // ReadConsistencyLevelHeader defines the read consistency enforced for a query. 93 ReadConsistencyLevelHeader = M3HeaderPrefix + "Read-Consistency-Level" 94 95 // IterateEqualTimestampStrategyHeader defines the timestamp equality strategy for a query. 96 IterateEqualTimestampStrategyHeader = M3HeaderPrefix + "Iterate-Equal-Timestamp-Strategy" 97 98 // LimitMaxSeriesHeader is the M3 limit timeseries header that limits 99 // the number of time series returned by each storage node. 100 LimitMaxSeriesHeader = M3HeaderPrefix + "Limit-Max-Series" 101 102 // LimitInstanceMultipleHeader overrides the PerQueryLimitsConfiguration.InstanceMultiple for the request. 103 LimitInstanceMultipleHeader = M3HeaderPrefix + "Limit-Instance-Multiple" 104 105 // LimitMaxDocsHeader is the M3 limit docs header that limits 106 // the number of docs returned by each storage node. 107 LimitMaxDocsHeader = M3HeaderPrefix + "Limit-Max-Docs" 108 109 // LimitMaxRangeHeader is the M3 limit range header that limits 110 // the time range returned by each storage node. 111 LimitMaxRangeHeader = M3HeaderPrefix + "Limit-Max-Range" 112 113 // LimitMaxReturnedDatapointsHeader is the M3 header that limits 114 // the number of datapoints returned in total to the client. 115 LimitMaxReturnedDatapointsHeader = M3HeaderPrefix + "Limit-Max-Returned-Datapoints" 116 117 // LimitMaxReturnedSeriesHeader is the M3 header that limits 118 // the number of series returned in total to the client. 119 LimitMaxReturnedSeriesHeader = M3HeaderPrefix + "Limit-Max-Returned-Series" 120 121 // LimitMaxReturnedSeriesMetadataHeader is the M3 header that limits 122 // the number of series metadata returned in total to the client. 123 LimitMaxReturnedSeriesMetadataHeader = M3HeaderPrefix + "Limit-Max-Returned-SeriesMetadata" 124 125 // LimitRequireExhaustiveHeader is the M3 limit exhaustive header that will 126 // ensure M3 returns an error if the results set is not exhaustive. 127 LimitRequireExhaustiveHeader = M3HeaderPrefix + "Limit-Require-Exhaustive" 128 129 // LimitRequireNoWaitHeader is the M3 header that ensures 130 // M3 returns an error if query execution must wait for permits. 131 LimitRequireNoWaitHeader = M3HeaderPrefix + "Limit-Require-No-Wait" 132 133 // LimitMaxMetricMetadataStatsHeader is the M3 header that limits 134 // the number of metric metadata stats returned in M3-Metric-Stats. 135 LimitMaxMetricMetadataStatsHeader = M3HeaderPrefix + "Limit-Max-Metric-Metadata-Stats" 136 137 // UnaggregatedStoragePolicy specifies the unaggregated storage policy. 138 UnaggregatedStoragePolicy = "unaggregated" 139 140 // DefaultServiceEnvironment is the default service ID environment. 141 DefaultServiceEnvironment = "default_env" 142 // DefaultServiceZone is the default service ID zone. 143 DefaultServiceZone = "embedded" 144 145 // HeaderClusterEnvironmentName is the header used to specify the 146 // environment name. 147 HeaderClusterEnvironmentName = "Cluster-Environment-Name" 148 // HeaderClusterZoneName is the header used to specify the zone name. 149 HeaderClusterZoneName = "Cluster-Zone-Name" 150 // HeaderDryRun is the header used to specify whether this should be a dry 151 // run. 152 HeaderDryRun = "Dry-Run" 153 // HeaderForce is the header used to specify whether this should be a forced 154 // operation. 155 HeaderForce = "Force" 156 157 // LimitHeader is the header added when returned series are limited. 158 LimitHeader = M3HeaderPrefix + "Results-Limited" 159 160 // ReturnedDataLimitedHeader is the header added when returned 161 // data are limited either by series or datapoints. 162 ReturnedDataLimitedHeader = M3HeaderPrefix + "Returned-Data-Limited" 163 164 // ReturnedMetadataLimitedHeader is the header added when returned 165 // metadata is limited. 166 ReturnedMetadataLimitedHeader = M3HeaderPrefix + "Returned-Metadata-Limited" 167 168 // TimeoutHeader is the header added with the effective timeout. 169 TimeoutHeader = M3HeaderPrefix + "Timeout" 170 171 // LimitHeaderSeriesLimitApplied is the header applied when fetch results 172 // are maxed. 173 LimitHeaderSeriesLimitApplied = "max_fetch_series_limit_applied" 174 175 // WaitedHeader is the header added when permits had to be waited for. 176 WaitedHeader = M3HeaderPrefix + "Waited" 177 178 // FetchedSeriesCount is the header added that tracks the total number of 179 // series that were fetched by the query, before computation. 180 FetchedSeriesCount = M3HeaderPrefix + "Series-Count" 181 182 // FetchedSeriesNoSamplesCount is the header added that tracks the total number of 183 // fetched series that were fetched by the query but had no samples. 184 FetchedSeriesNoSamplesCount = M3HeaderPrefix + "Series-No-Samples-Count" 185 186 // FetchedSeriesWithSamplesCount is the header added that tracks the total number of 187 // fetched series that were fetched by the query and had non-zero samples. 188 FetchedSeriesWithSamplesCount = M3HeaderPrefix + "Series-With-Samples-Count" 189 190 // FetchedAggregatedSeriesCount is the header added that tracks the total number of 191 // aggregated series that were fetched by the query, before computation. 192 FetchedAggregatedSeriesCount = M3HeaderPrefix + "Aggregated-Series-Count" 193 194 // FetchedUnaggregatedSeriesCount is the header added that tracks the total number of 195 // unaggregated series that were fetched by the query, before computation. 196 FetchedUnaggregatedSeriesCount = M3HeaderPrefix + "Unaggregated-Series-Count" 197 198 // MetricStats is the header added that tracks the unique set of metric stats 199 // all series fetched by this query, before computation, by metric name. 200 MetricStats = M3HeaderPrefix + "Metric-Stats" 201 202 // NamespacesHeader is the header added that tracks the unique set of namespaces 203 // read by this query. 204 NamespacesHeader = M3HeaderPrefix + "Namespaces" 205 206 // FetchedResponsesHeader is the header added that tracks the number of M3DB responses 207 // read by this query. 208 FetchedResponsesHeader = M3HeaderPrefix + "Fetched-Responses" 209 210 // FetchedBytesEstimateHeader is the header added that tracks the estimated number 211 // of bytes returned by all fetch responses (counted by FetchedResponsesHeader). 212 FetchedBytesEstimateHeader = M3HeaderPrefix + "Fetched-Bytes-Estimate" 213 214 // FetchedMetadataCount is the header added that tracks the total amount of 215 // metadata that was fetched by the query, before computation. 216 FetchedMetadataCount = M3HeaderPrefix + "Metadata-Count" 217 218 // RenderFormat is used to switch result format for query results rendering. 219 RenderFormat = M3HeaderPrefix + "Render-Format" 220 221 // JSONDisableDisallowUnknownFields is header if set to true that allows 222 // for clients to send fields unknown by a HTTP/JSON endpoint and still 223 // parse the request, this is helpful for sending a request with a new 224 // schema to an older instance and still have it respond successfully 225 // using the fields it knows about. 226 JSONDisableDisallowUnknownFields = M3HeaderPrefix + "JSON-Disable-Disallow-Unknown-Fields" 227 228 // CustomResponseMetricsType is a header that, if set, will override the `type` tag 229 // on the request's response metrics. 230 CustomResponseMetricsType = M3HeaderPrefix + "Custom-Response-Metrics-Type" 231 232 // RelatedQueriesHeader is a header that, if set, will be used by clients to send a set of colon separated 233 // start/end time pairs as unix timestamps (e.g. 1635160222:1635166222). Multiple 234 // RelatedQueriesHeader headers may NOT be sent. When multiple values are required, they can be separated 235 // by a semicolons (e.g. startTs:endTs;startTs:endTs). 236 RelatedQueriesHeader = M3HeaderPrefix + "Related-Queries" 237 )