Search in sources :

Example 6 with TransactionId

use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.

the class TransactionMetadataQuery method addQueryCondition.

public void addQueryCondition(String transactionId, long collectorAcceptTime, int responseTime) {
    if (transactionId == null) {
        throw new NullPointerException("transactionId must not be null");
    }
    TransactionId traceId = TransactionIdUtils.parseTransactionId(transactionId);
    QueryCondition condition = new QueryCondition(traceId, collectorAcceptTime, responseTime);
    queryConditionList.add(condition);
}
Also used : TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Example 7 with TransactionId

use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.

the class SpanBoTest method serialize_V1.

@Test
public void serialize_V1() {
    final SpanBo spanBo = new SpanBo();
    spanBo.setAgentId("agentId");
    spanBo.setApplicationId("applicationId");
    spanBo.setEndPoint("end");
    spanBo.setRpc("rpc");
    spanBo.setParentSpanId(5);
    spanBo.setAgentStartTime(1);
    TransactionId transactionId = new TransactionId("agentId", 2, 3);
    spanBo.setTransactionId(transactionId);
    spanBo.setElapsed(4);
    spanBo.setStartTime(5);
    spanBo.setServiceType(ServiceType.STAND_ALONE.getCode());
    spanBo.setLoggingTransactionInfo(LoggingInfo.INFO.getCode());
    spanBo.setExceptionInfo(1000, "Exception");
    ByteBuffer bytes = spanSerializer.writeColumnValue(spanBo);
    SpanBo newSpanBo = new SpanBo();
    Buffer valueBuffer = new OffsetFixedBuffer(bytes.array(), bytes.arrayOffset(), bytes.remaining());
    int i = spanDecoder.readSpan(newSpanBo, valueBuffer);
    logger.debug("length:{}", i);
    Assert.assertEquals(bytes.limit(), i);
    Assert.assertEquals(newSpanBo.getAgentId(), spanBo.getAgentId());
    Assert.assertEquals(newSpanBo.getApplicationId(), spanBo.getApplicationId());
    Assert.assertEquals(newSpanBo.getAgentStartTime(), spanBo.getAgentStartTime());
    Assert.assertEquals(newSpanBo.getElapsed(), spanBo.getElapsed());
    Assert.assertEquals(newSpanBo.getEndPoint(), spanBo.getEndPoint());
    Assert.assertEquals(newSpanBo.getErrCode(), spanBo.getErrCode());
    Assert.assertEquals(newSpanBo.getFlag(), spanBo.getFlag());
    //        not included for serialization
    //        Assert.assertEquals(newSpanBo.getTraceAgentStartTime(), spanBo.getTraceAgentStartTime());
    //        Assert.assertEquals(newSpanBo.getTraceTransactionSequence(), spanBo.getTraceTransactionSequence());
    Assert.assertEquals(newSpanBo.getParentSpanId(), spanBo.getParentSpanId());
    Assert.assertEquals(newSpanBo.getServiceType(), spanBo.getServiceType());
    Assert.assertEquals(newSpanBo.getApplicationServiceType(), spanBo.getServiceType());
    Assert.assertEquals(newSpanBo.getVersion(), spanBo.getVersion());
    Assert.assertEquals(newSpanBo.getLoggingTransactionInfo(), spanBo.getLoggingTransactionInfo());
    Assert.assertEquals(newSpanBo.getExceptionId(), spanBo.getExceptionId());
    Assert.assertEquals(newSpanBo.getExceptionMessage(), spanBo.getExceptionMessage());
}
Also used : Buffer(com.navercorp.pinpoint.common.buffer.Buffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) ByteBuffer(java.nio.ByteBuffer) OffsetFixedBuffer(com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) ByteBuffer(java.nio.ByteBuffer) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 8 with TransactionId

use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.

the class SpanFactoryTest method testTransactionId_include_agentId.

@Test
public void testTransactionId_include_agentId() throws Exception {
    TSpan tSpan = new TSpan();
    tSpan.setAgentId("agentId");
    byte[] transactionIdBytes = TransactionIdUtils.formatBytes("transactionAgentId", 1, 2);
    tSpan.setTransactionId(transactionIdBytes);
    SpanBo spanBo = spanFactory.newSpanBo(tSpan);
    TransactionId transactionId = spanBo.getTransactionId();
    Assert.assertEquals(transactionId.getAgentId(), "transactionAgentId");
    Assert.assertEquals(transactionId.getAgentStartTime(), 1);
    Assert.assertEquals(transactionId.getTransactionSequence(), 2);
}
Also used : TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 9 with TransactionId

use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.

the class SpanUtilsTest method testGetTransactionId_BasicSpan.

@Test
public void testGetTransactionId_BasicSpan() {
    SpanBo spanBo = new SpanBo();
    TransactionId spanTransactionId = new TransactionId("traceAgentId", System.currentTimeMillis(), 1111);
    spanBo.setTransactionId(spanTransactionId);
    byte[] transactionIdRowkey = SpanUtils.getTransactionId(spanBo);
    TraceRowKeyDecoderV2 decoder = new TraceRowKeyDecoderV2();
    TransactionId transactionId = decoder.readTransactionId(transactionIdRowkey);
    Assert.assertEquals(transactionId, spanBo.getTransactionId());
}
Also used : TraceRowKeyDecoderV2(com.navercorp.pinpoint.common.server.bo.serializer.trace.v2.TraceRowKeyDecoderV2) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) TransactionId(com.navercorp.pinpoint.common.util.TransactionId) Test(org.junit.Test)

Example 10 with TransactionId

use of com.navercorp.pinpoint.common.util.TransactionId in project pinpoint by naver.

the class HbaseApplicationTraceIndexDao method scanTraceIndex.

@Override
public LimitedScanResult<List<TransactionId>> scanTraceIndex(final String applicationName, SelectedScatterArea area, int limit) {
    if (applicationName == null) {
        throw new NullPointerException("applicationName must not be null");
    }
    if (area == null) {
        throw new NullPointerException("area must not be null");
    }
    if (limit < 0) {
        throw new IllegalArgumentException("negative limit:" + limit);
    }
    logger.debug("scanTraceIndex");
    Scan scan = createScan(applicationName, area.getTimeRange());
    final LimitedScanResult<List<TransactionId>> limitedScanResult = new LimitedScanResult<>();
    LastRowAccessor lastRowAccessor = new LastRowAccessor();
    List<List<TransactionId>> traceIndexList = hbaseOperations2.findParallel(HBaseTables.APPLICATION_TRACE_INDEX, scan, traceIdRowKeyDistributor, limit, traceIndexMapper, lastRowAccessor, APPLICATION_TRACE_INDEX_NUM_PARTITIONS);
    List<TransactionId> transactionIdSum = new ArrayList<>(128);
    for (List<TransactionId> transactionId : traceIndexList) {
        transactionIdSum.addAll(transactionId);
    }
    limitedScanResult.setScanData(transactionIdSum);
    if (transactionIdSum.size() >= limit) {
        Long lastRowTimestamp = lastRowAccessor.getLastRowTimestamp();
        limitedScanResult.setLimitedTime(lastRowTimestamp);
        if (logger.isDebugEnabled()) {
            logger.debug("lastRowTimestamp lastTime:{}", DateUtils.longToDateStr(lastRowTimestamp));
        }
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("scanner start lastTime:{}", DateUtils.longToDateStr(area.getTimeRange().getFrom()));
        }
        limitedScanResult.setLimitedTime(area.getTimeRange().getFrom());
    }
    return limitedScanResult;
}
Also used : ArrayList(java.util.ArrayList) Scan(org.apache.hadoop.hbase.client.Scan) FilterList(org.apache.hadoop.hbase.filter.FilterList) ArrayList(java.util.ArrayList) List(java.util.List) LimitedScanResult(com.navercorp.pinpoint.web.vo.LimitedScanResult) TransactionId(com.navercorp.pinpoint.common.util.TransactionId)

Aggregations

TransactionId (com.navercorp.pinpoint.common.util.TransactionId)44 ArrayList (java.util.ArrayList)11 Dot (com.navercorp.pinpoint.web.vo.scatter.Dot)9 Test (org.junit.Test)9 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)8 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)8 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)7 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)5 List (java.util.List)5 Put (org.apache.hadoop.hbase.client.Put)4 ByteBuffer (java.nio.ByteBuffer)3 Cell (org.apache.hadoop.hbase.Cell)3 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)2 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)2 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)2 ScatterData (com.navercorp.pinpoint.web.scatter.ScatterData)2 LimitedScanResult (com.navercorp.pinpoint.web.vo.LimitedScanResult)2 Get (org.apache.hadoop.hbase.client.Get)2 Scan (org.apache.hadoop.hbase.client.Scan)2 FilterList (org.apache.hadoop.hbase.filter.FilterList)2