code: public static void createAndRegisterWithCredentialsAndProjectId(
        Credentials credentials, String projectId) throws IOException {
      StackdriverTraceExporter.createAndRegister(
          StackdriverTraceConfiguration.builder()
              .setCredentials(credentials)
              .setProjectId(projectId)
              .build());
    }
docs: Creates and registers the Stackdriver Trace exporter to the OpenCensus library for an explicit
  project ID and using explicit credentials. Only one Stackdriver exporter can be registered at
  any point.
  
  @param credentials a credentials used to authenticate API calls.
  @param projectId the cloud project id.
  @throws IllegalStateException if a Stackdriver exporter is already registered.
  @since 0.6