/**
   * 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;
  }
Beispiel #2
0
  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();
  }