content: /**
   * 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 com.alibaba.jstorm.metric;
  
  import com.alibaba.jstorm.common.metric.MetricMeta;
  import com.alibaba.jstorm.common.metric.TaskTrack;
  import com.alibaba.jstorm.common.metric.TopologyHistory;
  
  import java.util.List;
  import java.util.Map;
  
  /**
   * metric query client for getting metric meta & data
   *
   * @author Cody (weiyue.wy@alibaba-inc.com)
   * @since 2.0.5
   */
  public interface MetricQueryClient {
  
      /**
       * init metric query client
       */
      void init(Map conf);
  
      /**
       * return whether the client has been initialized
       */
      boolean isInited();
  
      /**
       * get identity of this metric query client
       */
      String getIdentity(Map conf);
  
      /**
       * get metric meta with optional meta filter
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @param type        meta type
       * @param filter      meta filter, if filter matches, the corresponding meta will be returned.
       * @param arg         filter argument
       * @return meta list
       */
      List<MetricMeta> getMetricMeta(String clusterName, String topologyId, MetaType type, MetaFilter filter, Object arg);
  
      /**
       * get metric meta by topology id and meta type
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @param type        meta type
       * @return all metric meta
       */
      List<MetricMeta> getMetricMeta(String clusterName, String topologyId, MetaType type);
  
      /**
       * get worker metric meta by topology id
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @return all worker metric meta
       */
      List<MetricMeta> getWorkerMeta(String clusterName, String topologyId);
  
      /**
       * get netty metric meta by topology id
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @return all netty metric meta
       */
      List<MetricMeta> getNettyMeta(String clusterName, String topologyId);
  
      /**
       * get task metric meta
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @param taskId      task id
       * @return task metric meta
       */
      List<MetricMeta> getTaskMeta(String clusterName, String topologyId, int taskId);
  
      /**
       * get component metric meta
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @param componentId component id
       * @return component metric meta
       */
      List<MetricMeta> getComponentMeta(String clusterName, String topologyId, String componentId);
  
      /**
       * get metric meta by id
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @param metaType    meta type
       * @param metricId    metric id
       * @return metric meta
       */
      MetricMeta getMetricMeta(String clusterName, String topologyId, MetaType metaType, String metricId);
  
      /**
       * get metric data
       *
       * @param key the constructed key
       * @return metric meta
       */
      MetricMeta getMetricMeta(String key);
  
      /**
       * get metric data
       *
       * @param metricId   metric id
       * @param metricType metric type
       * @param win        metric window
       * @param start      start time
       * @param end        end time
       * @return metric data objects, depending on metric type, could be CounterData, GaugeData, ... etc.
       */
      List<Object> getMetricData(String metricId, MetricType metricType, int win, long start, long end);
  
      /**
       * get metric data
       *
       * @param metricId   metric id
       * @param metricType metric type
       * @param win        metric window
       * @param start      start time
       * @param end        end time
       * @param size       return size
       * @return metric data objects, depending on metric type, could be CounterData, GaugeData, ... etc.
       */
      List<Object> getMetricData(String metricId, MetricType metricType, int win, long start, long end, int size);
  
      /**
       * get all task track by topology id
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @return task track
       */
      List<TaskTrack> getTaskTrack(String clusterName, String topologyId);
  
      /**
       * get task track by task id
       *
       * @param clusterName cluster name
       * @param topologyId  topology id
       * @param taskId      task id
       * @return task track
       */
      List<TaskTrack> getTaskTrack(String clusterName, String topologyId, int taskId);
  
      /**
       * get topology history
       *
       * @param clusterName  cluster name
       * @param topologyName topology name
       * @param size         size
       * @return topology history list
       */
      List<TopologyHistory> getTopologyHistory(String clusterName, String topologyName, int size);
  
      /**
       * delete metrics meta. note that clusterName, topologyId, metaType & id must be set.
       *
       * @param meta metric meta
       */
      void deleteMeta(MetricMeta meta);
  
      /**
       * delete metrics meta list. note that clusterName, topologyId, metaType & id must be set.
       *
       * @param metaList metric meta list
       */
      void deleteMeta(List<MetricMeta> metaList);
  }
  