code: public static void createAndRegister() throws IOException {
      StackdriverTraceExporter.createAndRegister(
          StackdriverTraceConfiguration.builder()
              .setCredentials(GoogleCredentials.getApplicationDefault())
  
              // TODO(sebright): Handle null default project ID.
              .setProjectId(castNonNull(ServiceOptions.getDefaultProjectId()))
              .build());
    }
docs: Creates and registers the Stackdriver Trace exporter to the OpenCensus library. Only one
  Stackdriver exporter can be registered at any point.
  
  <p>This uses the default application credentials see {@link
  GoogleCredentials#getApplicationDefault}.
  
  <p>This uses the default project ID configured see {@link ServiceOptions#getDefaultProjectId}.
  
  <p>This is equivalent with:
  
  <pre>{@code
  StackdriverExporter.createAndRegisterWithProjectId(ServiceOptions.getDefaultProjectId());
  }</pre>
  
  @throws IllegalStateException if a Stackdriver exporter is already registered.
  @since 0.6