Active connection to MongoDB required for fresh project based on Quarkus master, wasn't needed for 1.7.0.Final and prior
Active connection to MongoDB required for fresh project based on master, wasn't needed for 1.7.0.Final and prior.
Getting NPE from SmallRyeMetricsRecorder.registerMetrics(SmallRyeMetricsRecorder.java:217)

Reproducer:
 - build Quarkus master
 - clone https://github.com/quarkus-qe/beefy-scenarios
 - run `mvn clean verify -pl 002-quarkus-all-extensions/`

`mvn clean verify -pl 002-quarkus-all-extensions/ -Dquarkus.platform.version=1.7.0.Final -Dquarkus-plugin.version=1.7.0.Final` passes

Stacktrace (commented out io.quarkus:quarkus-logging-json tependency in 002-quarkus-all-extensions/pom.xml):
```
2020-08-31 10:15:01,619 INFO  [org.mon.dri.cluster] (cluster-ClusterId{value='5f4cb1859520ed1f46c9241c', description='null'}-127.0.0.1:27017) Exception in monitor thread while connecting to server 127.0.0.1:27017: com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:143)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188)
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:78)
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79)
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65)
	... 4 more

2020-08-31 10:15:01,629 INFO  [org.mon.dri.cluster] (cluster-ClusterId{value='5f4cb1859520ed1f46c9241d', description='null'}-127.0.0.1:27017) Exception in monitor thread while connecting to server 127.0.0.1:27017: com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.AsynchronousSocketChannelStream$OpenCompletionHandler.failed(AsynchronousSocketChannelStream.java:124)
	at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:283)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
	at java.base/sun.nio.ch.KQueuePort$EventHandlerTask.run(KQueuePort.java:312)
	at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method)
	at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252)
	... 7 more

2020-08-31 10:15:01,677 ERROR [io.qua.application] (main) Failed to start application (with profile test): java.lang.NullPointerException
	at io.quarkus.smallrye.metrics.runtime.SmallRyeMetricsRecorder.registerMetrics(SmallRyeMetricsRecorder.java:217)
	at io.quarkus.deployment.steps.SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.deploy_0(SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.zig:74)
	at io.quarkus.deployment.steps.SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.deploy(SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:1035)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:212)
```

diff --git a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java
index ccd68171859..ea9e3929f26 100644
--- a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java
+++ b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java
@@ -61,9 +61,10 @@ void metrics(Neo4jConfiguration configuration,
             Neo4jDriverRecorder recorder,
             BuildProducer<MetricsFactoryConsumerBuildItem> metrics) {
         Consumer<MetricsFactory> metricsFactoryConsumer = recorder.registerMetrics(configuration);
-        if (metricsFactoryConsumer != null) {
-            metrics.produce(new MetricsFactoryConsumerBuildItem(metricsFactoryConsumer));
-        }
+        // If metrics for neo4j are disabled, the returned consumer will be null,
+        // but in a processor we can't know that (it's controlled by a runtime config property)
+        // so the BuildItem might contain null and in that case will be ignored by the metrics recorder
+        metrics.produce(new MetricsFactoryConsumerBuildItem(metricsFactoryConsumer));
     }
 
 }
diff --git a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
index e9a16c7a8b1..3f546c26035 100644
--- a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
+++ b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
@@ -214,7 +214,9 @@ public void registerMetric(MetricRegistry.Type scope,
     }
 
     public void registerMetrics(Consumer<MetricsFactory> consumer) {
-        consumer.accept(factory);
+        if (consumer != null) {
+            consumer.accept(factory);
+        }
     }
 
     public void createRegistries(BeanContainer container) {
['extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java', 'extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java']