This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-metrics-prometheus.git

commit 1300f48b4090230d02db93f0f0603a14d23c3a87
Author: Robert Munteanu <romb...@apache.org>
AuthorDate: Wed Aug 30 00:22:29 2023 +0200

    metrics-prometheus: add basic documentation
---
 README.md                                                      | 10 ++++++++++
 .../metrics/prometheus/impl/DefaultJvmMetricsRegistrar.java    |  3 +++
 .../sling/metrics/prometheus/impl/WrapperMetricsServlet.java   |  7 +++++++
 3 files changed, 20 insertions(+)

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5e4e417
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+[![Apache 
Sling](https://sling.apache.org/res/logos/sling.png)](https://sling.apache.org)
+
+# Apache Sling Commons Metrics Prometheus
+
+This module is part of the [Apache Sling](https://sling.apache.org) project.
+
+This bundle exposes the collected metrics under the `/metrics` path and 
provides the following features:
+
+- exports JVM metrics by default
+- supports multiple `MetricRegistry` instances
\ No newline at end of file
diff --git 
a/src/main/java/org/apache/sling/metrics/prometheus/impl/DefaultJvmMetricsRegistrar.java
 
b/src/main/java/org/apache/sling/metrics/prometheus/impl/DefaultJvmMetricsRegistrar.java
index b84f16d..9ac10c1 100644
--- 
a/src/main/java/org/apache/sling/metrics/prometheus/impl/DefaultJvmMetricsRegistrar.java
+++ 
b/src/main/java/org/apache/sling/metrics/prometheus/impl/DefaultJvmMetricsRegistrar.java
@@ -21,6 +21,9 @@ import org.osgi.service.component.annotations.Component;
 
 import io.prometheus.client.hotspot.DefaultExports;
 
+/**
+ * Registers the default JVM metrics with the default registry
+ */
 @Component(immediate = true)
 public class DefaultJvmMetricsRegistrar {
 
diff --git 
a/src/main/java/org/apache/sling/metrics/prometheus/impl/WrapperMetricsServlet.java
 
b/src/main/java/org/apache/sling/metrics/prometheus/impl/WrapperMetricsServlet.java
index 9fe7ce6..a9902e8 100644
--- 
a/src/main/java/org/apache/sling/metrics/prometheus/impl/WrapperMetricsServlet.java
+++ 
b/src/main/java/org/apache/sling/metrics/prometheus/impl/WrapperMetricsServlet.java
@@ -48,6 +48,13 @@ import io.prometheus.client.CollectorRegistry;
 import io.prometheus.client.dropwizard.DropwizardExports;
 import io.prometheus.client.exporter.MetricsServlet;
 
+/**
+ * Exports metrics taking into account multiple registry instances
+ * 
+ * <p>For historical reasons, Sling and Oak have their own metrics registry 
implementations. This
+ * may occur for other applications as well so we take care to gracefully 
handle multiple child
+ * registries.</p>
+ */
 @HttpWhiteboardServletPattern("/metrics")
 
@HttpWhiteboardContextSelect("(osgi.http.whiteboard.context.name=org.osgi.service.http)")
 @Component(service = Servlet.class)

Reply via email to