use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class ApplicationMapStatisticsUtils method makeRowKey.
/**
* <pre>
* rowkey format = "APPLICATIONNAME(max 24bytes)" + apptype(2byte) + "TIMESTAMP(8byte)"
* </pre>
*
* @param applicationName
* @param timestamp
* @return
*/
public static byte[] makeRowKey(String applicationName, short applicationType, long timestamp) {
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
final byte[] applicationNameBytes = BytesUtils.toBytes(applicationName);
final Buffer buffer = new AutomaticBuffer(2 + applicationNameBytes.length + 2 + 8);
// buffer.put2PrefixedString(applicationName);
buffer.putShort((short) applicationNameBytes.length);
buffer.putBytes(applicationNameBytes);
buffer.putShort(applicationType);
long reverseTimeMillis = TimeUtils.reverseTimeMillis(timestamp);
buffer.putLong(reverseTimeMillis);
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class HbaseApplicationTraceIndexDao method makeResponseTimeFilter.
/**
* 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.putInt(offsetTransactionElapsed);
buffer.putPrefixedString(offsetTransactionId.getAgentId());
buffer.putSVLong(offsetTransactionId.getAgentStartTime());
buffer.putVLong(offsetTransactionId.getTransactionSequence());
byte[] qualifierOffset = buffer.getBuffer();
filterList.addFilter(new QualifierFilter(CompareOp.GREATER, new BinaryPrefixComparator(qualifierOffset)));
}
return filterList;
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class ApplicationMapStatisticsUtils method makeColumnName.
public static byte[] makeColumnName(short serviceType, String applicationName, String destHost, short slotNumber) {
if (applicationName == null) {
throw new NullPointerException("applicationName must not be null");
}
if (destHost == null) {
// throw new NullPointerException("destHost must not be null");
destHost = "";
}
// approximate size of destHost
final Buffer buffer = new AutomaticBuffer(BytesUtils.SHORT_BYTE_LENGTH + PinpointConstants.APPLICATION_NAME_MAX_LEN + destHost.length() + BytesUtils.SHORT_BYTE_LENGTH);
buffer.putShort(serviceType);
buffer.putShort(slotNumber);
buffer.put2PrefixedString(applicationName);
buffer.putBytes(BytesUtils.toBytes(destHost));
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.buffer.AutomaticBuffer in project pinpoint by naver.
the class AnnotationTranscoder method encodeIntStringValue.
private byte[] encodeIntStringValue(Object value) {
final IntStringValue tIntStringValue = (IntStringValue) 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 encodeStringStringValue.
private byte[] encodeStringStringValue(Object o) {
final StringStringValue tStringStringValue = (StringStringValue) o;
final byte[] stringValue1 = BytesUtils.toBytes(tStringStringValue.getStringValue1());
final byte[] stringValue2 = BytesUtils.toBytes(tStringStringValue.getStringValue2());
// TODO increase by a more precise value
final int bufferSize = getBufferSize(stringValue1, stringValue2);
final Buffer buffer = new AutomaticBuffer(bufferSize);
buffer.putPrefixedBytes(stringValue1);
buffer.putPrefixedBytes(stringValue2);
return buffer.getBuffer();
}
Aggregations