.objectName(SOCKET_SERVER_STATS_MBEAN) .attributeName("NumFetchRequests") .onException(Functions.constant(-1l)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(TOTAL_FETCH_TIME) .objectName(SOCKET_SERVER_STATS_MBEAN) .attributeName("TotalFetchRequestMs") .onException(Functions.constant(-1l)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Double>(MAX_FETCH_TIME) .objectName(SOCKET_SERVER_STATS_MBEAN) .attributeName("MaxFetchRequestMs") .onException(Functions.constant(-1.0d)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(PRODUCE_REQUEST_COUNT) .objectName(SOCKET_SERVER_STATS_MBEAN) .attributeName("NumProduceRequests") .onException(Functions.constant(-1l)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Long>(TOTAL_PRODUCE_TIME) .objectName(SOCKET_SERVER_STATS_MBEAN) .attributeName("TotalProduceRequestMs") .onException(Functions.constant(-1l)) .enabled(retrieveUsageMetrics)) .pollAttribute(new JmxAttributePollConfig<Double>(MAX_PRODUCE_TIME) .objectName(SOCKET_SERVER_STATS_MBEAN) .attributeName("MaxProduceRequestMs") .onException(Functions.constant(-1.0d)) .enabled(retrieveUsageMetrics))
@Override protected void connectSensors() { super.connectSensors(); String serverInfoMBeanName = "org.apache.qpid:type=ServerInformation,name=ServerInformation"; jmxFeed = JmxFeed.builder() .entity(this) .period(500, TimeUnit.MILLISECONDS) .pollAttribute(new JmxAttributePollConfig<Boolean>(SERVICE_UP) .objectName(serverInfoMBeanName) .attributeName("ProductVersion") .onSuccess(new Function<Object,Boolean>() { private boolean hasWarnedOfVersionMismatch; @Override public Boolean apply(Object input) { if (input == null) return false; if (!hasWarnedOfVersionMismatch && !getConfig(QpidBroker.SUGGESTED_VERSION).equals(input)) { log.warn("Qpid version mismatch: ProductVersion is {}, requested version is {}", input, getConfig(QpidBroker.SUGGESTED_VERSION)); hasWarnedOfVersionMismatch = true; } return true; }}) .onException(Functions.constant(false)) .suppressDuplicates(true)) .build(); }
.onException(Functions.constant(false)) .suppressDuplicates(true)) .pollAttribute(new JmxAttributePollConfig<Integer>(ERROR_COUNT)