WebManager[] managers = PortletManager.getCurrentServer(renderRequest).getWebManagers();
if (managers != null) {
WebManager manager = managers[0]; //todo: handle multiple
WebContainer[] containers = (WebContainer[]) manager.getContainers();
if (containers != null) {
WebContainer container = containers[0]; //todo: handle multiple
if(container.isStatisticsProvider()) {
boolean populateStats = false;
renderRequest.setAttribute("statsSupported", Boolean.TRUE); // indicate that statistics are supported for this container
if (container instanceof LazyStatisticsProvider) {
renderRequest.setAttribute("statsLazy", Boolean.TRUE); // indicate that enable/disable should be shown for this container