public final class StackdriverTraceExporter extends Object
Example of usage on Google Cloud VMs:
public static void main(String[] args) {
StackdriverTraceExporter.createAndRegister(
StackdriverTraceConfiguration.builder()
.setProjectId("MyStackdriverProjectId")
.build());
... // Do work.
}
| Modifier and Type | Method and Description |
|---|---|
static void |
createAndRegister(StackdriverTraceConfiguration configuration)
Creates and registers the Stackdriver Trace exporter to the OpenCensus library.
|
static void |
unregister()
Unregisters the Stackdriver Trace exporter from the OpenCensus library.
|
public static void createAndRegister(StackdriverTraceConfiguration configuration) throws IOException
If the credentials in the provided StackdriverTraceConfiguration is not set,
the exporter will use the default application credentials. See GoogleCredentials.getApplicationDefault().
If the projectId in the provided StackdriverTraceConfiguration is not set,
the exporter will use the default project ID. See ServiceOptions.getDefaultProjectId().
configuration - the StackdriverTraceConfiguration used to create the exporter.IllegalStateException - if a Stackdriver exporter is already registered.IOExceptionpublic static void unregister()
IllegalStateException - if a Stackdriver exporter is not registered.