[ 
https://issues.apache.org/jira/browse/TIKA-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17459668#comment-17459668
 ] 

ASF GitHub Bot commented on TIKA-3353:
--------------------------------------

lewismc commented on a change in pull request #429:
URL: https://github.com/apache/tika/pull/429#discussion_r769272590



##########
File path: 
tika-server/src/main/java/org/apache/tika/server/metrics/ServerStatusMetrics.java
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.tika.server.metrics;
+
+import io.micrometer.core.instrument.Gauge;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.binder.MeterBinder;
+import org.apache.tika.server.ServerStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Server status metrics meter binder.
+ */
+public class ServerStatusMetrics implements MeterBinder {
+
+    /**
+     * The server status currently in use.
+     */
+    private ServerStatus serverStatus;
+
+    /**
+     * Initializes server status metrics with the server status object.
+     * @param serverStatus the server status.
+     */
+    public ServerStatusMetrics(ServerStatus serverStatus) {
+        this.serverStatus = serverStatus;
+    }
+
+    /**
+     * Binds server status metrics to meter registry.
+     * @param meterRegistry the meter registry to bind to.
+     */
+    @Override
+    public void bindTo(@NotNull MeterRegistry meterRegistry) {
+        Gauge.builder("server.status.lastparsed", serverStatus, 
ServerStatus::getMillisSinceLastParseStarted)
+                .description("Last parsed in milliseconds")
+                .register(meterRegistry);
+        Gauge.builder("server.status.restarts", serverStatus, 
ServerStatus::getNumRestarts)
+                .description("Last parsed in milliseconds")

Review comment:
       The help here is incorrect.

##########
File path: 
tika-server/src/main/java/org/apache/tika/server/metrics/ServerStatusMetrics.java
##########
@@ -0,0 +1,61 @@
+/*
+ * 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.tika.server.metrics;
+
+import io.micrometer.core.instrument.Gauge;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.binder.MeterBinder;
+import org.apache.tika.server.ServerStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Server status metrics meter binder.
+ */
+public class ServerStatusMetrics implements MeterBinder {
+
+    /**
+     * The server status currently in use.
+     */
+    private ServerStatus serverStatus;
+
+    /**
+     * Initializes server status metrics with the server status object.
+     * @param serverStatus the server status.
+     */
+    public ServerStatusMetrics(ServerStatus serverStatus) {
+        this.serverStatus = serverStatus;
+    }
+
+    /**
+     * Binds server status metrics to meter registry.
+     * @param meterRegistry the meter registry to bind to.
+     */
+    @Override
+    public void bindTo(@NotNull MeterRegistry meterRegistry) {
+        Gauge.builder("server.status.lastparsed", serverStatus, 
ServerStatus::getMillisSinceLastParseStarted)
+                .description("Last parsed in milliseconds")
+                .register(meterRegistry);
+        Gauge.builder("server.status.restarts", serverStatus, 
ServerStatus::getNumRestarts)
+                .description("Last parsed in milliseconds")
+                .register(meterRegistry);
+        Gauge.builder("server.status.files", serverStatus, 
ServerStatus::getFilesProcessed)
+                .description("Last parsed in milliseconds")

Review comment:
       The help here is incorrect.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Tika Server Production ready monitoring (Prometheus and JMX)
> ------------------------------------------------------------
>
>                 Key: TIKA-3353
>                 URL: https://issues.apache.org/jira/browse/TIKA-3353
>             Project: Tika
>          Issue Type: New Feature
>          Components: server
>    Affects Versions: 2.0.0, 1.26
>            Reporter: Subhajit Das
>            Priority: Major
>              Labels: features
>
> Tika Server only has Server status (/status and it's MBean).
> The MBean, in conjunction with JMX exporter can be used for Prometheus 
> exporting. But it will be oblivious to details, such as time taken to process 
> a request and so on.
>  
> New standard metrics collection system to be implemented, with help 
> [Micrometer|https://micrometer.io/] metrics system, with [CXF 
> pluggability|https://cxf.apache.org/docs/micrometer.html].
> The metrics data can be exported to most of industry standard monitoring 
> tools format (such as Prometheus/Grafana, Gangila etc).
>  
> Prometheus and JMX metrics can be implemented with core metrics collection.
> Choice metrics reporting and nature of metrics can be configured by user.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to