diff --git a/commons/src/main/java/org/restheart/utils/PluginUtils.java b/commons/src/main/java/org/restheart/utils/PluginUtils.java index 30105ef870..2ce44db896 100644 --- a/commons/src/main/java/org/restheart/utils/PluginUtils.java +++ b/commons/src/main/java/org/restheart/utils/PluginUtils.java @@ -226,13 +226,12 @@ public static
String defaultURI(Class
serviceClass) { /** * * @param
- * @param conf the plugin configuration got from @InjectConfiguration + * @param conf the plugin configuration got from @Inject("conf") * @param serviceClass the class of the service * @return the actual service uri set in cofiguration or the defaultURI */ @SuppressWarnings("rawtypes") public static
String actualUri(Map serviceClass) {
-
if (conf != null && conf.get("uri") != null && conf.get("uri") instanceof String) {
return (String) conf.get("uri");
} else {
diff --git a/core/src/main/java/org/restheart/graal/PluginsReflectionRegistrationFeature.java b/core/src/main/java/org/restheart/graal/PluginsReflectionRegistrationFeature.java
index 2adeee4558..863a44023e 100644
--- a/core/src/main/java/org/restheart/graal/PluginsReflectionRegistrationFeature.java
+++ b/core/src/main/java/org/restheart/graal/PluginsReflectionRegistrationFeature.java
@@ -102,8 +102,7 @@ private Field[] annotated(Field... fields) {
* selects methods annotated with @OnInit
*
* @param fields
- * @return an array of methods that are annotated
- * with @OnInit, @InjectMongoClient, @InjectConfiguration, @InjectPluginsRegistry
+ * @return an array of methods that are annotated with @OnInit
*/
private Method[] annotated(Method... methods) {
var list = Arrays.stream(methods)
diff --git a/core/src/main/resources/restheart-default-config-no-mongodb.yml b/core/src/main/resources/restheart-default-config-no-mongodb.yml
index b7ba9b75f4..163fe94602 100644
--- a/core/src/main/resources/restheart-default-config-no-mongodb.yml
+++ b/core/src/main/resources/restheart-default-config-no-mongodb.yml
@@ -460,11 +460,13 @@ logging:
# - traceparent # vv opencensus.io headers, see https://github.com/w3c/distributed-tracing/blob/master/trace_context/HTTP_HEADER_FORMAT.md
# - tracestate # ^^
-# Metrics
-# see https://restheart.org/docs/metrics
+# Metrics see https://restheart.org/docs/metrics
+metrics:
+ enabled: true
+ uri: /metrics
+
requestsMetricsCollector:
enabled: false
- uri: /metrics
include: ["/*"]
exclude: ["/metrics", "/metrics/*"]
diff --git a/core/src/main/resources/restheart-default-config.yml b/core/src/main/resources/restheart-default-config.yml
index dbeafaa05a..29ff5000f2 100644
--- a/core/src/main/resources/restheart-default-config.yml
+++ b/core/src/main/resources/restheart-default-config.yml
@@ -445,11 +445,14 @@ logging:
# - traceparent # vv opencensus.io headers, see https://github.com/w3c/distributed-tracing/blob/master/trace_context/HTTP_HEADER_FORMAT.md
# - tracestate # ^^
-# Metrics
-# see https://restheart.org/docs/metrics
+# Metrics see https://restheart.org/docs/metrics
+
+metrics:
+ enabled: true
+ uri: /metrics
+
requestsMetricsCollector:
enabled: false
- uri: /metrics
include: [ "/*" ]
exclude: [ "/metrics", "/metrics/*" ]
diff --git a/metrics/src/main/java/org/restheart/metrics/MetricsService.java b/metrics/src/main/java/org/restheart/metrics/MetricsService.java
index df5597eb64..d3582a2cd5 100644
--- a/metrics/src/main/java/org/restheart/metrics/MetricsService.java
+++ b/metrics/src/main/java/org/restheart/metrics/MetricsService.java
@@ -20,9 +20,14 @@
*/
package org.restheart.metrics;
+import java.io.IOException;
import java.io.StringWriter;
+import java.util.Map;
+
import org.restheart.exchange.StringRequest;
import org.restheart.exchange.StringResponse;
+import org.restheart.plugins.Inject;
+import org.restheart.plugins.OnInit;
import org.restheart.plugins.RegisterPlugin;
import org.restheart.plugins.StringService;
import static org.restheart.utils.BsonUtils.array;
@@ -38,7 +43,7 @@
*
* @author Andrea Di Cesare {@literal