@Override public List<MetricFamilySamples> collect() { GaugeMetricFamily testSessionMetric = new GaugeMetricFamily("selenium_test_sessions_running", "The number of Selenium test sessions that are running by proxy type", Collections.singletonList("proxy")); Iterable<RemoteProxy> iterable = () -> proxySet.iterator(); Map<String, Integer> countByProxies = StreamSupport.stream(iterable.spliterator(), false).collect( Collectors.groupingBy(p -> p.getClass().getSimpleName(), Collectors.summingInt(p -> p.getTotalUsed()))); countByProxies.entrySet().stream() .forEach(e -> testSessionMetric.addMetric(Collections.singletonList(e.getKey()), e.getValue())); List<MetricFamilySamples> mfs = new ArrayList<MetricFamilySamples>(); mfs.add(testSessionMetric); return mfs; }
private List<URL> getRegistryURLs(GridRegistry registry) { Iterator<RemoteProxy> remoteProxyIterator = registry.getAllProxies().iterator(); List<URL> urlList = new ArrayList<>(); while (remoteProxyIterator.hasNext()) { RemoteProxy remoteProxy = remoteProxyIterator.next(); urlList.add(remoteProxy.getRemoteHost()); } return urlList; }
private List<URL> getRegistryURLs(Registry registry) { Iterator<RemoteProxy> remoteProxyIterator = registry.getAllProxies().iterator(); List<URL> urlList = new ArrayList<>(); while (remoteProxyIterator.hasNext()) { RemoteProxy remoteProxy = remoteProxyIterator.next(); urlList.add(remoteProxy.getRemoteHost()); } return urlList; }
private List<ProxyInfo> getProxyInfo(boolean doStatusQuery) { List<ProxyInfo> nodes = new ArrayList<>(); ProxySet proxies = this.getRegistry().getAllProxies(); Iterator<RemoteProxy> iterator = proxies.iterator(); while (iterator.hasNext()) { RemoteProxy proxy = iterator.next(); nodes.add(new ProxyInfo(proxy, doStatusQuery)); } return nodes; } }
private List<ProxyInfo> getProxyInfo(boolean doStatusQuery) { List<ProxyInfo> nodes = new ArrayList<>(); ProxySet proxies = this.getRegistry().getAllProxies(); Iterator<RemoteProxy> iterator = proxies.iterator(); while (iterator.hasNext()) { RemoteProxy proxy = iterator.next(); nodes.add(new ProxyInfo(proxy, doStatusQuery)); } return nodes; } }
private List<ProxyInfo> getProxyInfo() { List<ProxyInfo> nodes = new ArrayList<>(); ProxySet proxies = this.getRegistry().getAllProxies(); Iterator<RemoteProxy> iterator = proxies.iterator(); while (iterator.hasNext()) { RemoteProxy proxy = iterator.next(); if ((proxy instanceof SeLionRemoteProxy) && (((SeLionRemoteProxy) proxy).supportsForceShutdown())) { nodes.add(new ProxyInfo(proxy, false)); } } return nodes; } }
private List<ProxyInfo> getProxyInfo() { List<ProxyInfo> nodes = new ArrayList<>(); ProxySet proxies = this.getRegistry().getAllProxies(); Iterator<RemoteProxy> iterator = proxies.iterator(); while (iterator.hasNext()) { RemoteProxy proxy = iterator.next(); if ((proxy instanceof SeLionRemoteProxy) && (((SeLionRemoteProxy) proxy).supportsForceShutdown())) { nodes.add(new ProxyInfo(proxy, false)); } } return nodes; } }
public Void call() throws Exception { GridRegistry registry = HubHolder.getHub().getRegistry(); if (registry != null) { Iterator<RemoteProxy> it = registry.getAllProxies().iterator(); while (it.hasNext()) { RemoteProxy proxy = it.next(); if (remoteUrl.equals(proxy.getRemoteHost().toString())) { registry.removeIfPresent(proxy); } } } return null; }
private JsonObject getResponse() throws IOException { JsonObject requestJSON = new JsonObject(); ProxySet proxies = this.getRegistry().getAllProxies(); Iterator<RemoteProxy> iterator = proxies.iterator(); JsonArray busyProxies = new JsonArray(); JsonArray freeProxies = new JsonArray(); while (iterator.hasNext()) { RemoteProxy eachProxy = iterator.next(); if (eachProxy.isBusy()) { busyProxies.add(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON()); } else { freeProxies.add(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON()); } } requestJSON.add("BusyProxies", busyProxies); requestJSON.add("FreeProxies", freeProxies); return requestJSON; }
private JsonObject getResponse() throws IOException { JsonObject requestJSON = new JsonObject(); ProxySet proxies = this.getRegistry().getAllProxies(); Iterator<RemoteProxy> iterator = proxies.iterator(); JsonArray busyProxies = new JsonArray(); JsonArray freeProxies = new JsonArray(); while (iterator.hasNext()) { RemoteProxy eachProxy = iterator.next(); if (eachProxy.isBusy()) { busyProxies.add(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON()); } else { freeProxies.add(eachProxy.getOriginalRegistrationRequest().getAssociatedJSON()); } } requestJSON.add("BusyProxies", busyProxies); requestJSON.add("FreeProxies", freeProxies); return requestJSON; }