コード例 #1
0
  /**
   * make the hbase filter for selecting values of y-axis(response time) in order to select
   * transactions in scatter chart. 4 bytes for elapsed time should be attached for the prefix of
   * column qualifier for to use this filter.
   *
   * @param area
   * @param offsetTransactionId
   * @param offsetTransactionElapsed
   * @return
   */
  private Filter makeResponseTimeFilter(
      final SelectedScatterArea area,
      final TransactionId offsetTransactionId,
      int offsetTransactionElapsed) {
    // filter by response time
    ResponseTimeRange responseTimeRange = area.getResponseTimeRange();
    byte[] responseFrom = Bytes.toBytes(responseTimeRange.getFrom());
    byte[] responseTo = Bytes.toBytes(responseTimeRange.getTo());
    FilterList filterList = new FilterList(Operator.MUST_PASS_ALL);
    filterList.addFilter(
        new QualifierFilter(CompareOp.GREATER_OR_EQUAL, new BinaryPrefixComparator(responseFrom)));
    filterList.addFilter(
        new QualifierFilter(CompareOp.LESS_OR_EQUAL, new BinaryPrefixComparator(responseTo)));

    // add offset
    if (offsetTransactionId != null) {
      final Buffer buffer = new AutomaticBuffer(32);
      buffer.put(offsetTransactionElapsed);
      buffer.putPrefixedString(offsetTransactionId.getAgentId());
      buffer.putSVar(offsetTransactionId.getAgentStartTime());
      buffer.putVar(offsetTransactionId.getTransactionSequence());
      byte[] qualifierOffset = buffer.getBuffer();

      filterList.addFilter(
          new QualifierFilter(CompareOp.GREATER, new BinaryPrefixComparator(qualifierOffset)));
    }
    return filterList;
  }
コード例 #2
0
ファイル: SpanEventBo.java プロジェクト: hanguoming/pinpoint
  public int readValue(byte[] bytes, int offset, int length) {
    final int endOffset = offset + length;
    final Buffer buffer = new OffsetFixedBuffer(bytes, offset);

    this.version = buffer.readByte();

    // this.mostTraceID = buffer.readLong();
    // this.leastTraceID = buffer.readLong();

    this.agentId = buffer.readPrefixedString();
    this.applicationId = buffer.readPrefixedString();
    this.agentStartTime = buffer.readVarLong();

    this.startElapsed = buffer.readVarInt();
    this.endElapsed = buffer.readVarInt();

    // don't need to get sequence because it can be got at Qualifier
    // this.sequence = buffer.readShort();

    this.rpc = buffer.readPrefixedString();
    this.serviceType = buffer.readShort();
    this.endPoint = buffer.readPrefixedString();
    this.destinationId = buffer.readPrefixedString();
    this.apiId = buffer.readSVarInt();

    this.depth = buffer.readSVarInt();
    this.nextSpanId = buffer.readLong();

    this.hasException = buffer.readBoolean();
    if (hasException) {
      this.exceptionId = buffer.readSVarInt();
      this.exceptionMessage = buffer.readPrefixedString();
    }

    this.annotationBoList = readAnnotation(buffer);
    if (buffer.getOffset() < endOffset) {
      nextAsyncId = buffer.readSVarInt();
    }

    return buffer.getOffset();
  }
コード例 #3
0
ファイル: SpanEventBo.java プロジェクト: hanguoming/pinpoint
  public byte[] writeValue() {
    final Buffer buffer = new AutomaticBuffer(512);

    buffer.put(version);

    // buffer.put(mostTraceID);
    // buffer.put(leastTraceID);

    buffer.putPrefixedString(agentId);
    buffer.putPrefixedString(applicationId);
    buffer.putVar(agentStartTime);

    buffer.putVar(startElapsed);
    buffer.putVar(endElapsed);

    // don't need to put sequence because it is set at Qualifier
    // buffer.put(sequence);

    buffer.putPrefixedString(rpc);
    buffer.put(serviceType);
    buffer.putPrefixedString(endPoint);
    buffer.putPrefixedString(destinationId);
    buffer.putSVar(apiId);

    buffer.putSVar(depth);
    buffer.put(nextSpanId);

    if (hasException) {
      buffer.put(true);
      buffer.putSVar(exceptionId);
      buffer.putPrefixedString(exceptionMessage);
    } else {
      buffer.put(false);
    }

    writeAnnotation(buffer);
    buffer.putSVar(nextAsyncId);

    return buffer.getBuffer();
  }