diff --git a/README.md b/README.md index 02380ab..0b0ba46 100644 --- a/README.md +++ b/README.md @@ -206,44 +206,7 @@ From the VisualVM website When you connect to a cluster via JMX, you will see the `Tracer` tab as shown below: -   ![Coherence VisualVM Probes](assets/probes.png) - -Each of the probes areas can be expanded to reveal the individual probes. You can select the probes and then -click `Start` to display the information. - -The supported Coherence probes are: - -*Cluster Overview* - -    ![Cluster Overview](assets/probes-cluster-overview.png) - -*Services* - -    ![Cluster Overview](assets/probes-services.png) - -*Caches* - -    ![Caches](assets/probes-caches.png) - -*Proxy Servers* - -    ![Proxy Servers](assets/probes-proxies.png) - -*Persistence* - -    ![Persistence](assets/probes-persistence.png) - -*Federation* - -    ![Federation](assets/probes-federation.png) - -*Elastic Data* - -    ![elastic Data](assets/probes-elastic-data.png) - -> Note: In the initial release of this integration, only summary information can to be plotted. We may include -> additional functionality in future releases to allow for specific services or caches to be monitored. -> There are no timelines for these releases. If you would like specific information included, please raise an issue. +TBC. ## Building the Plugin diff --git a/assets/probes-caches.png b/assets/probes-caches.png deleted file mode 100644 index 586069e..0000000 Binary files a/assets/probes-caches.png and /dev/null differ diff --git a/assets/probes-cluster-overview.png b/assets/probes-cluster-overview.png deleted file mode 100644 index 6ab4ebd..0000000 Binary files a/assets/probes-cluster-overview.png and /dev/null differ diff --git a/assets/probes-elastic-data.png b/assets/probes-elastic-data.png deleted file mode 100644 index cfb44a9..0000000 Binary files a/assets/probes-elastic-data.png and /dev/null differ diff --git a/assets/probes-federation.png b/assets/probes-federation.png deleted file mode 100644 index c4a4828..0000000 Binary files a/assets/probes-federation.png and /dev/null differ diff --git a/assets/probes-persistence.png b/assets/probes-persistence.png deleted file mode 100644 index 6b0022f..0000000 Binary files a/assets/probes-persistence.png and /dev/null differ diff --git a/assets/probes-proxies.png b/assets/probes-proxies.png deleted file mode 100644 index c5656e2..0000000 Binary files a/assets/probes-proxies.png and /dev/null differ diff --git a/assets/probes-services.png b/assets/probes-services.png deleted file mode 100644 index 40dd014..0000000 Binary files a/assets/probes-services.png and /dev/null differ diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMInstaller.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMInstaller.java index a4315c3..2fa786d 100644 --- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMInstaller.java +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMInstaller.java @@ -31,11 +31,13 @@ import com.oracle.coherence.plugin.visualvm.impl.CoherenceClusterProvider; import com.oracle.coherence.plugin.visualvm.tracer.cache.CacheMonitorPackage; +import com.oracle.coherence.plugin.visualvm.tracer.cache.SelectedCacheMonitorPackage; import com.oracle.coherence.plugin.visualvm.tracer.cluster.ClusterMonitorPackage; import com.oracle.coherence.plugin.visualvm.tracer.elasticdata.ElasticDataMonitorPackage; import com.oracle.coherence.plugin.visualvm.tracer.federation.FederationMonitorPackage; import com.oracle.coherence.plugin.visualvm.tracer.persistence.PersistenceMonitorPackage; import com.oracle.coherence.plugin.visualvm.tracer.proxy.ProxyMonitorPackage; +import com.oracle.coherence.plugin.visualvm.tracer.service.SelectedServiceMonitorPackage; import com.oracle.coherence.plugin.visualvm.tracer.service.ServiceMonitorPackage; import org.graalvm.visualvm.application.Application; @@ -120,7 +122,9 @@ public TracerPackage[] getPackages(Application application) new ClusterMonitorPackage(application), new ProxyMonitorPackage(application), new ServiceMonitorPackage(application), + new SelectedServiceMonitorPackage(application), new CacheMonitorPackage(application), + new SelectedCacheMonitorPackage(application), new FederationMonitorPackage(application), new ElasticDataMonitorPackage(application), new PersistenceMonitorPackage(application) diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/CoherenceServicePanel.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/CoherenceServicePanel.java index 25ab066..36ea07e 100755 --- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/CoherenceServicePanel.java +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/CoherenceServicePanel.java @@ -288,11 +288,10 @@ public void updateData() // only include task averages where there is a thread count if (cThread > 0) { - // update values for taks average duration + // update values for task average duration cTotalTaskAverage++; cAverage = (Float) entry.getValue().getColumn(ServiceMemberData.TASK_AVERAGE_DURATION); - nTotalTaskAverage += cAverage; if (cAverage > nMaxTaskAverage) diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/AbstractCoherenceMonitorProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/AbstractCoherenceMonitorProbe.java index d7b997c..dc405bf 100644 --- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/AbstractCoherenceMonitorProbe.java +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/AbstractCoherenceMonitorProbe.java @@ -26,14 +26,21 @@ import com.oracle.coherence.plugin.visualvm.Localization; import com.oracle.coherence.plugin.visualvm.VisualVMModel; + import com.oracle.coherence.plugin.visualvm.tablemodel.model.Data; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData; + import javax.swing.Icon; import javax.swing.ImageIcon; + import org.graalvm.visualvm.application.Application; + import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; import org.graalvm.visualvm.modules.tracer.TracerProbe; + import org.openide.util.ImageUtilities; + import java.util.Arrays; import java.util.List; import java.util.Map; @@ -87,16 +94,20 @@ protected long getValueAsLong(Object oValue) { if (oValue instanceof Long) { - return (Long)oValue; + return (Long) oValue; } if (oValue instanceof Integer) { - return ((Integer)oValue); + return ((Integer) oValue); } if (oValue instanceof String) { return Long.parseLong((String) oValue); } + if (oValue instanceof Float) + { + return ((Float) oValue).longValue(); + } return 0L; } @@ -176,6 +187,182 @@ protected long[] getSingValueMax(VisualVMModel model, VisualVMModel.DataType dat return new long[] {nMax}; } + /** + * Returns the total and idle threads for the selected service. + * @param model the {@link VisualVMModel} to use + * + * @return the tracer result + * 0: Integer - total thread count + * 1: Integer - total idle threads + */ + protected Object[] getSelectedServiceThreadValues(VisualVMModel model) + { + List> data = model.getData(VisualVMModel.DataType.SERVICE_DETAIL); + int nTotalThreadCount = 0; + int nTotalIdleThreads = 0; + + if (data != null && !data.isEmpty()) + { + for (Map.Entry entry : data) + { + nTotalThreadCount += (Integer) entry.getValue().getColumn(ServiceMemberData.THREAD_COUNT); + nTotalIdleThreads += (Integer) entry.getValue().getColumn(ServiceMemberData.THREAD_IDLE_COUNT); + } + } + + return new Object[] {nTotalThreadCount, nTotalIdleThreads}; + } + + /** + * Returns the max and average value for a selected service. + * + * @param model the {@link VisualVMModel} to use + * @param nColumn the column to extract + * + * @return the tracer result (multiplied byt 1000) + * 0: Long - Max + * 1: Long - Average + */ + protected Long[] getSelectedServiceMaxAndAverage(VisualVMModel model, int nColumn) + { + List> data = model.getData(VisualVMModel.DataType.SERVICE_DETAIL); + + long nTotal = 0L; + long nMax = 0L; + long nCount = 0L; + long nCurrent = 0L; + + if (data != null && !data.isEmpty()) + { + for (Map.Entry entry : data) + { + nCurrent = (long) ((Float) entry.getValue().getColumn(nColumn) * 1000L); + if (nCurrent <= 0) + { + // exclude negative values + continue; + } + nCount++; + nTotal += nCurrent; + if (nCurrent > nMax) + { + nMax = nCurrent; + } + } + } + + return nCount == 0L ? new Long[] {0L,0L} : new Long[] {nMax, nTotal / nCount}; + } + + /** + * Returns the total value for a selected service. + * + * @param model the {@link VisualVMModel} to use + * @param nColumn the column to extract + * + * @return the tracer result + */ + protected long getSelectedServiceSumInteger(VisualVMModel model, int nColumn) + { + List> data = model.getData(VisualVMModel.DataType.SERVICE_DETAIL); + + int nTotal = 0; + + if (data != null && !data.isEmpty()) + { + for (Map.Entry entry : data) + { + nTotal += (Integer) entry.getValue().getColumn(nColumn); + } + } + + return nTotal; + } + + /** + * Returns the total value for a selected cache and datatype. + * + * @param model the {@link VisualVMModel} to use + * @param dataType the {@link VisualVMModel.DataType} to extract from + * @param nColumn the column to extract + * + * @return the tracer result + */ + protected long getSelectedCacheSum(VisualVMModel model, VisualVMModel.DataType dataType, int nColumn) + { + List> data = model.getData(dataType); + + long nTotal = 0L; + + if (data != null && !data.isEmpty()) + { + for (Map.Entry entry : data) + { + nTotal += getValueAsLong(entry.getValue().getColumn(nColumn)); + } + } + + return nTotal; + } + + /** + * Returns the max value for a selected cache and datatype. + * + * @param model the {@link VisualVMModel} to use + * @param dataType the {@link VisualVMModel.DataType} to extract from + * @param nColumn the column to extract + * + * @return the tracer result + */ + protected long getSelectedCacheMax(VisualVMModel model, VisualVMModel.DataType dataType, int nColumn) + { + List> data = model.getData(dataType); + + long nMax = 0L; + + if (data != null && !data.isEmpty()) + { + for (Map.Entry entry : data) + { + long nValue = getValueAsLong(entry.getValue().getColumn(nColumn)); + if (nValue > nMax) + { + nMax = nValue; + } + } + } + + return nMax; + } + + /** + * Returns the max value for a selected cache and datatype. + * + * @param model the {@link VisualVMModel} to use + * @param dataType the {@link VisualVMModel.DataType} to extract from + * @param nColumn the column to extract + * + * @return the tracer result multiplied by 1000L + */ + protected long getSelectedCacheAverage(VisualVMModel model, VisualVMModel.DataType dataType, int nColumn) + { + List> data = model.getData(dataType); + + long nTotal = 0L; + long nCount = 0L; + + if (data != null && !data.isEmpty()) + { + for (Map.Entry entry : data) + { + nTotal += getValueAsLong(entry.getValue().getColumn(nColumn)) * 1000L; + nCount++; + } + } + + return nCount == 0 ? 0L : nTotal / nCount; + } + // ----- data members --------------------------------------------------- private final MonitoredDataResolver f_resolver; @@ -190,5 +377,4 @@ protected long[] getSingValueMax(VisualVMModel model, VisualVMModel.DataType dat public static final Icon ICON = new ImageIcon(ImageUtilities.loadImage(IMAGE_PATH, true)); // NOI18N public static final ItemValueFormatter CUSTOM_FORMATTER = new CustomFormatter(1000, ""); - } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheListenersProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheListenersProbe.java new file mode 100644 index 0000000..f90fa04 --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheListenersProbe.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.cache; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheStorageManagerData; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; + +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the total key and filter listeners across all services. + * + * @author tam 2024.03.13 + */ +public class SelectedCacheListenersProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedCacheListenersProbe(MonitoredDataResolver resolver) + { + super(2, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + return new long[]{ + getSelectedCacheSum(model, VisualVMModel.DataType.CACHE_STORAGE_MANAGER, CacheStorageManagerData.LISTENER_KEY_COUNT), + getSelectedCacheSum(model, VisualVMModel.DataType.CACHE_STORAGE_MANAGER, CacheStorageManagerData.LISTENER_FILTER_COUNT)}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_cache_listeners"), + Localization.getLocalText("LBL_selected_cache_listeners_desc"), ICON, 10, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL1), + getMonitorsString(LBL1), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL1 = "LBL_listener_key_count"; + private static final String LBL2 = "LBL_listener_filter_count"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheMemoryProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheMemoryProbe.java new file mode 100644 index 0000000..548dccb --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheMemoryProbe.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.cache; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheStorageManagerData; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; + +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the total memory and index memory across all services. + * + * @author tam 2024.03.13 + */ +public class SelectedCacheMemoryProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedCacheMemoryProbe(MonitoredDataResolver resolver) + { + super(2, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + return new long[]{ + getSelectedCacheSum(model, VisualVMModel.DataType.CACHE_DETAIL, CacheDetailData.MEMORY_BYTES), + getSelectedCacheSum(model, VisualVMModel.DataType.CACHE_STORAGE_MANAGER, CacheStorageManagerData.INDEX_TOTAL_UNITS)}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_cache_memory"), + Localization.getLocalText("LBL_selected_cache_size_desc"), ICON, 10, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL1), + getMonitorsString(LBL1), ItemValueFormatter.DEFAULT_BYTES, + 1d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), ItemValueFormatter.DEFAULT_BYTES, + 1d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL1 = "LBL_total_cache"; + private static final String LBL2 = "LBL_index_memory"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheMonitorPackage.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheMonitorPackage.java new file mode 100644 index 0000000..a119334 --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheMonitorPackage.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.cache; + +import static com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe.ICON; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; +import com.oracle.coherence.plugin.visualvm.VisualVMView; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.application.Application; + +import org.graalvm.visualvm.modules.tracer.TracerPackage; +import org.graalvm.visualvm.modules.tracer.TracerProbe; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + + +/** + * A {@link TracerPackage} to show cache related probes for the currently selected cache. + * + * @author tam 2024.03.12 + */ +public class SelectedCacheMonitorPackage + extends TracerPackage implements AbstractCoherenceMonitorProbe.MonitoredDataResolver { + + public SelectedCacheMonitorPackage(Application application) + { + super(NAME, DESCR, ICON, POSITION); + this.f_model = VisualVMView.getModelForApplication(application); + } + + // ---- TracerPackage methods ------------------------------------------- + + @Override + public TracerProbeDescriptor[] getProbeDescriptors() { + m_sizeProbeDescriptor = SelectedCacheSizeProbe.createDescriptor(f_model != null); + m_memoryProbeDescriptor = SelectedCacheMemoryProbe.createDescriptor(f_model != null); + m_listenersProbeDescriptor = SelectedCacheListenersProbe.createDescriptor(f_model != null); + m_queryProbeDescriptor = SelectedCacheQueryProbe.createDescriptor(f_model != null); + + return new TracerProbeDescriptor[] { + m_sizeProbeDescriptor, + m_memoryProbeDescriptor, + m_listenersProbeDescriptor, + m_queryProbeDescriptor + }; + } + + @Override + public TracerProbe getProbe(TracerProbeDescriptor descriptor) + { + if (descriptor == m_sizeProbeDescriptor) + { + if (m_sizeProbe == null) + { + m_sizeProbe = new SelectedCacheSizeProbe(this); + } + return m_sizeProbe; + } + else if (descriptor == m_memoryProbeDescriptor) + { + if (m_memoryProbe == null) + { + m_memoryProbe = new SelectedCacheMemoryProbe(this); + } + return m_memoryProbe; + } + else if (descriptor == m_listenersProbeDescriptor) + { + if (m_listenersProbe == null) + { + m_listenersProbe = new SelectedCacheListenersProbe(this); + } + return m_listenersProbe; + } + else if (descriptor == m_queryProbeDescriptor) + { + if (m_queryProbe == null) + { + m_queryProbe = new SelectedCacheQueryProbe(this); + } + return m_queryProbe; + } + else + { + return null; + } + } + + // ---- AbstractCoherenceMonitorProbe.MonitoredDataResolver interface --- + + @Override + public VisualVMModel getMonitoredData() + { + return f_model; + } + + // ----- constants ------------------------------------------------------ + + private static final String NAME = Localization.getLocalText("LBL_selected_cache_probe"); + private static final String DESCR = Localization.getLocalText("LBL_selected_cache_probe_description"); + private static final int POSITION = 20511; + + private TracerProbeDescriptor m_sizeProbeDescriptor; + private TracerProbeDescriptor m_memoryProbeDescriptor; + private TracerProbeDescriptor m_listenersProbeDescriptor; + private TracerProbeDescriptor m_queryProbeDescriptor; + + private AbstractCoherenceMonitorProbe m_sizeProbe; + private AbstractCoherenceMonitorProbe m_memoryProbe; + private AbstractCoherenceMonitorProbe m_listenersProbe; + private AbstractCoherenceMonitorProbe m_queryProbe; + + private final VisualVMModel f_model; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheQueryProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheQueryProbe.java new file mode 100644 index 0000000..50b4971 --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheQueryProbe.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.cache; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheStorageManagerData; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData; +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; +import com.oracle.coherence.plugin.visualvm.tracer.CustomFormatter; +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the query information for the currently selected cache. + * + * @author tam 2024.03.12 + */ +public class SelectedCacheQueryProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedCacheQueryProbe(MonitoredDataResolver resolver) + { + super(3, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + return new long[]{ + getSelectedCacheMax(model, VisualVMModel.DataType.CACHE_STORAGE_MANAGER, CacheStorageManagerData.MAX_QUERY_DURATION), + getSelectedCacheAverage(model, VisualVMModel.DataType.CACHE_STORAGE_MANAGER, CacheStorageManagerData.NON_OPTIMIZED_QUERY_AVG), + getSelectedCacheAverage(model, VisualVMModel.DataType.CACHE_STORAGE_MANAGER, CacheStorageManagerData.OPTIMIZED_QUERY_AVG), + }; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_cache_query"), + Localization.getLocalText("LBL_selected_cache_query_desc"), ICON, 20, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), new CustomFormatter(1, "ms"), + 1, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), new CustomFormatter(1000, "ms"), + 1000d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL3), + getMonitorsString(LBL3), new CustomFormatter(1000, "ms"), + 1000d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "LBL_max_query_millis"; + private static final String LBL2 = "LBL_non_opt_avge"; + private static final String LBL3 = "LBL_opt_avge"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheSizeProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheSizeProbe.java new file mode 100644 index 0000000..4e6bf4a --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cache/SelectedCacheSizeProbe.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.cache; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheData; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.CacheDetailData; +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the total number of cache entries across all services. + * + * @author tam 2024.03.13 + */ +public class SelectedCacheSizeProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedCacheSizeProbe(MonitoredDataResolver resolver) + { + super(1, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + return new long[]{getSelectedCacheSum(model, VisualVMModel.DataType.CACHE_DETAIL, CacheDetailData.SIZE)}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_cache_size"), + Localization.getLocalText("LBL_selected_cache_size_desc"), ICON, 10, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "LBL_size"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cluster/ClusterSizeProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cluster/ClusterSizeProbe.java index 3ad7aea..ba250b7 100644 --- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cluster/ClusterSizeProbe.java +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/cluster/ClusterSizeProbe.java @@ -53,7 +53,7 @@ public class ClusterSizeProbe public ClusterSizeProbe(MonitoredDataResolver resolver) { - super(12, createItemDescriptors(), resolver); + super(2, createItemDescriptors(), resolver); } // ---- TracerProbe methods --------------------------------------------- diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceMonitorPackage.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceMonitorPackage.java new file mode 100644 index 0000000..3d5570a --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceMonitorPackage.java @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import static com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe.ICON; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; +import com.oracle.coherence.plugin.visualvm.VisualVMView; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.application.Application; + +import org.graalvm.visualvm.modules.tracer.TracerPackage; +import org.graalvm.visualvm.modules.tracer.TracerProbe; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + + +/** + * A {@link TracerPackage} to show service related probes for the currently selected service. + * + * @author tam 2024.03.12 + */ +public class SelectedServiceMonitorPackage + extends TracerPackage implements AbstractCoherenceMonitorProbe.MonitoredDataResolver { + + public SelectedServiceMonitorPackage(Application application) + { + super(NAME, DESCR, ICON, POSITION); + this.f_model = VisualVMView.getModelForApplication(application); + } + + // ---- TracerPackage methods ------------------------------------------- + + @Override + public TracerProbeDescriptor[] getProbeDescriptors() { + m_threadCountProbeDescriptor = SelectedServiceThreadCountProbe.createDescriptor(f_model != null); + m_threadUtilProbeDescriptor = SelectedServiceThreadUtilizationProbe.createDescriptor(f_model != null); + m_taskAverageProbeDescriptor = SelectedServiceTaskAverageProbe.createDescriptor(f_model != null); + m_requestAverageProbeDescriptor = SelectedServiceRequestAverageProbe.createDescriptor(f_model != null); + m_taskBacklogProbeDescriptor = SelectedServiceTaskBackLogProbe.createDescriptor(f_model != null); + m_partitionsProbeDescriptor = SelectedServicePartitionsProbe.createDescriptor(f_model != null); + + return new TracerProbeDescriptor[] { + m_threadCountProbeDescriptor, + m_threadUtilProbeDescriptor, + m_taskAverageProbeDescriptor, + m_requestAverageProbeDescriptor, + m_taskBacklogProbeDescriptor, + m_partitionsProbeDescriptor + }; + } + + @Override + public TracerProbe getProbe(TracerProbeDescriptor descriptor) + { + if (descriptor == m_threadCountProbeDescriptor) + { + if (m_threadCountProbe == null) + { + m_threadCountProbe = new SelectedServiceThreadCountProbe(this); + } + return m_threadCountProbe; + } + else if (descriptor == m_threadUtilProbeDescriptor) + { + if (m_threadUtilProbe == null) + { + m_threadUtilProbe = new SelectedServiceThreadUtilizationProbe(this); + } + return m_threadUtilProbe; + } + else if (descriptor == m_taskAverageProbeDescriptor) + { + if (m_taskAverageProbe == null) + { + m_taskAverageProbe = new SelectedServiceTaskAverageProbe(this); + } + return m_taskAverageProbe; + } + else if (descriptor == m_requestAverageProbeDescriptor) + { + if (m_requestAverageProbe == null) + { + m_requestAverageProbe = new SelectedServiceRequestAverageProbe(this); + } + return m_requestAverageProbe; + } + else if (descriptor == m_taskBacklogProbeDescriptor) + { + if (m_taskBacklogProbe == null) + { + m_taskBacklogProbe = new SelectedServiceTaskBackLogProbe(this); + } + return m_taskBacklogProbe; + } + else if (descriptor == m_partitionsProbeDescriptor) + { + if (m_partitionsProbe == null) + { + m_partitionsProbe = new SelectedServicePartitionsProbe(this); + } + return m_partitionsProbe; + } + else + { + return null; + } + } + + // ---- AbstractCoherenceMonitorProbe.MonitoredDataResolver interface --- + + @Override + public VisualVMModel getMonitoredData() + { + return f_model; + } + + // ----- constants ------------------------------------------------------ + + private static final String NAME = Localization.getLocalText("LBL_selected_service_probe"); + private static final String DESCR = Localization.getLocalText("LBL_selected_service_probe_description"); + private static final int POSITION = 20506; + + private TracerProbeDescriptor m_threadCountProbeDescriptor; + private TracerProbeDescriptor m_threadUtilProbeDescriptor; + private TracerProbeDescriptor m_taskAverageProbeDescriptor; + private TracerProbeDescriptor m_requestAverageProbeDescriptor; + private TracerProbeDescriptor m_taskBacklogProbeDescriptor; + private TracerProbeDescriptor m_partitionsProbeDescriptor; + + private AbstractCoherenceMonitorProbe m_threadCountProbe; + private AbstractCoherenceMonitorProbe m_threadUtilProbe; + private AbstractCoherenceMonitorProbe m_taskAverageProbe; + private AbstractCoherenceMonitorProbe m_requestAverageProbe; + private AbstractCoherenceMonitorProbe m_taskBacklogProbe; + private AbstractCoherenceMonitorProbe m_partitionsProbe; + + private final VisualVMModel f_model; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServicePartitionsProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServicePartitionsProbe.java new file mode 100644 index 0000000..2bba28d --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServicePartitionsProbe.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tablemodel.model.Data; +import com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceData; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; +import java.util.Map; + +/** + * Tracer probe to return the partition information for the currently selected service. + * + * @author tam 2024.03.12 + */ +public class SelectedServicePartitionsProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedServicePartitionsProbe(MonitoredDataResolver resolver) + { + super(4, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + String sSelectedService = model.getSelectedService(); + + for (Map.Entry entry : model.getData(VisualVMModel.DataType.SERVICE)) + { + // get the service details for the selected service + if (entry.getKey().equals(sSelectedService)) + { + return new long[]{ + (Integer) entry.getValue().getColumn(ServiceData.PARTITIONS_ENDANGERED), + (Integer) entry.getValue().getColumn(ServiceData.PARTITIONS_VULNERABLE), + (Integer) entry.getValue().getColumn(ServiceData.PARTITIONS_UNBALANCED), + (Integer) entry.getValue().getColumn(ServiceData.REQUESTS_PENDING) + }; + } + } + return new long[] {0L, 0L, 0L, 0L}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_service_partitions"), + Localization.getLocalText("LBL_selected_service_partitions_desc"), ICON, 30, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL1), + getMonitorsString(LBL1), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL3), + getMonitorsString(LBL3), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL4), + getMonitorsString(LBL4), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1) + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL1 = "LBL_endangered"; + private static final String LBL2 = "LBL_vulnerable"; + private static final String LBL3 = "LBL_unbalanced"; + private static final String LBL4 = "LBL_pending"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceRequestAverageProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceRequestAverageProbe.java new file mode 100644 index 0000000..248614a --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceRequestAverageProbe.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import com.oracle.coherence.plugin.visualvm.tracer.CustomFormatter; + +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the maximum and average request average for the currently selected service. + * + * @author tam 2024.03.12 + */ +public class SelectedServiceRequestAverageProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedServiceRequestAverageProbe(MonitoredDataResolver resolver) + { + super(2, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + Long[] aoResults = getSelectedServiceMaxAndAverage(model, ServiceMemberData.REQUEST_AVERAGE_DURATION); + + return new long[]{aoResults[0], aoResults[1]}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_service_request_avg"), + Localization.getLocalText("LBL_selected_service_request_avg_desc"), ICON, 20, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), new CustomFormatter(1000, "ms"), + 1000d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), new CustomFormatter(1000, "ms"), + 1000d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "GRPH_current_maximum"; + private static final String LBL2 = "GRPH_current_average"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceTaskAverageProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceTaskAverageProbe.java new file mode 100644 index 0000000..9b8813b --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceTaskAverageProbe.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import com.oracle.coherence.plugin.visualvm.tracer.CustomFormatter; + +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the maximum and average task average for the currently selected service. + * + * @author tam 2024.03.12 + */ +public class SelectedServiceTaskAverageProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedServiceTaskAverageProbe(MonitoredDataResolver resolver) + { + super(2, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + Long[] aoResults = getSelectedServiceMaxAndAverage(model, ServiceMemberData.TASK_AVERAGE_DURATION); + + return new long[]{aoResults[0], aoResults[1]}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_service_task_avg"), + Localization.getLocalText("LBL_selected_service_task_avg_desc"), ICON, 15, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), new CustomFormatter(1000, "ms"), + 1000d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), new CustomFormatter(1000, "ms"), + 1000d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "GRPH_current_maximum"; + private static final String LBL2 = "GRPH_current_average"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceTaskBackLogProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceTaskBackLogProbe.java new file mode 100644 index 0000000..0166955 --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceTaskBackLogProbe.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tablemodel.model.ServiceMemberData; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; + +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the total task backlog for the currently selected service. + * + * @author tam 2024.03.12 + */ +public class SelectedServiceTaskBackLogProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedServiceTaskBackLogProbe(MonitoredDataResolver resolver) + { + super(1, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + return new long[] {getSelectedServiceSumInteger(model, ServiceMemberData.TASK_BACKLOG)}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_service_task_backlog"), + Localization.getLocalText("LBL_selected_service_task_backlog_desc"), ICON, 25, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1) + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "LBL_task_backlog"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceThreadCountProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceThreadCountProbe.java new file mode 100644 index 0000000..6800916 --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceThreadCountProbe.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; + +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; + +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; + +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the total and idle threads for the selected service. + * + * @author tam 2024.03.12 + */ +public class SelectedServiceThreadCountProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedServiceThreadCountProbe(MonitoredDataResolver resolver) + { + super(2, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + Object[] aoResults = getSelectedServiceThreadValues(model); + + return new long[]{(Integer) aoResults[0], (Integer) aoResults[1]}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_service_thread_count"), + Localization.getLocalText("LBL_selected_service_desc"), ICON, 5, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL2), + getMonitorsString(LBL2), ItemValueFormatter.DEFAULT_DECIMAL, + 1d, 0, 1), + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "LBL_total_threads"; + private static final String LBL2 = "LBL_total_idle"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceThreadUtilizationProbe.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceThreadUtilizationProbe.java new file mode 100644 index 0000000..ecb65b5 --- /dev/null +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/SelectedServiceThreadUtilizationProbe.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.coherence.plugin.visualvm.tracer.service; + +import com.oracle.coherence.plugin.visualvm.Localization; +import com.oracle.coherence.plugin.visualvm.VisualVMModel; +import com.oracle.coherence.plugin.visualvm.tracer.AbstractCoherenceMonitorProbe; +import org.graalvm.visualvm.modules.tracer.ItemValueFormatter; +import org.graalvm.visualvm.modules.tracer.ProbeItemDescriptor; +import org.graalvm.visualvm.modules.tracer.TracerProbeDescriptor; + +/** + * Tracer probe to return the cluster size. + * + * @author tam 2024.03.12 + */ +public class SelectedServiceThreadUtilizationProbe + extends AbstractCoherenceMonitorProbe + { + // ----- constructors --------------------------------------------------- + + public SelectedServiceThreadUtilizationProbe(MonitoredDataResolver resolver) + { + super(1, createItemDescriptors(), resolver); + } + + // ---- TracerProbe methods --------------------------------------------- + + @Override + public long[] getValues(VisualVMModel model) + { + Object[] aoResults = getSelectedServiceThreadValues(model); + int nTotalThreads = (Integer) aoResults[0]; + int nTotalIdleThreads = (Integer) aoResults[1]; + + float nThreadUtil = nTotalThreads == 0 ? 0f : (float) (nTotalThreads - nTotalIdleThreads) / nTotalThreads; + return new long[]{(long) (nThreadUtil * 1000.0f)}; + } + + public static TracerProbeDescriptor createDescriptor(boolean available) + { + return new TracerProbeDescriptor(Localization.getLocalText("LBL_selected_service_utilization"), + Localization.getLocalText("LBL_selected_service_utilization_desc"), ICON, 10, available); + } + + private static ProbeItemDescriptor[] createItemDescriptors() + { + return new ProbeItemDescriptor[] + { + ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL), + getMonitorsString(LBL), ItemValueFormatter.DEFAULT_PERCENT, + 1d, 0, 1000) + }; + } + + // ----- constants ------------------------------------------------------ + + private static final String LBL = "LBL_total_utilization"; + } diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/ServiceMonitorPackage.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/ServiceMonitorPackage.java index 320403d..a4267da 100644 --- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/ServiceMonitorPackage.java +++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/tracer/service/ServiceMonitorPackage.java @@ -41,7 +41,7 @@ /** - * A {@link TracerPackage} to show servier related probes. + * A {@link TracerPackage} to show service related probes. * * @author tam 2024.03.06 */ diff --git a/coherence-visualvm-plugin/src/main/resources/com/oracle/coherence/plugin/visualvm/Bundle.properties b/coherence-visualvm-plugin/src/main/resources/com/oracle/coherence/plugin/visualvm/Bundle.properties index d9f6204..c5bfde3 100644 --- a/coherence-visualvm-plugin/src/main/resources/com/oracle/coherence/plugin/visualvm/Bundle.properties +++ b/coherence-visualvm-plugin/src/main/resources/com/oracle/coherence/plugin/visualvm/Bundle.properties @@ -710,20 +710,24 @@ LBL_enter_cluster_port=Enter cluster port LBL_invalid_cluster_port=Invalid cluster port {0}. # Monitor Probes -LBL_cluster_probe=Coherence - Cluster Overview +LBL_cluster_probe=Coherence Cluster Overview LBL_cluster_probe_description=Provides cluster based metrics. -LBL_proxy_probe=Coherence - Proxy Servers -LBL_cache_probe=Coherence - Caches -LBL_persistence_probe=Coherence - Persistence -LBL_federation_probe=Coherence - Federation -LBL_elasticdata_probe=Coherence - Elastic Data -LBL_service_probe=Coherence - Services +LBL_proxy_probe=Coherence Proxy Servers +LBL_cache_probe=Coherence Caches - Overall +LBL_persistence_probe=Coherence Persistence +LBL_federation_probe=Coherence Federation +LBL_elasticdata_probe=Coherence Elastic Data +LBL_service_probe=Coherence Services - Overall +LBL_selected_service_probe=Coherence Services - Selected +LBL_selected_cache_probe=Coherence Caches - Selected LBL_proxy_probe_description=Provides proxy server based metrics. LBL_cache_probe_description=Provides cache based metrics. LBL_persistence_description=Provides persistence based metrics. LBL_federation_probe_description=Provides federation based metrics. LBL_elasticdata_probe_description=Provides elastic data based metrics. LBL_service_probe_description=Provides service based metrics. +LBL_selected_service_probe_description=Provides service based metrics for the currently selected service. +LBL_selected_cache_probe_description=Provides caches based metrics for the currently selected cache. LBL_proxy_desc=Monitors the total number of proxy server connections across all proxy servers. LBL_service_pending_desc=Monitors the total number of pending requests across all partitioned services. LBL_service_endangered_desc=Monitors the total number of endangered partitions across all partitioned services. @@ -753,4 +757,26 @@ LBL_backup_space=Backup Space Used on disk LBL_departure_count=Monitors the number of cluster members that have left. LBL_monitors=Monitors LBL_cluster_members=Cluster Members -LBL_total_cache=Total Primary Cache Data Memory \ No newline at end of file +LBL_total_cache=Total Primary Cache Data Memory +LBL_selected_service_thread_count=Selected Service - Thread Count +LBL_selected_service_desc=Monitors the total number and total idle threads for the currently selected service. +LBL_selected_service_utilization=Selected Service - Thread Utilization +LBL_selected_service_utilization_desc=Monitors the total thread utilization for the currently selected service +LBL_selected_service_task_avg=Selected Service - Task Average +LBL_selected_service_task_avg_desc=Monitors the current and maximum task average duration for the currently selected service. +LBL_selected_service_request_avg=Selected Service - Request Average +LBL_selected_service_request_avg_desc=Monitors the current and maximum request average duration for the currently selected service. +LBL_selected_service_task_backlog=Selected Service - Task Backlog +LBL_selected_service_task_backlog_desc=Monitors the total task backlog for the currently selected service. +LBL_selected_service_partitions=Selected Service - Partitions +LBL_selected_service_partitions_desc=Monitors the partition information for the currently selected service. +LBL_selected_cache_size=Selected Cache - Size +LBL_selected_cache_size_desc=Monitors the cache size for the currently selected cache. +LBL_selected_cache_memory=Selected Cache - Memory +LBL_selected_cache_memory_desc=Monitors the total cache memory and index memory for the currently selected cache for all members. +LBL_selected_cache_index=Selected Cache - Index +LBL_index_memory=Total Index Memory +LBL_selected_cache_listeners=Selected Cache - Listeners +LBL_selected_cache_listeners_desc=Monitors the total key and filter listeners for the currently selected cache for all members. +LBL_selected_cache_query=Selected Cache - Queries +LBL_selected_cache_query_desc=Monitors the max query duration, optimized and non-optimized queries for the currently selected cache for all members. \ No newline at end of file