Skip to content

Commit 8216db1

Browse files
authored
feat: Add google.universe-domain flag for custom GoogleCloud universes (#430)
This commit introduces a new command-line flag `--google.universe-domain` which allows users to specify the Google Cloud universe to use. This is useful for users who are not using the default `googleapis.com` universe. The default value for this flag is "googleapis.com". Updates include: - Addition of the `--google.universe-domain` flag to the CLI options. - Documentation for the new flag in `README.md`. - A feature entry in `CHANGELOG.md`. Signed-off-by: Mathieu Goulin <matgou1@msn.com>
1 parent 1aff5e6 commit 8216db1

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## master / unreleased
22

3+
- [FEATURE] Add `google.universe-domain` flag to specify the Google Cloud universe to use.
4+
35
## 0.18.0 / 2025-01-16
46

57
- [FEATURE] Support more specific prefixes in ?collect parameter #387

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ If you are still using the legacy [Access scopes][access-scopes], the `https://w
8080
| ----------------------------------- | -------- |---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
8181
| `google.project-ids` | No | GCloud SDK auto-discovery | Repeatable flag of Google Project IDs |
8282
| `google.projects.filter` | No | | GCloud projects filter expression. See more [here](https://cloud.google.com/sdk/gcloud/reference/projects/list). |
83+
| `google.universe-domain` | No | `googleapis.com` | Target specific Google Cloud environments, such as public cloud, or specific sovereign clouds |
8384
| `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 |
8485
| `monitoring.drop-delegated-projects` | No | No | Drop metrics from attached projects and fetch `project_id` only. |
8586
| `monitoring.metrics-prefixes` | Yes | | Repeatable flag of Google Stackdriver Monitoring Metric Type prefixes (see [example][metrics-prefix-example] and [available metrics][metrics-list]) |

stackdriver_exporter.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ var (
6868
"google.projects.filter", "Google projects search filter.",
6969
).String()
7070

71+
googleUniverseDomain = kingpin.Flag(
72+
"google.universe-domain", "The Cloud universe to use.",
73+
).Default("googleapis.com").String()
74+
7175
stackdriverMaxRetries = kingpin.Flag(
7276
"stackdriver.max-retries", "Max number of retries that should be attempted on 503 errors from stackdriver.",
7377
).Default("0").Int()
@@ -169,7 +173,7 @@ func createMonitoringService(ctx context.Context) (*monitoring.Service, error) {
169173
rehttp.ExpJitterDelay(*stackdriverBackoffJitterBase, *stackdriverMaxBackoffDuration), // Set timeout to <10s as that is prom default timeout
170174
)
171175

172-
monitoringService, err := monitoring.NewService(ctx, option.WithHTTPClient(googleClient))
176+
monitoringService, err := monitoring.NewService(ctx, option.WithHTTPClient(googleClient), option.WithUniverseDomain(*googleUniverseDomain))
173177
if err != nil {
174178
return nil, fmt.Errorf("Error creating Google Stackdriver Monitoring service: %v", err)
175179
}

0 commit comments

Comments
 (0)