constructor()

in packages/opentelemetry-cloud-trace-exporter/src/trace.ts [49:70]


  constructor(options: TraceExporterOptions = {}) {
    this._resourceFilter = options.resourceFilter;
    this._stringifyArrayAttributes = options.stringifyArrayAttributes ?? false;

    this._auth = new GoogleAuth({
      credentials: options.credentials,
      keyFile: options.keyFile,
      keyFilename: options.keyFilename,
      projectId: options.projectId,
      scopes: ['https://www.googleapis.com/auth/cloud-platform'],
    });

    // Start this async process as early as possible. It will be
    // awaited on the first export because constructors are synchronous
    this._projectId = this._auth.getProjectId().catch(err => {
      diag.error(err);
    });

    if (options.apiEndpoint) {
      this._apiEndpoint = options.apiEndpoint;
    }
  }