Search in sources :

Example 1 with MetricsJmxConfig

use of com.hazelcast.config.MetricsJmxConfig in project hazelcast by hazelcast.

the class ClientDomConfigProcessor method handleMetricsJmx.

private void handleMetricsJmx(Node node) {
    MetricsJmxConfig jmxConfig = clientConfig.getMetricsConfig().getJmxConfig();
    NamedNodeMap attributes = node.getAttributes();
    for (int a = 0; a < attributes.getLength(); a++) {
        Node att = attributes.item(a);
        if (matches("enabled", att.getNodeName())) {
            boolean enabled = getBooleanValue(getAttribute(node, "enabled"));
            jmxConfig.setEnabled(enabled);
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node) MetricsJmxConfig(com.hazelcast.config.MetricsJmxConfig)

Example 2 with MetricsJmxConfig

use of com.hazelcast.config.MetricsJmxConfig in project hazelcast by hazelcast.

the class MetricsConfigHelper method overrideMemberMetricsConfig.

/**
 * Overrides the {@link MetricsConfig} in the provided {@link Config}
 * with the metrics system properties if present.
 * See the {@link MetricsConfig} javadoc for the links between metrics
 * configuration fields and the system properties.
 *
 * @param config The configuration
 */
public static void overrideMemberMetricsConfig(Config config, ILogger logger) {
    MetricsConfig metricsConfig = config.getMetricsConfig();
    MetricsManagementCenterConfig managementCenterConfig = metricsConfig.getManagementCenterConfig();
    MetricsJmxConfig jmxConfig = metricsConfig.getJmxConfig();
    // MetricsConfig.enabled
    tryOverride(ClusterProperty.METRICS_ENABLED, config::getProperty, prop -> metricsConfig.setEnabled(Boolean.parseBoolean(prop)), () -> Boolean.toString(metricsConfig.isEnabled()), "MetricsConfig.enabled", logger);
    // MetricsManagementCenterConfig.enabled
    tryOverride(ClusterProperty.METRICS_MC_ENABLED, config::getProperty, prop -> managementCenterConfig.setEnabled(Boolean.parseBoolean(prop)), () -> Boolean.toString(managementCenterConfig.isEnabled()), "MetricsManagementCenterConfig.enabled", logger);
    // MetricsManagementCenterConfig.retentionSeconds
    tryOverride(ClusterProperty.METRICS_MC_RETENTION, config::getProperty, prop -> managementCenterConfig.setRetentionSeconds(Integer.parseInt(prop)), () -> Integer.toString(managementCenterConfig.getRetentionSeconds()), "MetricsManagementCenterConfig.retentionSeconds", logger);
    // MetricsJmxConfig.enabled
    tryOverride(ClusterProperty.METRICS_JMX_ENABLED, config::getProperty, prop -> jmxConfig.setEnabled(Boolean.parseBoolean(prop)), () -> Boolean.toString(jmxConfig.isEnabled()), "MetricsJmxConfig.enabled", logger);
    // MetricsConfig.collectionFrequencySeconds
    tryOverride(ClusterProperty.METRICS_COLLECTION_FREQUENCY, config::getProperty, prop -> metricsConfig.setCollectionFrequencySeconds(Integer.parseInt(prop)), () -> Integer.toString(metricsConfig.getCollectionFrequencySeconds()), "MetricsConfig.collectionFrequencySeconds", logger);
}
Also used : MetricsManagementCenterConfig(com.hazelcast.config.MetricsManagementCenterConfig) MetricsJmxConfig(com.hazelcast.config.MetricsJmxConfig) MetricsConfig(com.hazelcast.config.MetricsConfig) ClientMetricsConfig(com.hazelcast.client.config.ClientMetricsConfig)

Example 3 with MetricsJmxConfig

use of com.hazelcast.config.MetricsJmxConfig in project hazelcast by hazelcast.

the class MetricsConfigHelper method overrideClientMetricsConfig.

/**
 * Overrides the {@link ClientMetricsConfig} in the provided {@link ClientConfig}
 * with the metrics system properties if present.
 * See the {@link ClientMetricsConfig} javadoc for the links between metrics
 * configuration fields and the system properties.
 *
 * @param config The configuration
 */
public static void overrideClientMetricsConfig(ClientConfig config, ILogger logger) {
    ClientMetricsConfig metricsConfig = config.getMetricsConfig();
    MetricsJmxConfig jmxConfig = metricsConfig.getJmxConfig();
    // Check old deprecated STATISTICS settings first.
    // MetricsConfig.collectionFrequencySeconds
    tryOverride(ClientProperty.STATISTICS_PERIOD_SECONDS, config::getProperty, prop -> metricsConfig.setCollectionFrequencySeconds(Integer.parseInt(prop)), () -> Integer.toString(metricsConfig.getCollectionFrequencySeconds()), "ClientMetricsConfig.collectionFrequencySeconds", logger);
    // MetricsConfig.enabled
    tryOverride(ClientProperty.STATISTICS_ENABLED, config::getProperty, prop -> metricsConfig.setEnabled(Boolean.parseBoolean(prop)), () -> Boolean.toString(metricsConfig.isEnabled()), "ClientMetricsConfig.enabled", logger);
    // MetricsConfig.enabled
    tryOverride(ClientProperty.METRICS_ENABLED, config::getProperty, prop -> metricsConfig.setEnabled(Boolean.parseBoolean(prop)), () -> Boolean.toString(metricsConfig.isEnabled()), "ClientMetricsConfig.enabled", logger);
    // MetricsJmxConfig.enabled
    tryOverride(ClientProperty.METRICS_JMX_ENABLED, config::getProperty, prop -> jmxConfig.setEnabled(Boolean.parseBoolean(prop)), () -> Boolean.toString(jmxConfig.isEnabled()), "MetricsJmxConfig.enabled", logger);
    // MetricsConfig.collectionFrequencySeconds
    tryOverride(ClientProperty.METRICS_COLLECTION_FREQUENCY, config::getProperty, prop -> metricsConfig.setCollectionFrequencySeconds(Integer.parseInt(prop)), () -> Integer.toString(metricsConfig.getCollectionFrequencySeconds()), "ClientMetricsConfig.collectionFrequencySeconds", logger);
}
Also used : ClientMetricsConfig(com.hazelcast.client.config.ClientMetricsConfig) MetricsJmxConfig(com.hazelcast.config.MetricsJmxConfig)

Example 4 with MetricsJmxConfig

use of com.hazelcast.config.MetricsJmxConfig in project hazelcast by hazelcast.

the class MemberDomConfigProcessor method handleMetricsJmx.

private void handleMetricsJmx(Node node) {
    MetricsJmxConfig jmxConfig = config.getMetricsConfig().getJmxConfig();
    NamedNodeMap attributes = node.getAttributes();
    for (int a = 0; a < attributes.getLength(); a++) {
        Node att = attributes.item(a);
        if (matches("enabled", att.getNodeName())) {
            boolean enabled = getBooleanValue(getAttribute(node, "enabled"));
            jmxConfig.setEnabled(enabled);
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node) MetricsJmxConfig(com.hazelcast.config.MetricsJmxConfig)

Aggregations

MetricsJmxConfig (com.hazelcast.config.MetricsJmxConfig)4 ClientMetricsConfig (com.hazelcast.client.config.ClientMetricsConfig)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 Node (org.w3c.dom.Node)2 MetricsConfig (com.hazelcast.config.MetricsConfig)1 MetricsManagementCenterConfig (com.hazelcast.config.MetricsManagementCenterConfig)1