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

com.opsdatastore.annotation.Metric Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.opsdatastore.annotation;

/*-
 * #%L
 * OpsDataStore SDK
 * %%
 * Copyright (C) 2017 OpsDataStore
 * %%
 * Licensed 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.
 * #L%
 */

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * Annotation that indicates that a field is a metric.  This annotation can only
 * be applied to numeric fields
 * @author kguthrie
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Metric {

    /**
     * enumeration of all available metric categories
     * @author kguthrie
     */
    public enum Category {

        Power("Power")
        , Utilization("Utilization")
        , Other("Other")
        , Capacity("Capacity")
        , Performance("Performance")
        , Error("Error")
        , Throughput("Throughput")
        , Contention("Contention")

        ;

        public final String categoryName;

        Category(String name) {
            this.categoryName = name;
        }

    }

    /**
     * list of acceptable types for metrics to be represented as
     */
    public static final List> accetpableTypes
            = Collections.unmodifiableList(Arrays.asList(
                    Double.class
                    , Float.class
                    , Long.class
                    , Integer.class
                    , Short.class
                    , Byte.class
                    , String.class
            ));

    /**
     * Name of the metric field.
     * @return the name of the metric set at compile time
     */
    String name();

    /**
     * Brief description of the metric's meaning
     * @return description set at compile time
     */
    String description() default "";

    /**
     * Category of this metric
     * @return category set at compile time
     */
    Category category();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy