Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddlet2666 committed Mar 6, 2024
1 parent df81533 commit 95d068c
Show file tree
Hide file tree
Showing 5 changed files with 288 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,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.cluster.ClusterMonitorPackage;

import com.oracle.coherence.plugin.visualvm.tracer.proxy.ProxyMonitorPackage;
import com.oracle.coherence.plugin.visualvm.tracer.service.ServiceMonitorPackage;

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;
Expand Down Expand Up @@ -114,7 +116,8 @@ public TracerPackage<Application>[] getPackages(Application application)
{
new ClusterMonitorPackage(application),
new ProxyMonitorPackage(application),
new ServiceMonitorPackage(application)
new ServiceMonitorPackage(application),
new CacheMonitorPackage(application)
};
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* 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.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 size of all caches across all services.
*
* @author tam 2024.03.03
*/
public class CacheMemorySizeProbe
extends AbstractCoherenceMonitorProbe
{
// ----- constructors ---------------------------------------------------

public CacheMemorySizeProbe(MonitoredDataResolver resolver)
{
super(1, createItemDescriptors(), resolver);
}

// ---- TracerProbe methods ---------------------------------------------

@Override
public long[] getValues(VisualVMModel model)
{
return getSingValueSum(model, VisualVMModel.DataType.CACHE, CacheData.MEMORY_USAGE_BYTES, ZERO_VALUES1);
}

public static TracerProbeDescriptor createDescriptor(boolean available)
{
return new TracerProbeDescriptor(Localization.getLocalText(LBL),
Localization.getLocalText("LBL_cache_memory_size_desc"), ICON, 10, available);
}

private static ProbeItemDescriptor[] createItemDescriptors()
{
return new ProbeItemDescriptor[]
{
ProbeItemDescriptor.continuousLineFillItem(Localization.getLocalText(LBL),
getMonitorsString(LBL), ItemValueFormatter.DEFAULT_BYTES,
1d, 0, 1),
};
}

// ----- constants ------------------------------------------------------

private static final String LBL = "GRPH_total_cache";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* 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.
*
* @author tam 2024.03.06
*/
public class CacheMonitorPackage
extends TracerPackage<Application> implements AbstractCoherenceMonitorProbe.MonitoredDataResolver {

public CacheMonitorPackage(Application application)
{
super(NAME, DESCR, ICON, POSITION);
this.f_model = VisualVMView.getModelForApplication(application);
}

// ---- TracerPackage methods -------------------------------------------

@Override
public TracerProbeDescriptor[] getProbeDescriptors() {
m_memorySizeProbeDescriptor = CacheMemorySizeProbe.createDescriptor(f_model != null);
m_SizeProbeDescriptor = CacheSizeProbe.createDescriptor(f_model != null);

return new TracerProbeDescriptor[] {
m_memorySizeProbeDescriptor,
m_SizeProbeDescriptor
};
}

@Override
public TracerProbe<Application> getProbe(TracerProbeDescriptor descriptor)
{
if (descriptor == m_memorySizeProbeDescriptor)
{
if (m_memorySizeProbe == null)
{
m_memorySizeProbe = new CacheMemorySizeProbe(this);
}
return m_memorySizeProbe;
}
else if (descriptor == m_SizeProbeDescriptor)
{
if (m_SizeProbe == null)
{
m_SizeProbe = new CacheSizeProbe(this);
}
return m_SizeProbe;
}
else
{
return null;
}
}

// ---- AbstractCoherenceMonitorProbe.MonitoredDataResolver interface ---

@Override
public VisualVMModel getMonitoredData()
{
return f_model;
}

// ----- constants ------------------------------------------------------

private static final String NAME = Localization.getLocalText("LBL_cache_probe");
private static final String DESCR = Localization.getLocalText("LBL_cache_probe_description");
private static final int POSITION = 510;

private TracerProbeDescriptor m_memorySizeProbeDescriptor;
private TracerProbeDescriptor m_SizeProbeDescriptor;

private AbstractCoherenceMonitorProbe m_memorySizeProbe;
private AbstractCoherenceMonitorProbe m_SizeProbe;

private final VisualVMModel f_model;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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.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.03
*/
public class CacheSizeProbe
extends AbstractCoherenceMonitorProbe
{
// ----- constructors ---------------------------------------------------

public CacheSizeProbe(MonitoredDataResolver resolver)
{
super(1, createItemDescriptors(), resolver);
}

// ---- TracerProbe methods ---------------------------------------------

@Override
public long[] getValues(VisualVMModel model)
{
return getSingValueSum(model, VisualVMModel.DataType.CACHE, CacheData.SIZE, ZERO_VALUES1);
}

public static TracerProbeDescriptor createDescriptor(boolean available)
{
return new TracerProbeDescriptor(Localization.getLocalText(LBL),
Localization.getLocalText("LBL_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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -713,14 +713,18 @@ LBL_invalid_cluster_port=Invalid cluster port {0}.
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_service_probe=Coherence - Services
LBL_proxy_probe_description=Provides proxy server based metrics.
LBL_cache_probe_description=Provides cache based metrics.
LBL_service_probe_description=Provides service based metrics.
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.
LBL_service_unbalanced_desc=Monitors the total number of unbalanced partitions across all Partitioned services.
LBL_service_vulnerable_desc=Monitors the total number of vulnerable partitions across all Partitioned services.
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.
LBL_service_unbalanced_desc=Monitors the total number of unbalanced partitions across all partitioned services.
LBL_service_vulnerable_desc=Monitors the total number of vulnerable partitions across all partitioned services.
LBL_cache_memory_size_desc=Monitors the total memory usage by all caches across all partitioned services.
LBL_cache_size_desc=Monitors the total number of cache entries in all caches across all partitioned services.
LBL_proxy_outgoing_desc=Monitors the total outgoing message backlog across all proxy servers.
LBL_storage_members_heap_desc=Monitors allocated and used Heap size for storage members.
LBL_packet_publisher_desc=Monitors average and minimum packet publisher rates across all members.
Expand Down

0 comments on commit 95d068c

Please sign in to comment.