private async _registerMetricDescriptor()

in packages/opentelemetry-cloud-monitoring-exporter/src/monitoring.ts [193:210]


  private async _registerMetricDescriptor(
    metric: MetricData
  ): Promise<boolean> {
    const isDescriptorCreated = this.createdMetricDescriptors.has(
      metric.descriptor.name
    );

    if (isDescriptorCreated) {
      return true;
    }

    const res = await this._createMetricDescriptorIfNeeded(metric);
    if (res) {
      this.createdMetricDescriptors.add(metric.descriptor.name);
      return true;
    }
    return false;
  }