001    /*
002     * Copyright (c) 2011, Cloudera, Inc. All Rights Reserved.
003     *
004     * Cloudera, Inc. licenses this file to you under the Apache License,
005     * Version 2.0 (the "License"). You may not use this file except in
006     * compliance with the License. You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * This software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
011     * CONDITIONS OF ANY KIND, either express or implied. See the License for
012     * the specific language governing permissions and limitations under the
013     * License.
014     */
015    package com.cloudera.lib.service;
016    
017    import java.util.Map;
018    
019    public interface Instrumentation {
020    
021      public interface Cron {
022    
023        public Cron start();
024    
025        public Cron stop();
026      }
027    
028      public interface Variable<T> {
029    
030        T getValue();
031      }
032    
033      public Cron createCron();
034    
035      public void incr(String group, String name, long count);
036    
037      public void addCron(String group, String name, Cron cron);
038    
039      public void addVariable(String group, String name, Variable<?> variable);
040    
041      //sampling happens once a second
042      public void addSampler(String group, String name, int samplingSize, Variable<Long> variable);
043    
044      public Map<String, Map<String, ?>> getSnapshot();
045    
046    }