docs: private boolean registerMetricDescriptor(
        io.opencensus.metrics.export.MetricDescriptor metricDescriptor) {
      String metricName = metricDescriptor.getName();
      io.opencensus.metrics.export.MetricDescriptor existingMetricDescriptor =
          registeredMetricDescriptors.get(metricName);
      if (existingMetricDescriptor != null) {
        if (existingMetricDescriptor.equals(metricDescriptor)) {
          // Ignore metricDescriptor that are already registered.
          return true;
        } else {
          logger.log(
              Level.WARNING,
              "A different metric with the same name is already registered: "
                  + existingMetricDescriptor);
          return false;
        }
      }
      registeredMetricDescriptors.put(metricName, metricDescriptor);
      if (isBuiltInMetric(metricName)) {
        return true; // skip creating metric descriptor for stackdriver built-in metrics.
      }
  
      Span span = tracer.getCurrentSpan();
      span.addAnnotation("Create Stackdriver Metric.");
      MetricDescriptor stackDriverMetricDescriptor =
          StackdriverExportUtils.createMetricDescriptor(
              metricDescriptor, projectId, domain, displayNamePrefix, constantLabels);
  
      CreateMetricDescriptorRequest request =
          CreateMetricDescriptorRequest.newBuilder()
              .setName(projectName.toString())
              .setMetricDescriptor(stackDriverMetricDescriptor)
              .build();
      try {
        metricServiceClient.createMetricDescriptor(request);
        span.addAnnotation("Finish creating MetricDescriptor.");
        return true;
      } catch (ApiException e) {
        logger.log(Level.WARNING, "ApiException thrown when creating MetricDescriptor.", e);
        span.setStatus(
            Status.CanonicalCode.valueOf(e.getStatusCode().getCode().name())
                .toStatus()
                .withDescription(
                    "ApiException thrown when creating MetricDescriptor: "
                        + StackdriverExportUtils.exceptionMessage(e)));
        return false;
      } catch (Throwable e) {
        logger.log(Level.WARNING, "Exception thrown when creating MetricDescriptor.", e);
        span.setStatus(
            Status.UNKNOWN.withDescription(
                "Exception thrown when creating MetricDescriptor: "
                    + StackdriverExportUtils.exceptionMessage(e)));
        return false;
      }
    }