use of com.navercorp.pinpoint.common.server.bo.MethodTypeEnum in project pinpoint by naver.
the class DefaultApiParser method parse.
@Override
public Api parse(ApiMetaDataBo apiMetadata) {
Objects.requireNonNull(apiMetadata, "apiMetadata");
MethodTypeEnum methodTypeEnum = apiMetadata.getMethodTypeEnum();
Assert.isTrue(methodTypeEnum == MethodTypeEnum.DEFAULT, "Unexpected methodType:" + methodTypeEnum);
try {
ApiDescription apiDescription = parser.parse(apiMetadata);
String method = apiDescription.getMethodDescription();
String className = apiDescription.getSimpleClassName();
String apiInfo = apiDescription.getApiDescription();
return new Api(method, className, apiInfo, MethodTypeEnum.DEFAULT);
} catch (Exception ignore) {
// ignore
}
String description = apiMetadata.getDescription();
return new Api(description, "", description, apiMetadata.getMethodTypeEnum());
}
use of com.navercorp.pinpoint.common.server.bo.MethodTypeEnum in project pinpoint by naver.
the class ApiMetaDataMapper method mapRow.
@Override
public List<ApiMetaDataBo> mapRow(Result result, int rowNum) throws Exception {
if (result.isEmpty()) {
return Collections.emptyList();
}
final byte[] rowKey = getOriginalKey(result.getRow());
final MetaDataRowKey key = decoder.decodeRowKey(rowKey);
List<ApiMetaDataBo> apiMetaDataList = new ArrayList<>();
for (Cell cell : result.rawCells()) {
final byte[] value = getValue(cell);
Buffer buffer = new FixedBuffer(value);
final String apiInfo = buffer.readPrefixedString();
final int lineNumber = buffer.readInt();
MethodTypeEnum methodTypeEnum = MethodTypeEnum.DEFAULT;
if (buffer.hasRemaining()) {
methodTypeEnum = MethodTypeEnum.valueOf(buffer.readInt());
}
ApiMetaDataBo apiMetaDataBo = new ApiMetaDataBo(key.getAgentId(), key.getAgentStartTime(), key.getId(), lineNumber, methodTypeEnum, apiInfo);
apiMetaDataList.add(apiMetaDataBo);
if (logger.isDebugEnabled()) {
logger.debug("read apiAnnotation:{}", apiMetaDataBo);
}
}
return apiMetaDataList;
}
use of com.navercorp.pinpoint.common.server.bo.MethodTypeEnum in project pinpoint by naver.
the class GrpcApiMetaDataHandler method handleApiMetaData.
private GeneratedMessageV3 handleApiMetaData(final PApiMetaData apiMetaData) {
if (isDebug) {
logger.debug("Handle PApiMetaData={}", MessageFormatUtils.debugLog(apiMetaData));
}
try {
final Header header = ServerContext.getAgentInfo();
final String agentId = header.getAgentId();
final long agentStartTime = header.getAgentStartTime();
final int line = LineNumber.defaultLineNumber(apiMetaData.getLine());
final MethodTypeEnum type = MethodTypeEnum.defaultValueOf(apiMetaData.getType());
final ApiMetaDataBo apiMetaDataBo = new ApiMetaDataBo(agentId, agentStartTime, apiMetaData.getApiId(), line, type, apiMetaData.getApiInfo());
this.apiMetaDataService.insert(apiMetaDataBo);
return PResult.newBuilder().setSuccess(true).build();
} catch (Exception e) {
logger.warn("Failed to handle apiMetaData={}", MessageFormatUtils.debugLog(apiMetaData), e);
// Avoid detailed error messages.
return PResult.newBuilder().setSuccess(false).setMessage("Internal Server Error").build();
}
}
use of com.navercorp.pinpoint.common.server.bo.MethodTypeEnum in project pinpoint by naver.
the class ThriftApiMetaDataHandler method handleApiMetaData.
private TResult handleApiMetaData(TApiMetaData apiMetaData) {
try {
final String agentId = apiMetaData.getAgentId();
final long agentStartTime = apiMetaData.getAgentStartTime();
final int apiId = apiMetaData.getApiId();
int lineNumber = LineNumber.NO_LINE_NUMBER;
if (apiMetaData.isSetLine()) {
lineNumber = apiMetaData.getLine();
}
MethodTypeEnum methodType = MethodTypeEnum.DEFAULT;
if (apiMetaData.isSetType()) {
methodType = MethodTypeEnum.valueOf(apiMetaData.getType());
}
final String apiInfo = apiMetaData.getApiInfo();
final ApiMetaDataBo apiMetaDataBo = new ApiMetaDataBo(agentId, agentStartTime, apiId, lineNumber, methodType, apiInfo);
this.apiMetaDataService.insert(apiMetaDataBo);
} catch (Exception e) {
logger.warn("Failed to handle apiMetaData={}, Caused:{}", apiMetaData, e.getMessage(), e);
final TResult result = new TResult(false);
result.setMessage(e.getMessage());
return result;
}
return new TResult(true);
}
Aggregations