code: public static void createAndRegister(PrometheusStatsConfiguration configuration) {
      CollectorRegistry registry = configuration.getRegistry();
      if (registry == null) {
        registry = CollectorRegistry.defaultRegistry;
      }
      new PrometheusStatsCollector(
              Metrics.getExportComponent().getMetricProducerManager(), configuration.getNamespace())
          .register(registry);
    }
docs: Creates a {@link PrometheusStatsCollector} and registers it to the given Prometheus {@link
  CollectorRegistry} in the {@link PrometheusStatsConfiguration}.
  
  <p>If {@code CollectorRegistry} of the configuration is not set, the collector will use {@link
  CollectorRegistry#defaultRegistry}.
  
  @throws IllegalArgumentException if a {@code PrometheusStatsCollector} has already been created
  and registered.
  @since 0.13