use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class ServiceInfoBo method writeValue.
public byte[] writeValue() {
final Buffer buffer = new AutomaticBuffer();
buffer.put2PrefixedString(this.serviceName);
int numServiceLibs = this.serviceLibs == null ? 0 : this.serviceLibs.size();
buffer.putVInt(numServiceLibs);
for (int i = 0; i < numServiceLibs; ++i) {
buffer.put2PrefixedString(this.serviceLibs.get(i));
}
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AgentEventValueMapper method mapValue.
@Override
public byte[] mapValue(AgentEventBo value) {
final Buffer buffer = new AutomaticBuffer();
buffer.putInt(value.getVersion());
buffer.putPrefixedString(value.getAgentId());
buffer.putLong(value.getStartTimestamp());
buffer.putLong(value.getEventTimestamp());
buffer.putPrefixedBytes(value.getEventBody());
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class CalleeColumnName method getColumnName.
public byte[] getColumnName() {
final Buffer buffer = new AutomaticBuffer(64);
buffer.putShort(calleeServiceType);
buffer.putPrefixedString(calleeApplicationName);
buffer.putPrefixedString(callHost);
buffer.putShort(columnSlotNumber);
buffer.putPrefixedString(callerAgentId);
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AnnotationBoDecoderTest method testWriteValue.
@Test
public void testWriteValue() throws Exception {
final AnnotationBo annotation = new AnnotationBo();
annotation.setKey(AnnotationKey.API.getCode());
final String value = RandomStringUtils.random(RandomUtils.nextInt(0, 20));
annotation.setValue(value);
final Buffer buffer = new AutomaticBuffer(128);
this.serializer.writeAnnotationList(Lists.newArrayList(annotation), buffer);
buffer.setOffset(0);
List<AnnotationBo> decode = annotationBoDecoder.decode(buffer);
Assert.assertEquals(decode.size(), 1);
AnnotationBo decodedAnnotation = decode.get(0);
Assert.assertEquals(annotation.getKey(), decodedAnnotation.getKey());
Assert.assertEquals(annotation.getValue(), decodedAnnotation.getValue());
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AgentStatCodecTestBase method runTest.
private void runTest() {
// Given
final long initialTimestamp = System.currentTimeMillis();
final long baseTimestamp = AgentStatUtils.getBaseTimestamp(initialTimestamp);
final long timestampDelta = initialTimestamp - baseTimestamp;
final List<T> expectedAgentStats = createAgentStats(AGENT_ID, AGENT_START_TIMESTAMP, initialTimestamp);
// When
Buffer encodedValueBuffer = new AutomaticBuffer();
getCodec().encodeValues(encodedValueBuffer, expectedAgentStats);
// Then
AgentStatDecodingContext decodingContext = new AgentStatDecodingContext();
decodingContext.setAgentId(AGENT_ID);
decodingContext.setBaseTimestamp(baseTimestamp);
decodingContext.setTimestampDelta(timestampDelta);
Buffer valueBuffer = new FixedBuffer(encodedValueBuffer.getBuffer());
List<T> actualAgentStats = getCodec().decodeValues(valueBuffer, decodingContext);
Assert.assertEquals(expectedAgentStats.size(), actualAgentStats.size());
for (int i = 0; i < expectedAgentStats.size(); ++i) {
T expectedAgentStat = expectedAgentStats.get(i);
T actualAgentStat = actualAgentStats.get(i);
verify(expectedAgentStat, actualAgentStat);
}
}
Aggregations