use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AgentStatDataPointCodecTest method test_timestamps.
@Test
public void test_timestamps() {
// Given
final long initialTimestamp = System.currentTimeMillis();
final long intervalMs = 5000L;
final long randomDelta = 10L;
final int numValues = (int) (Math.random() * 100) + 1;
final List<Long> expectedTimestamps = createTimestamps(initialTimestamp, intervalMs, randomDelta, numValues);
final Buffer timestampBuffer = new AutomaticBuffer();
// When
codec.encodeTimestamps(timestampBuffer, expectedTimestamps);
// Then
List<Long> decodedTimestamps = codec.decodeTimestamps(initialTimestamp, new FixedBuffer(timestampBuffer.getBuffer()), numValues);
Assert.assertEquals(expectedTimestamps, decodedTimestamps);
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class TransactionIdUtils method writeTransactionId.
private static Buffer writeTransactionId(String agentId, long agentStartTime, long transactionSequence) {
// agentId may be null
// version + prefixed size + string + long + long
final Buffer buffer = new AutomaticBuffer(1 + 5 + 24 + 10 + 10);
buffer.putByte(VERSION);
buffer.putPrefixedString(agentId);
buffer.putVLong(agentStartTime);
buffer.putVLong(transactionSequence);
return buffer;
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AnnotationTranscoder method encodeIntStringValue.
private byte[] encodeIntStringValue(Object value) {
final TIntStringValue tIntStringValue = (TIntStringValue) value;
final int intValue = tIntStringValue.getIntValue();
final byte[] stringValue = BytesUtils.toBytes(tIntStringValue.getStringValue());
// TODO increase by a more precise value
final int bufferSize = getBufferSize(stringValue, 4 + 8);
final Buffer buffer = new AutomaticBuffer(bufferSize);
buffer.putSVInt(intValue);
buffer.putPrefixedBytes(stringValue);
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AnnotationTranscoder method encodeIntStringStringValue.
private byte[] encodeIntStringStringValue(Object o) {
final TIntStringStringValue tIntStringStringValue = (TIntStringStringValue) o;
final int intValue = tIntStringStringValue.getIntValue();
final byte[] stringValue1 = BytesUtils.toBytes(tIntStringStringValue.getStringValue1());
final byte[] stringValue2 = BytesUtils.toBytes(tIntStringStringValue.getStringValue2());
// TODO increase by a more precise value
final int bufferSize = getBufferSize(stringValue1, stringValue2, 4 + 8);
final Buffer buffer = new AutomaticBuffer(bufferSize);
buffer.putSVInt(intValue);
buffer.putPrefixedBytes(stringValue1);
buffer.putPrefixedBytes(stringValue2);
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class HbaseHostApplicationMapDao method createKey.
private byte[] createKey(Application parentApplication, long time) {
Buffer buffer = new AutomaticBuffer();
buffer.putPadString(parentApplication.getName(), HBaseTables.APPLICATION_NAME_MAX_LEN);
buffer.putShort(parentApplication.getServiceTypeCode());
buffer.putLong(time);
return buffer.getBuffer();
}
Aggregations