Skip to content

Commit

Permalink
All flags in main file
Browse files Browse the repository at this point in the history
Signed-off-by: Pablo Balbi <[email protected]>
  • Loading branch information
thepalbi committed May 19, 2022
1 parent 13d7ec5 commit bec682f
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 79 deletions.
79 changes: 0 additions & 79 deletions flags.go

This file was deleted.

65 changes: 65 additions & 0 deletions stackdriver_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,71 @@ import (
"github.com/prometheus-community/stackdriver_exporter/collectors"
)

var (
// General exporter flags

listenAddress = kingpin.Flag(
"web.listen-address", "Address to listen on for web interface and telemetry.",
).Default(":9255").String()

metricsPath = kingpin.Flag(
"web.telemetry-path", "Path under which to expose Prometheus metrics.",
).Default("/metrics").String()

projectID = kingpin.Flag(
"google.project-id", "Comma seperated list of Google Project IDs.",
).String()

stackdriverMaxRetries = kingpin.Flag(
"stackdriver.max-retries", "Max number of retries that should be attempted on 503 errors from stackdriver.",
).Default("0").Int()

stackdriverHttpTimeout = kingpin.Flag(
"stackdriver.http-timeout", "How long should stackdriver_exporter wait for a result from the Stackdriver API.",
).Default("10s").Duration()

stackdriverMaxBackoffDuration = kingpin.Flag(
"stackdriver.max-backoff", "Max time between each request in an exp backoff scenario.",
).Default("5s").Duration()

stackdriverBackoffJitterBase = kingpin.Flag(
"stackdriver.backoff-jitter", "The amount of jitter to introduce in a exp backoff scenario.",
).Default("1s").Duration()

stackdriverRetryStatuses = kingpin.Flag(
"stackdriver.retry-statuses", "The HTTP statuses that should trigger a retry.",
).Default("503").Ints()

// Monitoring collector flags

monitoringMetricsTypePrefixes = kingpin.Flag(
"monitoring.metrics-type-prefixes", "Comma separated Google Stackdriver Monitoring Metric Type prefixes.",
).Required().String()

monitoringMetricsInterval = kingpin.Flag(
"monitoring.metrics-interval", "Interval to request the Google Stackdriver Monitoring Metrics for. Only the most recent data point is used.",
).Default("5m").Duration()

monitoringMetricsOffset = kingpin.Flag(
"monitoring.metrics-offset", "Offset for the Google Stackdriver Monitoring Metrics interval into the past.",
).Default("0s").Duration()

monitoringMetricsIngestDelay = kingpin.Flag(
"monitoring.metrics-ingest-delay", "Offset for the Google Stackdriver Monitoring Metrics interval into the past by the ingest delay from the metric's metadata.",
).Default("false").Bool()

collectorFillMissingLabels = kingpin.Flag(
"collector.fill-missing-labels", "Fill missing metrics labels with empty string to avoid label dimensions inconsistent failure.",
).Default("true").Bool()

monitoringDropDelegatedProjects = kingpin.Flag(
"monitoring.drop-delegated-projects", "Drop metrics from attached projects and fetch `project_id` only.",
).Default("false").Bool()

monitoringMetricsExtraFilter = kingpin.Flag(
"monitoring.filters", "Filters. i.e: pubsub.googleapis.com/subscription:resource.labels.subscription_id=monitoring.regex.full_match(\"my-subs-prefix.*\")").Strings()
)

func init() {
prometheus.MustRegister(version.NewCollector("stackdriver_exporter"))
}
Expand Down

0 comments on commit bec682f

Please sign in to comment.