You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace comma-delimited string flags with repeatable flags (#355)
* Replace comma-delimited string flags with repeatable flags
Signed-off-by: Tommy Li <[email protected]>
* preserve old flags but mark them as deprecated
Signed-off-by: Tommy Li <[email protected]>
---------
Signed-off-by: Tommy Li <[email protected]>
|`google.project-id`| No | GCloud SDK auto-discovery |Comma seperated list of Google Project IDs |
81
+
|`google.project-ids`| No | GCloud SDK auto-discovery |Repeatable flag of Google Project IDs |
82
82
|`google.projects.filter`| No || GCloud projects filter expression. See more [here](https://cloud.google.com/sdk/gcloud/reference/projects/list). |
83
83
|`monitoring.metrics-ingest-delay`| No || Offsets metric collection by a delay appropriate for each metric type, e.g. because bigquery metrics are slow to appear |
84
84
|`monitoring.drop-delegated-projects`| No | No | Drop metrics from attached projects and fetch `project_id` only. |
85
-
|`monitoring.metrics-type-prefixes`| Yes ||Comma separated Google Stackdriver Monitoring Metric Type prefixes (see [example][metrics-prefix-example] and [available metrics][metrics-list]) |
85
+
|`monitoring.metrics-prefixes`| Yes ||Repeatable flag of Google Stackdriver Monitoring Metric Type prefixes (see [example][metrics-prefix-example] and [available metrics][metrics-list]) |
86
86
|`monitoring.metrics-interval`| No |`5m`| Metric's timestamp interval to request from the Google Stackdriver Monitoring Metrics API. Only the most recent data point is used |
87
87
|`monitoring.metrics-offset`| No |`0s`| Offset (into the past) for the metric's timestamp interval to request from the Google Stackdriver Monitoring Metrics API, to handle latency in published metrics |
88
88
|`monitoring.filters`| No || Additonal filters to be sent on the Monitoring API call. Add multiple filters by providing this parameter multiple times. See [monitoring.filters](#using-filters) for more info. |
@@ -143,8 +143,9 @@ If we want to get all `CPU` (`compute.googleapis.com/instance/cpu`) and `Disk` (
pubsub.googleapis.com/subscription/num_undelivered_messages (apply to only the specific subscription metric) \
164
165
165
166
The `filter_query` will be applied to a final metrics API query when querying for metric data. You can read more about the metric API filter options in GCPs documentation https://cloud.google.com/monitoring/api/v3/filters
166
-
167
+
167
168
The final query sent to the metrics API already includes filters for project and metric type. Each applicable `filter_query` will be appended to the query with an AND
"monitoring.metrics-type-prefixes", "Comma separated Google Stackdriver Monitoring Metric Type prefixes.",
92
-
).Required().String()
94
+
"monitoring.metrics-type-prefixes", "DEPRECATED - Comma separated Google Stackdriver Monitoring Metric Type prefixes. Use 'monitoring.metrics-prefixes' instead.",
95
+
).String()
96
+
97
+
monitoringMetricsPrefixes=kingpin.Flag(
98
+
"monitoring.metrics-prefixes", "Google Stackdriver Monitoring Metric Type prefixes. Repeat this flag to scrape multiple prefixes.",
99
+
).Strings()
93
100
94
101
monitoringMetricsInterval=kingpin.Flag(
95
102
"monitoring.metrics-interval", "Interval to request the Google Stackdriver Monitoring Metrics for. Only the most recent data point is used.",
@@ -269,16 +276,29 @@ func main() {
269
276
kingpin.Parse()
270
277
271
278
logger:=promlog.New(promlogConfig)
279
+
if*projectID!="" {
280
+
level.Warn(logger).Log("msg", "The google.project-id flag is deprecated and will be replaced by google.project-ids.")
281
+
}
282
+
if*monitoringMetricsTypePrefixes!="" {
283
+
level.Warn(logger).Log("msg", "The monitoring.metrics-type-prefixes flag is deprecated and will be replaced by monitoring.metrics-prefix.")
0 commit comments