/*
* Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 com.github.lpezet.antiope.metrics.aws;
import com.github.lpezet.antiope.metrics.MetricType;
/**
* <a href=
* "http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/metrics/package-summary.html"
* >Machine Metrics</a>.
*/
enum MachineMetric implements MetricType {
// JVM Metrics
TotalMemory(Dim.Memory, MetricName.JvmMetric),
FreeMemory(Dim.Memory, MetricName.JvmMetric),
UsedMemory(Dim.Memory, MetricName.JvmMetric),
SpareMemory(Dim.Memory, MetricName.JvmMetric),
ThreadCount(Dim.Threads, MetricName.JvmMetric),
DeadLockThreadCount(Dim.Threads, MetricName.JvmMetric, _.EXCLUDES_ZERO_VALUES), // exclude zero value datum
DaemonThreadCount(Dim.Threads, MetricName.JvmMetric, _.EXCLUDES_ZERO_VALUES), // exclude zero value datum
PeakThreadCount(Dim.Threads, MetricName.JvmMetric),
TotalStartedThreadCount(Dim.Threads, MetricName.JvmMetric),
// OS Metrics
OpenFileDescriptorCount(Dim.FileDescriptors, MetricName.OSMetric),
SpareFileDescriptorCount(Dim.FileDescriptors, MetricName.OSMetric),
;
private final Dim mDimension;
private final boolean mIncludeZeroValue;
private final MetricName mMetricName;
private MachineMetric(Dim pDimension, MetricName pMetricName) {
this(pDimension, pMetricName, _.INCLUDES_ZERO_VALUES);
}
private MachineMetric(Dim pDimension, MetricName pMetricName, boolean pIncludeZeroValue) {
this.mDimension = pDimension;
this.mMetricName = pMetricName;
this.mIncludeZeroValue = pIncludeZeroValue;
}
String getDimensionName() { return mDimension.name(); }
String getMetricName() { return mMetricName.name(); }
boolean includeZeroValue() { return mIncludeZeroValue; }
/** Returns the metric name for OS metrics. */
static String getOSMetricName() {
return MetricName.OSMetric.name();
}
/**
* Machine metric names.
*/
private static enum MetricName {
JvmMetric,
OSMetric,
;
}
/**
* Dimensions.
*/
private static enum Dim {
Memory,
Threads,
FileDescriptors,
;
}
/**
* An internal class used to holds static constants used by the enum.
*/
private static class _ {
static final boolean INCLUDES_ZERO_VALUES = true;
static final boolean EXCLUDES_ZERO_VALUES = false;
}
}