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

kanela.agent.bootstrap.metrics.MetricsProvider Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
/*
 * =========================================================================================
 * Copyright © 2013-2018 the kamon project 
 *
 * 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.
 * =========================================================================================
 */

package kanela.agent.bootstrap.metrics;

import java.util.Map;

/**
 * Interface for accessing and manipulating metrics instruments.
 *
 * @since 0.10
 */
public interface MetricsProvider {

    // Counters
    void incrementCounter(String name, Map tags);
    void incrementCounter(String name, Long times, Map tags);

    // Gauges
    void incrementGauge(String name, Map tags);
    void incrementGauge(String name, Long times, Map tags);
    void decrementGauge(String name, Map tags);
    void decrementGauge(String name, Long times, Map tags);
    void setGauge(String name, Long value);

    // Histograms
    void recordHistogram(String name, Map tags);
    void recordHistogram(String name, Long times, Map tags);

    // RangeSamplers
    void incrementRangeSampler(String name, Map tags);
    void incrementRangeSampler(String name, Long times, Map tags);
    void decrementRangeSampler(String name, Map tags);
    void decrementRangeSampler(String name, Long times, Map tags);
    void sampleRangeSampler();

    enum NoOp implements MetricsProvider {

        INSTANCE;

        public void incrementCounter(String name, Map tags) {}
        public void incrementCounter(String name, Long times, Map tags) {}
        public void incrementGauge(String name, Map tags) {}
        public void incrementGauge(String name, Long times, Map tags) {}
        public void decrementGauge(String name, Map tags) {}
        public void decrementGauge(String name, Long times, Map tags) {}
        public void setGauge(String name, Long value) {}
        public void recordHistogram(String name, Map tags) {}
        public void recordHistogram(String name, Long times, Map tags) {}
        public void incrementRangeSampler(String name, Map tags) {}
        public void incrementRangeSampler(String name, Long times, Map tags) {}
        public void decrementRangeSampler(String name, Map tags) {}
        public void decrementRangeSampler(String name, Long times, Map tags) {}
        public void sampleRangeSampler() {}
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy