code: public static void createAndRegisterWithProjectId(String projectId) throws IOException {
      StackdriverTraceExporter.createAndRegister(
          StackdriverTraceConfiguration.builder()
              .setCredentials(GoogleCredentials.getApplicationDefault())
              .setProjectId(projectId)
              .build());
    }
docs: Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit
  project ID. Only one Stackdriver exporter can be registered at any point.
  
  <p>This uses the default application credentials see {@link
  GoogleCredentials#getApplicationDefault}.
  
  <p>This is equivalent with:
  
  <pre>{@code
  StackdriverExporter.createAndRegisterWithCredentialsAndProjectId(
  GoogleCredentials.getApplicationDefault(), projectId);
  }</pre>
  
  @param projectId the cloud project id.
  @throws IllegalStateException if a Stackdriver exporter is already registered.
  @since 0.6