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 81110a0a43b87e2afa61b9860752a95b18f17909
Author: Robert Munteanu <romb...@apache.org>
AuthorDate: Tue Aug 29 23:57:48 2023 +0200

    metrics-prometheus: register Hotspot metrics by default
---
 pom.xml                                            |  6 +++++
 .../impl/DefaultJvmMetricsRegistrar.java           | 31 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/pom.xml b/pom.xml
index 05a8c8d..7b8c8b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,5 +74,11 @@
             <version>0.0.23</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>io.prometheus</groupId>
+            <artifactId>simpleclient_hotspot</artifactId>
+            <version>0.0.23</version>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>
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
new file mode 100644
index 0000000..b84f16d
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/metrics/prometheus/impl/DefaultJvmMetricsRegistrar.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.metrics.prometheus.impl;
+
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+
+import io.prometheus.client.hotspot.DefaultExports;
+
+@Component(immediate = true)
+public class DefaultJvmMetricsRegistrar {
+
+    @Activate
+    public void activate() {
+        DefaultExports.initialize();
+    }
+}

Reply via email to