Package co.cask.cdap.common.metrics

Examples of co.cask.cdap.common.metrics.MetricsCollector.increment()


  @Override
  public boolean preCall(HttpRequest request, HttpResponder responder, HandlerInfo handlerInfo) {
    if (metricsCollectionService != null) {
      try {
        MetricsCollector collector = collectorCache.get(createContext(handlerInfo));
        collector.increment("request.received", 1);
      } catch (Throwable e) {
        LOG.error("Got exception while getting collector", e);
      }
    }
    return true;
View Full Code Here


        } else if (code < 600) {
          name = "server-error";
        } else {
          name = "unknown";
        }
        collector.increment("response." + name, 1, "status:" + code);
      } catch (Throwable e) {
        LOG.error("Got exception while getting collector", e);
      }
    }
  }
View Full Code Here

      if (datasetName == null) {
        // not a user dataset
        continue;
      }
      // legacy format: dataset name is in the tag. See DatasetInstantiator for more details
      collector.increment("dataset.size.mb", statEntry.getValue().getTotalSizeMB(), datasetName);
    }
  }
}
View Full Code Here

        // not a user dataset
        continue;
      }
      // legacy format: dataset name is in the tag. See DatasetInstantiator for more details
      int sizeInMb = (int) (statEntry.getValue().getDiskSizeBytes() / BYTES_IN_MB);
      collector.increment("dataset.size.mb", sizeInMb, datasetName);
    }
  }
}
View Full Code Here

          JsonObject clusterMetrics = response.getAsJsonObject("clusterMetrics");
          long totalMemory = clusterMetrics.get("totalMB").getAsLong();
          long availableMemory = clusterMetrics.get("availableMB").getAsLong();
          MetricsCollector collector = getCollector(CLUSTER_METRICS_CONTEXT);
          LOG.trace("resource manager, total memory = " + totalMemory + " available = " + availableMemory);
          collector.increment("resources.total.memory", (int) totalMemory);
          collector.increment("resources.available.memory", (int) availableMemory);
        } else {
          LOG.warn("unable to get resource manager metrics, cluster memory metrics will be unavailable");
        }
      } catch (IOException e) {
View Full Code Here

          long totalMemory = clusterMetrics.get("totalMB").getAsLong();
          long availableMemory = clusterMetrics.get("availableMB").getAsLong();
          MetricsCollector collector = getCollector(CLUSTER_METRICS_CONTEXT);
          LOG.trace("resource manager, total memory = " + totalMemory + " available = " + availableMemory);
          collector.increment("resources.total.memory", (int) totalMemory);
          collector.increment("resources.available.memory", (int) availableMemory);
        } else {
          LOG.warn("unable to get resource manager metrics, cluster memory metrics will be unavailable");
        }
      } catch (IOException e) {
        LOG.error("Exception getting cluster memory from ", e);
View Full Code Here

        long storageAvailable = hdfsStatus.getRemaining();

        MetricsCollector collector = getCollector(CLUSTER_METRICS_CONTEXT);
        // TODO: metrics should support longs
        LOG.trace("total cluster storage = " + storageCapacity + " total used = " + totalUsed);
        collector.increment("resources.total.storage", (int) (storageCapacity / 1024 / 1024));
        collector.increment("resources.available.storage", (int) (storageAvailable / 1024 / 1024));
        collector.increment("resources.used.storage", (int) (totalUsed / 1024 / 1024));
        collector.increment("resources.used.files", (int) totalFiles);
        collector.increment("resources.used.directories", (int) totalDirectories);
      } catch (IOException e) {
View Full Code Here

        MetricsCollector collector = getCollector(CLUSTER_METRICS_CONTEXT);
        // TODO: metrics should support longs
        LOG.trace("total cluster storage = " + storageCapacity + " total used = " + totalUsed);
        collector.increment("resources.total.storage", (int) (storageCapacity / 1024 / 1024));
        collector.increment("resources.available.storage", (int) (storageAvailable / 1024 / 1024));
        collector.increment("resources.used.storage", (int) (totalUsed / 1024 / 1024));
        collector.increment("resources.used.files", (int) totalFiles);
        collector.increment("resources.used.directories", (int) totalDirectories);
      } catch (IOException e) {
        LOG.warn("Exception getting hdfs metrics", e);
View Full Code Here

        MetricsCollector collector = getCollector(CLUSTER_METRICS_CONTEXT);
        // TODO: metrics should support longs
        LOG.trace("total cluster storage = " + storageCapacity + " total used = " + totalUsed);
        collector.increment("resources.total.storage", (int) (storageCapacity / 1024 / 1024));
        collector.increment("resources.available.storage", (int) (storageAvailable / 1024 / 1024));
        collector.increment("resources.used.storage", (int) (totalUsed / 1024 / 1024));
        collector.increment("resources.used.files", (int) totalFiles);
        collector.increment("resources.used.directories", (int) totalDirectories);
      } catch (IOException e) {
        LOG.warn("Exception getting hdfs metrics", e);
      }
View Full Code Here

        // TODO: metrics should support longs
        LOG.trace("total cluster storage = " + storageCapacity + " total used = " + totalUsed);
        collector.increment("resources.total.storage", (int) (storageCapacity / 1024 / 1024));
        collector.increment("resources.available.storage", (int) (storageAvailable / 1024 / 1024));
        collector.increment("resources.used.storage", (int) (totalUsed / 1024 / 1024));
        collector.increment("resources.used.files", (int) totalFiles);
        collector.increment("resources.used.directories", (int) totalDirectories);
      } catch (IOException e) {
        LOG.warn("Exception getting hdfs metrics", e);
      }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.