Skip to content

Commit 0c349f5

Browse files
committed
feat : Add Support for Non-Default Google Cloud Universes via a flag #429
This commit adds a new 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 new flag is used when creating the monitoring service, so that the service is configured to use the specified universe. Signed-off-by: Mathieu Goulin <[email protected]>
1 parent 11d3a0a commit 0c349f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stackdriver_exporter.go

+5-1
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)