diff --git a/.github/workflows/test-against-released.yml b/.github/workflows/test-against-released.yml
index 5fc06dc..aeda9b5 100644
--- a/.github/workflows/test-against-released.yml
+++ b/.github/workflows/test-against-released.yml
@@ -60,6 +60,17 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
+ - name: Set up JDK 8 for Tracer Build
+ uses: actions/setup-java@v3
+ with:
+ java-version: '8'
+ distribution: 'zulu'
+
+ - name: Build Tracer
+ shell: bash
+ run: |
+ ./scripts/install-tracer-library.sh
+
- name: Set up JDK 11 for Build
uses: actions/setup-java@v3
with:
diff --git a/.github/workflows/test-against-snapshot-1440.yml b/.github/workflows/test-against-snapshot-1440.yml
index d563060..103fb04 100644
--- a/.github/workflows/test-against-snapshot-1440.yml
+++ b/.github/workflows/test-against-snapshot-1440.yml
@@ -57,12 +57,17 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-snapshots
- - name: Set up JDK 8 for Build
+ - name: Set up JDK 8 for Tracer Build
uses: actions/setup-java@v3
with:
- java-version: 8
+ java-version: '8'
distribution: 'zulu'
+ - name: Build Tracer
+ shell: bash
+ run: |
+ ./scripts/install-tracer-library.sh
+
- name: Print Versions
run: mvn -version && ant -version
diff --git a/.github/workflows/test-against-snapshot.yml b/.github/workflows/test-against-snapshot.yml
index 231c977..1e57985 100644
--- a/.github/workflows/test-against-snapshot.yml
+++ b/.github/workflows/test-against-snapshot.yml
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2020, 2023 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2020, 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
@@ -58,6 +58,17 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-snapshots
+ - name: Set up JDK 8 for Tracer Build
+ uses: actions/setup-java@v3
+ with:
+ java-version: '8'
+ distribution: 'zulu'
+
+ - name: Build Tracer
+ shell: bash
+ run: |
+ ./scripts/install-tracer-library.sh
+
- name: Set up JDK 17 for Build
uses: actions/setup-java@v3
with:
diff --git a/coherence-visualvm-plugin/pom.xml b/coherence-visualvm-plugin/pom.xml
index f37a5f3..ebcdee5 100644
--- a/coherence-visualvm-plugin/pom.xml
+++ b/coherence-visualvm-plugin/pom.xml
@@ -107,6 +107,11 @@
org-graalvm-visualvm-lib-ui
+
+ org.graalvm.visualvm.modules
+ org-graalvm-visualvm-modules-tracer
+
+
com.fasterxml.jackson.core
jackson-annotations
@@ -125,6 +130,14 @@
coherence-discovery
+
+
+ com.oracle.coherence.plugin.visualvm
+ coherence-visualvm-tracer
+ 1.7.0-SNAPSHOT
+ provided
+
+
org.hamcrest
hamcrest
@@ -164,6 +177,10 @@
${java.version}
${java.version.release}
+
+ --add-opens
+ jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED
+
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 d862d3b..a571063 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -30,6 +30,13 @@
import com.oracle.coherence.plugin.visualvm.impl.CoherenceClusterProvider;
+import com.oracle.coherence.plugin.visualvm.tracer.cluster.ClusterMonitorPackage;
+
+import org.graalvm.visualvm.application.Application;
+import org.graalvm.visualvm.modules.tracer.TracerPackage;
+import org.graalvm.visualvm.modules.tracer.TracerPackageProvider;
+import org.graalvm.visualvm.modules.tracer.TracerSupport;
+
import org.openide.modules.ModuleInstall;
/**
@@ -56,6 +63,14 @@ public void restored()
CoherenceClusterDataSourceViewProvider.register();
CoherenceClusterProvider.initCoherenceClustersDataSource();
CoherenceApplicationTypeFactory.initialize();
+
+ // register the tracer probes
+ if (provider == null)
+ {
+ provider = new TracerPackageProviderImpl();
+ }
+
+ TracerSupport.getInstance().registerPackageProvider(provider);
}
/**
@@ -69,5 +84,34 @@ public void uninstalled()
CoherenceClusterDataSourceDescriptorProvider.unregister();
CoherenceClusterDataSourceViewProvider.unregister();
CoherenceApplicationTypeFactory.shutdown();
+
+ // un-register the tracer probes
+ if (provider == null)
+ {
+ provider = new TracerPackageProviderImpl();
+ }
+
+ TracerSupport.getInstance().unregisterPackageProvider(provider);
}
+
+
+ /**
+ * Provider of Coherence tracer probes.
+ */
+ private static class TracerPackageProviderImpl
+ extends TracerPackageProvider
+ {
+
+ TracerPackageProviderImpl()
+ {
+ super(Application.class);
+ }
+
+ public TracerPackage[] getPackages(Application application)
+ {
+ return new ClusterMonitorPackage[] {new ClusterMonitorPackage(application)};
+ }
}
+
+ private TracerPackageProviderImpl provider;
+ }
diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMView.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMView.java
index 05b49db..dd28840 100644
--- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMView.java
+++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/VisualVMView.java
@@ -62,6 +62,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -157,6 +158,14 @@ protected DataViewComponent createComponent()
{
final VisualVMModel model = VisualVMModel.getInstance();
+ m_model = model;
+
+ // only add the tracer if we are connecting via JMX
+ if (m_application != null)
+ {
+ addModelForApplication(m_application, model);
+ }
+
boolean fClusterSnapshotEnabled = com.oracle.coherence.plugin.visualvm.GlobalPreferences
.sharedInstance().isClusterSnapshotEnabled();
@@ -418,6 +427,9 @@ public void run()
protected void removed()
{
m_timer.stop();
+
+ // remove this application and the mapped VisualVmModel
+ f_visualVmModels.remove(m_application);
}
/**
@@ -430,6 +442,28 @@ public void dataRemoved(Application app)
m_timer.stop();
}
+ /**
+ * Returns the model that is being used for the application.
+ *
+ * @param application {@link Application} to associate with {@link VisualVMModel}
+ * @return the {@link VisualVMModel}
+ */
+ public static VisualVMModel getModelForApplication(Application application)
+ {
+ return f_visualVmModels.get(application);
+ }
+
+ /**
+ * Add the model that is being used for the application.
+ *
+ * @param application {@link Application} to associate with {@link VisualVMModel}
+ * @param model {@link VisualVMModel}
+ */
+ public static void addModelForApplication(Application application, VisualVMModel model)
+ {
+ f_visualVmModels.put(application, model);
+ }
+
// ----- constants ------------------------------------------------------
/**
@@ -447,8 +481,11 @@ public void dataRemoved(Application app)
*/
private static final Logger LOGGER = Logger.getLogger(VisualVMView.class.getName());
+ private static final ConcurrentHashMap f_visualVmModels = new ConcurrentHashMap<>();
+
// ----- data members ---------------------------------------------------
+ private VisualVMModel m_model;
/**
* Component used to display the tabs.
*/
diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/helper/GraphHelper.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/helper/GraphHelper.java
index 30eaea6..49dcf14 100755
--- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/helper/GraphHelper.java
+++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/helper/GraphHelper.java
@@ -1229,9 +1229,9 @@ private static SimpleXYChartSupport createChart(SimpleXYChartDescriptor sxycd)
*/
public static final int VALUES_LIMIT = Integer.getInteger("coherence.plugin.visualvm.values.limit", 50000);
- private static final String GRPH_CURRENT_AVERAGE = "GRPH_current_average";
- private static final String GRPH_MINIMUM = "GRPH_minimum";
- private static final String GRPH_MAXIMUM = "GRPH_maximum";
- private static final String GRPH_AVERAGE = "GRPH_average";
- private static final String GRPH_CURRENT_MAXIMUM = "GRPH_current_maximum";
+ public static final String GRPH_CURRENT_AVERAGE = "GRPH_current_average";
+ public static final String GRPH_MINIMUM = "GRPH_minimum";
+ public static final String GRPH_MAXIMUM = "GRPH_maximum";
+ public static final String GRPH_AVERAGE = "GRPH_average";
+ public static final String GRPH_CURRENT_MAXIMUM = "GRPH_current_maximum";
}
\ No newline at end of file
diff --git a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/AbstractCoherencePanel.java b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/AbstractCoherencePanel.java
index 97f60a2..7b436da 100755
--- a/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/AbstractCoherencePanel.java
+++ b/coherence-visualvm-plugin/src/main/java/com/oracle/coherence/plugin/visualvm/panel/AbstractCoherencePanel.java
@@ -36,6 +36,7 @@
import com.oracle.coherence.plugin.visualvm.helper.RequestSender;
import com.oracle.coherence.plugin.visualvm.tablemodel.model.Data;
import com.oracle.coherence.plugin.visualvm.tablemodel.model.FederationData;
+import com.oracle.coherence.plugin.visualvm.tablemodel.model.MachineData;
import com.oracle.coherence.plugin.visualvm.tablemodel.model.MemberData;
import com.oracle.coherence.plugin.visualvm.tablemodel.model.NodeStorageData;
import com.oracle.coherence.plugin.visualvm.VisualVMModel;
@@ -88,6 +89,8 @@
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
+import static com.oracle.coherence.plugin.visualvm.helper.GraphHelper.MB;
+
/**
* An abstract implementation of a {@link JPanel} which provides basic support
@@ -296,9 +299,9 @@ protected String getFullyQualifiedName(RequestSender requestSender, String sQuer
* @param nodeId the node id to check
* @return true if the node is storage-enabled
*/
- protected boolean isNodeStorageEnabled(int nodeId)
+ public static boolean isNodeStorageEnabled(VisualVMModel model, int nodeId)
{
- List> nodeStorageData = f_model.getData(VisualVMModel.DataType.NODE_STORAGE);
+ List> nodeStorageData = model.getData(VisualVMModel.DataType.NODE_STORAGE);
if (nodeStorageData != null)
{
@@ -773,8 +776,111 @@ protected static String getServiceName(String sSelectedServiceName)
{
String[] asParts = AbstractData.getDomainAndService(sSelectedServiceName);
return asParts[1];
+ }
+
+ /**
+ * Return the machineData data for overview and tracers.
+ *
+ * @param machineData member data to introspect
+ * @return the data, 0 = Integer, count
+ * 1 = Double, cTotalLoadAverage
+ * 2 = Double, cMax
+ */
+ public static Object[] getClusterLoadAverage(List> machineData)
+ {
+ int cCount = 0;
+ double cLoadAverage = 0;
+ double cMax = -1;
+ double cTotalLoadAverage = 0;
+
+ // work out the max and average load averages for the graph
+ if (machineData != null)
+ {
+ for (Map.Entry
+
+
+ org.graalvm.visualvm.modules
+ org-graalvm-visualvm-modules-tracer
+ ${visualvm.version}
+
+
org.netbeans.api
org-openide-modules
@@ -259,6 +266,10 @@
${java.version}
${java.version.release}
+
+ --add-opens
+ jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED
+
diff --git a/scripts/install-tracer-library.sh b/scripts/install-tracer-library.sh
new file mode 100755
index 0000000..f4e51dc
--- /dev/null
+++ b/scripts/install-tracer-library.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# 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.
+#
+#
+# Purpose: Build and install the org-graalvm-visualvm-modules-tracer plugin as it is not available in Maven.
+set -e
+echo "Installing required tracer VisualVM dependencies"
+TEMP_DIR=`mktemp -d`
+echo "Temp dir = ${TEMP_DIR}"
+
+trap "rm -rf $TEMP_DIR 2>&1 > /dev/null" 0 1 2 3
+
+cd $TEMP_DIR
+echo "Cloning VisualVM..."
+git clone https://github.com/oracle/visualvm.git
+cd visualvm
+git checkout 2.1.7
+
+curl -Lo /tmp/nb140_platform_20230511.zip https://github.com/oracle/visualvm/releases/download/2.1.7/nb140_platform_20230511.zip
+cd visualvm
+unzip /tmp/nb140_platform_20230511.zip
+
+echo "Building VisualVM..."
+ant build-zip
+
+cd ../plugins
+ant build
+
+MODULE_NAME=org-graalvm-visualvm-modules-tracer
+
+TRACER=`find . -name ${MODULE_NAME}.jar | sed 1q`
+FULL_PATH=`pwd`/${TRACER}
+
+echo "Installing ${FULL_PATH}"
+
+set -x
+mvn install:install-file -Dfile=${FULL_PATH} -DgroupId=org.graalvm.visualvm.modules -DartifactId=org-graalvm-visualvm-modules-tracer -Dversion=2.1 -Dpackaging=jar
+
+ls -l ~/.m2/repository/org/graalvm/visualvm/modules/org-graalvm-visualvm-modules-tracer/2.1
+
+
+