当前位置: 首页>>代码示例>>Java>>正文


Java Trace.currentSpan方法代码示例

本文整理汇总了Java中org.apache.htrace.Trace.currentSpan方法的典型用法代码示例。如果您正苦于以下问题:Java Trace.currentSpan方法的具体用法?Java Trace.currentSpan怎么用?Java Trace.currentSpan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.htrace.Trace的用法示例。


在下文中一共展示了Trace.currentSpan方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFromOneDataNode

import org.apache.htrace.Trace; //导入方法依赖的package包/类
private Callable<ByteBuffer> getFromOneDataNode(final DNAddrPair datanode,
    final LocatedBlock block, final long start, final long end,
    final ByteBuffer bb,
    final Map<ExtendedBlock, Set<DatanodeInfo>> corruptedBlockMap,
    final int hedgedReadId) {
  final Span parentSpan = Trace.currentSpan();
  return new Callable<ByteBuffer>() {
    @Override
    public ByteBuffer call() throws Exception {
      byte[] buf = bb.array();
      int offset = bb.position();
      TraceScope scope =
          Trace.startSpan("hedgedRead" + hedgedReadId, parentSpan);
      try {
        actualGetFromOneDataNode(datanode, block, start, end, buf, offset,
            corruptedBlockMap);
        return bb;
      } finally {
        scope.close();
      }
    }
  };
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:DFSInputStream.java

示例2: makeRpcRequestHeader

import org.apache.htrace.Trace; //导入方法依赖的package包/类
public static RpcRequestHeaderProto makeRpcRequestHeader(RPC.RpcKind rpcKind,
    RpcRequestHeaderProto.OperationProto operation, int callId,
    int retryCount, byte[] uuid) {
  RpcRequestHeaderProto.Builder result = RpcRequestHeaderProto.newBuilder();
  result.setRpcKind(convert(rpcKind)).setRpcOp(operation).setCallId(callId)
      .setRetryCount(retryCount).setClientId(ByteString.copyFrom(uuid));

  // Add tracing info if we are currently tracing.
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    result.setTraceInfo(RPCTraceInfoProto.newBuilder()
        .setParentId(s.getSpanId())
        .setTraceId(s.getTraceId()).build());
  }

  return result.build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ProtoUtil.java

示例3: MemStoreScanner

import org.apache.htrace.Trace; //导入方法依赖的package包/类
MemStoreScanner(long readPoint) {
  super();

  this.readPoint = readPoint;
  cellSetAtCreation = cellSet;
  snapshotAtCreation = snapshot;
  if (allocator != null) {
    this.allocatorAtCreation = allocator;
    this.allocatorAtCreation.incScannerCount();
  }
  if (snapshotAllocator != null) {
    this.snapshotAllocatorAtCreation = snapshotAllocator;
    this.snapshotAllocatorAtCreation.incScannerCount();
  }
  if (Trace.isTracing() && Trace.currentSpan() != null) {
    Trace.currentSpan().addTimelineAnnotation("Creating MemStoreScanner");
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:DefaultMemStore.java

示例4: releaseShortCircuitFds

import org.apache.htrace.Trace; //导入方法依赖的package包/类
@Override
public void releaseShortCircuitFds(SlotId slotId) throws IOException {
  ReleaseShortCircuitAccessRequestProto.Builder builder =
      ReleaseShortCircuitAccessRequestProto.newBuilder().
      setSlotId(PBHelper.convert(slotId));
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder()
        .setTraceId(s.getTraceId()).setParentId(s.getSpanId()));
  }
  ReleaseShortCircuitAccessRequestProto proto = builder.build();
  send(out, Op.RELEASE_SHORT_CIRCUIT_FDS, proto);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:Sender.java

示例5: requestShortCircuitShm

import org.apache.htrace.Trace; //导入方法依赖的package包/类
@Override
public void requestShortCircuitShm(String clientName) throws IOException {
  ShortCircuitShmRequestProto.Builder builder =
      ShortCircuitShmRequestProto.newBuilder().
      setClientName(clientName);
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder()
        .setTraceId(s.getTraceId()).setParentId(s.getSpanId()));
  }
  ShortCircuitShmRequestProto proto = builder.build();
  send(out, Op.REQUEST_SHORT_CIRCUIT_SHM, proto);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:Sender.java

示例6: buildBaseHeader

import org.apache.htrace.Trace; //导入方法依赖的package包/类
static BaseHeaderProto buildBaseHeader(ExtendedBlock blk,
    Token<BlockTokenIdentifier> blockToken) {
  BaseHeaderProto.Builder builder =  BaseHeaderProto.newBuilder()
    .setBlock(PBHelper.convert(blk))
    .setToken(PBHelper.convert(blockToken));
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder()
        .setTraceId(s.getTraceId())
        .setParentId(s.getSpanId()));
  }
  return builder.build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:DataTransferProtoUtil.java

示例7: EventHandler

import org.apache.htrace.Trace; //导入方法依赖的package包/类
/**
 * Default base class constructor.
 */
public EventHandler(Server server, EventType eventType) {
  this.parent = Trace.currentSpan();
  this.server = server;
  this.eventType = eventType;
  seqid = seqids.incrementAndGet();
  if (server != null) {
    this.waitingTimeForEvents = server.getConfiguration().
        getInt("hbase.master.event.waiting.time", 1000);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:EventHandler.java

示例8: writeRequest

import org.apache.htrace.Trace; //导入方法依赖的package包/类
/**
 * Write request to channel
 *
 * @param call    to write
 */
private void writeRequest(final AsyncCall call) {
  try {
    final RPCProtos.RequestHeader.Builder requestHeaderBuilder = RPCProtos.RequestHeader
        .newBuilder();
    requestHeaderBuilder.setCallId(call.id)
            .setMethodName(call.method.getName()).setRequestParam(call.param != null);

    if (Trace.isTracing()) {
      Span s = Trace.currentSpan();
      requestHeaderBuilder.setTraceInfo(TracingProtos.RPCTInfo.newBuilder().
          setParentId(s.getSpanId()).setTraceId(s.getTraceId()));
    }

    ByteBuffer cellBlock = client.buildCellBlock(call.controller.cellScanner());
    if (cellBlock != null) {
      final RPCProtos.CellBlockMeta.Builder cellBlockBuilder = RPCProtos.CellBlockMeta
          .newBuilder();
      cellBlockBuilder.setLength(cellBlock.limit());
      requestHeaderBuilder.setCellBlockMeta(cellBlockBuilder.build());
    }
    // Only pass priority if there one.  Let zero be same as no priority.
    if (call.controller.getPriority() != 0) {
      requestHeaderBuilder.setPriority(call.controller.getPriority());
    }

    RPCProtos.RequestHeader rh = requestHeaderBuilder.build();

    int totalSize = IPCUtil.getTotalSizeWhenWrittenDelimited(rh, call.param);
    if (cellBlock != null) {
      totalSize += cellBlock.remaining();
    }

    ByteBuf b = channel.alloc().directBuffer(4 + totalSize);
    try(ByteBufOutputStream out = new ByteBufOutputStream(b)) {
      call.callStats.setRequestSizeBytes(IPCUtil.write(out, rh, call.param, cellBlock));
    }

    channel.writeAndFlush(b).addListener(new CallWriteListener(this, call.id));
  } catch (IOException e) {
    close(e);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:48,代码来源:AsyncRpcChannel.java


注:本文中的org.apache.htrace.Trace.currentSpan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。