StackdriverTraceExporter.@Deprecated public final class StackdriverExporter extends Object
Example of usage on Google Cloud VMs:
public static void main(String[] args) {
StackdriverExporter.createAndRegisterWithProjectId("MyStackdriverProjectId");
... // Do work.
}
| Modifier and Type | Method and Description |
|---|---|
static void |
createAndRegister()
Deprecated.
Creates and registers the Stackdriver Trace exporter to the OpenCensus library.
|
static void |
createAndRegisterWithCredentialsAndProjectId(com.google.auth.Credentials credentials,
String projectId)
Deprecated.
Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit
project ID and using explicit credentials.
|
static void |
createAndRegisterWithProjectId(String projectId)
Deprecated.
Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit
project ID.
|
static void |
unregister()
Deprecated.
Unregisters the Stackdriver Trace exporter from the OpenCensus library.
|
public static void createAndRegisterWithCredentialsAndProjectId(com.google.auth.Credentials credentials,
String projectId)
throws IOException
credentials - a credentials used to authenticate API calls.projectId - the cloud project id.IllegalStateException - if a Stackdriver exporter is already registered.IOExceptionpublic static void createAndRegisterWithProjectId(String projectId) throws IOException
This uses the default application credentials see GoogleCredentials.getApplicationDefault().
This is equivalent with:
StackdriverExporter.createAndRegisterWithCredentialsAndProjectId(
GoogleCredentials.getApplicationDefault(), projectId);
projectId - the cloud project id.IllegalStateException - if a Stackdriver exporter is already registered.IOExceptionpublic static void createAndRegister()
throws IOException
This uses the default application credentials see GoogleCredentials.getApplicationDefault().
This uses the default project ID configured see ServiceOptions.getDefaultProjectId().
This is equivalent with:
StackdriverExporter.createAndRegisterWithProjectId(ServiceOptions.getDefaultProjectId());
IllegalStateException - if a Stackdriver exporter is already registered.IOExceptionpublic static void unregister()
IllegalStateException - if a Stackdriver exporter is not registered.