You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ti...@apache.org on 2022/01/17 11:16:45 UTC
[ignite] branch master updated: IGNITE-15649 : Add documentation for the java service duration metrics (#9454)
This is an automated email from the ASF dual-hosted git repository.
timoninmaxim pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 21a552a IGNITE-15649 : Add documentation for the java service duration metrics (#9454)
21a552a is described below
commit 21a552a1259aff5f97930a4202efb9bde3ad1442
Author: Vladimir Steshin <vl...@gmail.com>
AuthorDate: Mon Jan 17 14:16:05 2022 +0300
IGNITE-15649 : Add documentation for the java service duration metrics (#9454)
---
.../ignite/snippets/services/ServiceExample.java | 24 ++++++++++++++++++-
docs/_docs/services/services.adoc | 27 ++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/services/ServiceExample.java b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/services/ServiceExample.java
index a1658f1..c57856c 100644
--- a/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/services/ServiceExample.java
+++ b/docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/services/ServiceExample.java
@@ -87,7 +87,7 @@ public class ServiceExample {
//tag::deploy-by-key[]
Ignite ignite = Ignition.start();
- //making sure the cache exists
+ // Making sure the cache exists.
ignite.getOrCreateCache("orgCache");
ServiceConfiguration serviceCfg = new ServiceConfiguration();
@@ -157,6 +157,28 @@ public class ServiceExample {
}
@Test
+ void startWithStatistics() {
+ //tag::start-with-statistics[]
+ Ignite ignite = Ignition.start();
+
+ ServiceConfiguration serviceCfg = new ServiceConfiguration();
+
+ serviceCfg.setName("myService");
+ serviceCfg.setMaxPerNodeCount(1);
+ serviceCfg.setService(new MyCounterServiceImpl());
+
+ // Enable service statistics.
+ serviceCfg.setStatisticsEnabled(true);
+
+ ignite.services().deploy(serviceCfg);
+
+ MyCounterService svc = ignite.services().serviceProxy("myService", MyCounterService.class, true)
+ //end::start-with-statistics[]
+
+ ignite.close();
+ }
+
+ @Test
void serviceConfiguration() {
//tag::service-configuration[]
ServiceConfiguration serviceCfg = new ServiceConfiguration();
diff --git a/docs/_docs/services/services.adoc b/docs/_docs/services/services.adoc
index dfdf114..8ff98ab 100644
--- a/docs/_docs/services/services.adoc
+++ b/docs/_docs/services/services.adoc
@@ -261,6 +261,33 @@ Use the following procedure to redeploy the service:
In this way, you don't have to stop the server nodes, so you don't interrupt the operation of your cluster.
+== Service Statistics
+
+You can measure durations of your service's methods. If you want this analytics, enable service statistics in the
+service configuration. Service statistics are collected under name "Services" in
+link:monitoring-metrics/new-metrics-system.adoc[metrics], in
+link:monitoring-metrics/system-views.adoc[system views], and in JMX.
+
+[tabs]
+--
+tab:Java[]
+[source, java]
+----
+include::{javaFile}[tags=start-with-statistics, indent=0]
+----
+tab:C#/.NET[]
+tab:C++[]
+--
+
+[NOTE]
+====
+You should be aware:
+
+1. Overloaded service methods have the same metric by the method name.
+2. Service statistics do not take in account serialization and network issues.
+3. Service statistics slows down the invocations of service methods. Probably it's not
+an issue for slow-by-nature jobs like working with a DB.
+====
// TODO: add how to call java services from .NET