public abstract static class StackdriverStatsConfiguration.Builder extends Object
StackdriverStatsConfiguration
.Modifier and Type | Method and Description |
---|---|
StackdriverStatsConfiguration |
build()
Builds a new
StackdriverStatsConfiguration with current settings. |
abstract StackdriverStatsConfiguration.Builder |
setConstantLabels(Map<io.opencensus.metrics.LabelKey,io.opencensus.metrics.LabelValue> constantLabels)
Sets the constant labels that will be applied to every Stackdriver metric.
|
abstract StackdriverStatsConfiguration.Builder |
setCredentials(com.google.auth.Credentials credentials)
Sets the given
Credentials . |
abstract StackdriverStatsConfiguration.Builder |
setDeadline(io.opencensus.common.Duration deadline)
Sets the deadline for exporting to Stackdriver Monitoring backend.
|
abstract StackdriverStatsConfiguration.Builder |
setExportInterval(io.opencensus.common.Duration exportInterval)
Sets the export interval.
|
abstract StackdriverStatsConfiguration.Builder |
setMetricNamePrefix(String prefix)
Sets the the name prefix for Stackdriver metrics.
|
abstract StackdriverStatsConfiguration.Builder |
setMetricServiceStub(com.google.cloud.monitoring.v3.stub.MetricServiceStub stub)
Sets the
MetricServiceStub to be used to make calls to Stackdriver Monitoring v3
APIs. |
abstract StackdriverStatsConfiguration.Builder |
setMonitoredResource(com.google.api.MonitoredResource monitoredResource)
Sets the
MonitoredResource . |
abstract StackdriverStatsConfiguration.Builder |
setProjectId(String projectId)
Sets the given project id.
|
public abstract StackdriverStatsConfiguration.Builder setCredentials(com.google.auth.Credentials credentials)
Credentials
.credentials
- the Credentials
.public abstract StackdriverStatsConfiguration.Builder setProjectId(String projectId)
projectId
- the cloud project id.public abstract StackdriverStatsConfiguration.Builder setExportInterval(io.opencensus.common.Duration exportInterval)
exportInterval
- the export interval between pushes to StackDriver.public abstract StackdriverStatsConfiguration.Builder setMonitoredResource(com.google.api.MonitoredResource monitoredResource)
MonitoredResource
.monitoredResource
- the Stackdriver MonitoredResource
.public abstract StackdriverStatsConfiguration.Builder setMetricNamePrefix(String prefix)
It is suggested to use prefix with custom or external domain name, for example "custom.googleapis.com/myorg/" or "external.googleapis.com/prometheus/". If the given prefix doesn't start with a valid domain, we will add "custom.googleapis.com/" before the prefix.
prefix
- the metric name prefix.public abstract StackdriverStatsConfiguration.Builder setConstantLabels(Map<io.opencensus.metrics.LabelKey,io.opencensus.metrics.LabelValue> constantLabels)
If not set, the exporter will use the "opencensus_task" label.
If you set constant labels, make sure that the monitored resource together with these labels is unique to the current process. This is to ensure that there is only a single writer to each time series in Stackdriver.
Set constant labels to empty to avoid getting the default "opencensus_task" label. You should only do this if you know that the monitored resource uniquely identifies this process.
constantLabels
- constant labels that will be applied to every Stackdriver metric.public abstract StackdriverStatsConfiguration.Builder setDeadline(io.opencensus.common.Duration deadline)
If both MetricServiceStub
and Deadline
are set, MetricServiceStub
takes precedence and Deadline
will not be respected.
deadline
- the export deadline.public abstract StackdriverStatsConfiguration.Builder setMetricServiceStub(com.google.cloud.monitoring.v3.stub.MetricServiceStub stub)
MetricServiceStub
to be used to make calls to Stackdriver Monitoring v3
APIs. This is for for advanced usage.stub
- the MetricServiceStub
.public StackdriverStatsConfiguration build()
StackdriverStatsConfiguration
with current settings.StackdriverStatsConfiguration
.