All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.brooklyn.entity.java.UsesJavaMXBeans Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.brooklyn.entity.java;

import java.util.Map;

import org.apache.brooklyn.api.sensor.AttributeSensor;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.sensor.BasicAttributeSensor;
import org.apache.brooklyn.core.sensor.Sensors;
import org.apache.brooklyn.util.core.flags.SetFromFlag;

public interface UsesJavaMXBeans {

    @SetFromFlag("mxbeanStatsEnabled")
    ConfigKey MXBEAN_STATS_ENABLED =
            ConfigKeys.newBooleanConfigKey("java.metrics.mxbeanStatsEnabled", "Enables collection of JVM stats from the MXBeans, such as memory and thread usage (default is true)", true);

    AttributeSensor USED_HEAP_MEMORY =
            Sensors.newLongSensor("java.metrics.heap.used", "Current heap size (bytes)");
    AttributeSensor INIT_HEAP_MEMORY =
            Sensors.newLongSensor("java.metrics.heap.init", "Initial heap size (bytes)");
    AttributeSensor COMMITTED_HEAP_MEMORY =
            Sensors.newLongSensor("java.metrics.heap.committed", "Commited heap size (bytes)");
    AttributeSensor MAX_HEAP_MEMORY =
            Sensors.newLongSensor("java.metrics.heap.max", "Max heap size (bytes)");
    AttributeSensor NON_HEAP_MEMORY_USAGE =
            Sensors.newLongSensor("java.metrics.nonheap.used", "Current non-heap size (bytes)");
    AttributeSensor CURRENT_THREAD_COUNT =
            Sensors.newIntegerSensor( "java.metrics.threads.current", "Current number of threads");
    AttributeSensor PEAK_THREAD_COUNT =
            Sensors.newIntegerSensor("java.metrics.threads.max", "Peak number of threads");

    // runtime system attributes
    AttributeSensor START_TIME =
            Sensors.newLongSensor("java.metrics.starttime", "Start time of Java process (UTC)");
    AttributeSensor UP_TIME =
            Sensors.newLongSensor("java.metrics.uptime", "Uptime of Java process (millis, elapsed since start)");
    
    //operating system attributes
    AttributeSensor PROCESS_CPU_TIME = Sensors.newDoubleSensor( 
            "java.metrics.processCpuTime.total", "Process CPU time (total millis since start)");
    AttributeSensor PROCESS_CPU_TIME_FRACTION_LAST = Sensors.newDoubleSensor( 
            "java.metrics.processCpuTime.fraction.last", "Fraction of CPU time used, reported by JVM (percentage, last datapoint)");
    AttributeSensor PROCESS_CPU_TIME_FRACTION_IN_WINDOW = Sensors.newDoubleSensor( 
            "java.metrics.processCpuTime.fraction.windowed", "Fraction of CPU time used, reported by JVM (percentage, over time window)");
    
    AttributeSensor AVAILABLE_PROCESSORS =
            Sensors.newIntegerSensor("java.metrics.processors.available", "number of processors available to the Java virtual machine");
    AttributeSensor SYSTEM_LOAD_AVERAGE
            = Sensors.newDoubleSensor("java.metrics.systemload.average", "average system load");
    AttributeSensor TOTAL_PHYSICAL_MEMORY_SIZE =
            Sensors.newLongSensor("java.metrics.physicalmemory.total", "The physical memory available to the operating system");
    AttributeSensor FREE_PHYSICAL_MEMORY_SIZE =
            Sensors.newLongSensor("java.metrics.physicalmemory.free", "The free memory available to the operating system");

    // GC attributes
    AttributeSensor GARBAGE_COLLECTION_TIME = new BasicAttributeSensor(Map.class, "java.metrics.gc.time", "garbage collection time");

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy