Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 1 addition & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

## <a id="build"></a> Building the Plugin

Expand Down
Binary file removed assets/probes-caches.png
Binary file not shown.
Binary file removed assets/probes-cluster-overview.png
Binary file not shown.
Binary file removed assets/probes-elastic-data.png
Binary file not shown.
Binary file removed assets/probes-federation.png
Binary file not shown.
Binary file removed assets/probes-persistence.png
Binary file not shown.
Binary file removed assets/probes-proxies.png
Binary file not shown.
Binary file removed assets/probes-services.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -120,7 +122,9 @@ public TracerPackage<Application>[] 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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<Map.Entry<Object, Data>> data = model.getData(VisualVMModel.DataType.SERVICE_DETAIL);
int nTotalThreadCount = 0;
int nTotalIdleThreads = 0;

if (data != null && !data.isEmpty())
{
for (Map.Entry<Object, Data> 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<Map.Entry<Object, Data>> 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<Object, Data> 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<Map.Entry<Object, Data>> data = model.getData(VisualVMModel.DataType.SERVICE_DETAIL);

int nTotal = 0;

if (data != null && !data.isEmpty())
{
for (Map.Entry<Object, Data> 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<Map.Entry<Object, Data>> data = model.getData(dataType);

long nTotal = 0L;

if (data != null && !data.isEmpty())
{
for (Map.Entry<Object, Data> 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<Map.Entry<Object, Data>> data = model.getData(dataType);

long nMax = 0L;

if (data != null && !data.isEmpty())
{
for (Map.Entry<Object, Data> 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<Map.Entry<Object, Data>> data = model.getData(dataType);

long nTotal = 0L;
long nCount = 0L;

if (data != null && !data.isEmpty())
{
for (Map.Entry<Object, Data> entry : data)
{
nTotal += getValueAsLong(entry.getValue().getColumn(nColumn)) * 1000L;
nCount++;
}
}

return nCount == 0 ? 0L : nTotal / nCount;
}

// ----- data members ---------------------------------------------------

private final MonitoredDataResolver f_resolver;
Expand All @@ -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, "");

}
Loading