Package org.apache.accumulo.cloudtrace.instrument

Examples of org.apache.accumulo.cloudtrace.instrument.Span


            count += list.size();
          }
          String msg = "sending " + String.format("%,d", count) + " mutations to " + String.format("%,d", mutationBatch.size()) + " tablets at " + location;
          Thread.currentThread().setName(msg);
         
          Span span = Trace.start("sendMutations");
          try {
            long st1 = System.currentTimeMillis();
            failures = sendMutationsToTabletServer(location, mutationBatch);
            long st2 = System.currentTimeMillis();
            if (log.isTraceEnabled())
              log.trace("sent " + String.format("%,d", count) + " mutations to " + location + " in "
                  + String.format("%.2f secs (%,.2f mutations/sec) with %,d failures", (st2 - st1) / 1000.0, count / ((st2 - st1) / 1000.0), failures.size()));
           
            long successBytes = 0;
            for (Entry<KeyExtent,List<Mutation>> entry : mutationBatch.entrySet()) {
              for (Mutation mutation : entry.getValue()) {
                successBytes += mutation.estimatedMemoryUsed();
              }
            }
           
            if (failures.size() > 0) {
              failedMutations.add(failures);
              successBytes -= failures.getMemoryUsed();
            }
           
            updateSendStats(count, st2 - st1);
            decrementMemUsed(successBytes);
           
          } finally {
            span.stop();
          }
        } catch (IOException e) {
          if (log.isTraceEnabled())
            log.trace("failed to send mutations to " + location + " : " + e.getMessage());
         
View Full Code Here


public class GarbageCollectWriteAheadLogs {
  private static final Logger log = Logger.getLogger(GarbageCollectWriteAheadLogs.class);
 
  public static void collect(FileSystem fs, GCStatus status) {
   
    Span span = Trace.start("scanServers");
    try {
      status.currentLog.started = System.currentTimeMillis();
     
      Map<String,String> fileToServerMap = new HashMap<String,String>();
      int count = scanServers(fileToServerMap);
      long fileScanStop = System.currentTimeMillis();
      log.info(String.format("Fetched %d files from %d servers in %.2f seconds", fileToServerMap.size(), count,
          (fileScanStop - status.currentLog.started) / 1000.));
      status.currentLog.candidates = fileToServerMap.size();
      span.stop();
     
      span = Trace.start("removeMetadataEntries");
      try {
        count = removeMetadataEntries(fileToServerMap, status);
      } catch (Exception ex) {
        log.error("Unable to scan metadata table", ex);
        return;
      } finally {
        span.stop();
      }
     
      long logEntryScanStop = System.currentTimeMillis();
      log.info(String.format("%d log entries scanned in %.2f seconds", count, (logEntryScanStop - fileScanStop) / 1000.));
     
      span = Trace.start("removeFiles");
      Map<String,ArrayList<String>> serverToFileMap = mapServersToFiles(fileToServerMap);
     
      count = removeFiles(fs, serverToFileMap, status);
     
      long removeStop = System.currentTimeMillis();
      log.info(String.format("%d total logs removed from %d servers in %.2f seconds", count, serverToFileMap.size(), (removeStop - logEntryScanStop) / 1000.));
      status.currentLog.finished = removeStop;
      status.lastLog = status.currentLog;
      status.currentLog = new GcCycleStats();
      span.stop();
     
    } catch (Exception e) {
      log.error("exception occured while garbage collecting write ahead logs", e);
      span.stop();
    }
  }
View Full Code Here

// If FileSystem was an interface, we could use a Proxy, but it's not, so we have to override everything manually

public class TraceFileSystem extends FileSystem {
  @Override
  public void setConf(Configuration conf) {
    Span span = Trace.start("setConf");
    try {
      if (impl != null)
        impl.setConf(conf);
      else
        super.setConf(conf);
    } finally {
      span.stop();
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public Configuration getConf() {
    Span span = Trace.start("getConf");
    try {
      return impl.getConf();
    } finally {
      span.stop();
    }
  }
View Full Code Here

      span.stop();
    }
  }
 
  public BlockLocation[] getFileBlockLocations(FileStatus file, long start, long len) throws IOException {
    Span span = Trace.start("getFileBlockLocations");
    try {
      return impl.getFileBlockLocations(file, start, len);
    } finally {
      span.stop();
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public FSDataInputStream open(Path f) throws IOException {
    Span span = Trace.start("open");
    if (Trace.isTracing())
      span.data("path", f.toString());
    try {
      return new TraceFSDataInputStream(impl.open(f));
    } finally {
      span.stop();
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public FSDataOutputStream create(Path f) throws IOException {
    Span span = Trace.start("create");
    if (Trace.isTracing())
      span.data("path", f.toString());
    try {
      return impl.create(f);
    } finally {
      span.stop();
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public FSDataOutputStream create(Path f, boolean overwrite) throws IOException {
    Span span = Trace.start("create");
    if (Trace.isTracing())
      span.data("path", f.toString());
    try {
      return impl.create(f, overwrite);
    } finally {
      span.stop();
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public FSDataOutputStream create(Path f, Progressable progress) throws IOException {
    Span span = Trace.start("create");
    if (Trace.isTracing())
      span.data("path", f.toString());
    try {
     
      return impl.create(f, progress);
    } finally {
      span.stop();
    }
  }
View Full Code Here

    }
  }
 
  @Override
  public FSDataOutputStream create(Path f, short replication) throws IOException {
    Span span = Trace.start("create");
    if (Trace.isTracing())
      span.data("path", f.toString());
    try {
      return impl.create(f, replication);
    } finally {
      span.stop();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.cloudtrace.instrument.Span

Copyright © 2018 www.massapicom. 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.