func ExporterOptsFlags()

in pkg/export/setup/setup.go [101:174]


func ExporterOptsFlags(a *kingpin.Application, opts *export.ExporterOpts) {
	opts.DefaultUnsetFields()

	a.Flag("export.disable", "Disable exporting to GCM.").
		Default(strconv.FormatBool(opts.Disable)).
		BoolVar(&opts.Disable)

	a.Flag("export.endpoint", "GCM API endpoint to send metric data to.").
		Default(opts.Endpoint).
		StringVar(&opts.Endpoint)

	a.Flag("export.compression", "The compression format to use for gRPC requests ('none' or 'gzip').").
		Default(opts.Compression).
		EnumVar(&opts.Compression, export.CompressionNone, export.CompressionGZIP)

	a.Flag("export.credentials-file", "Credentials file for authentication with the GCM API.").
		Default(opts.CredentialsFile).
		StringVar(&opts.CredentialsFile)

	a.Flag("export.label.project-id", fmt.Sprintf("Default project ID set for all exported data. Prefer setting the external label %q in the Prometheus configuration if not using the auto-discovered default.", export.KeyProjectID)).
		Default(opts.ProjectID).
		StringVar(&opts.ProjectID)

	a.Flag("export.user-agent-mode", fmt.Sprintf("Mode for user agent used for requests against the GCM API. Valid values are %q, %q, %q, %q or %q.", UAModeGKE, UAModeKubectl, UAModeAVMW, UAModeABM, UAModeUnspecified)).
		Default(opts.UserAgentMode).
		EnumVar(&opts.UserAgentMode, UAModeUnspecified, UAModeGKE, UAModeKubectl, UAModeAVMW, UAModeABM)

	// The location and cluster flag should probably not be used. On the other hand, they make it easy
	// to populate these important values in the monitored resource without interfering with existing
	// Prometheus configuration.
	a.Flag("export.label.location", fmt.Sprintf("The default location set for all exported data. Prefer setting the external label %q in the Prometheus configuration if not using the auto-discovered default.", export.KeyLocation)).
		Default(opts.Location).
		StringVar(&opts.Location)

	a.Flag("export.label.cluster", fmt.Sprintf("The default cluster set for all scraped targets. Prefer setting the external label %q in the Prometheus configuration if not using the auto-discovered default.", export.KeyCluster)).
		Default(opts.Cluster).
		StringVar(&opts.Cluster)

	a.Flag("export.match", `A Prometheus time series matcher. Can be repeated. Every time series must match at least one of the matchers to be exported. This flag can be used equivalently to the match[] parameter of the Prometheus federation endpoint to selectively export data. (Example: --export.match='{job="prometheus"}' --export.match='{__name__=~"job:.*"})`).
		Default("").
		SetValue(&opts.Matchers)

	a.Flag("export.debug.metric-prefix", "Google Cloud Monitoring metric prefix to use.").
		Default(opts.MetricTypePrefix).
		StringVar(&opts.MetricTypePrefix)

	a.Flag("export.debug.disable-auth", "Disable authentication (for debugging purposes).").
		Default(strconv.FormatBool(opts.DisableAuth)).
		BoolVar(&opts.DisableAuth)

	a.Flag("export.debug.batch-size", "Maximum number of points to send in one batch to the GCM API.").
		Default(strconv.FormatUint(uint64(opts.Efficiency.BatchSize), 10)).
		UintVar(&opts.Efficiency.BatchSize)

	a.Flag("export.debug.shard-count", "Number of shards that track series to send.").
		Default(strconv.FormatUint(uint64(opts.Efficiency.ShardCount), 10)).
		UintVar(&opts.Efficiency.ShardCount)

	a.Flag("export.debug.shard-buffer-size", "The buffer size for each individual shard. Each element in buffer (queue) consists of sample and hash.").
		Default(strconv.FormatUint(uint64(opts.Efficiency.ShardBufferSize), 10)).
		UintVar(&opts.Efficiency.ShardBufferSize)

	a.Flag("export.token-url", "The request URL to generate token that's needed to ingest metrics to the project").
		Default(opts.TokenURL).
		StringVar(&opts.TokenURL)

	a.Flag("export.token-body", "The request Body to generate token that's needed to ingest metrics to the project.").
		Default(opts.TokenBody).
		StringVar(&opts.TokenBody)

	a.Flag("export.quota-project", "The projectID of an alternative project for quota attribution.").
		Default(opts.QuotaProject).
		StringVar(&opts.QuotaProject)
}