private boolean sameMethod(final Frame currentFrame, final Frame lastChildFrame) { final Operation lastOperation = lastChildFrame.getOperation(); final String lastMethod = getMethodAttribute(lastOperation); final Operation currentOperation = currentFrame.getOperation(); final String currentMethod = getMethodAttribute(currentOperation); return lastMethod.equals(currentMethod); }
@Override protected boolean shouldCreateExteranlResource(Frame frame) { Operation op = frame.getOperation(); String hostname = getHostname(op); return !StringUtil.isEmpty(hostname) && !GemFireDefenitions.FIELD_UNKNOWN.equals(hostname); } }
@Override protected OperationType validateScoringFrame(Frame frame) { OperationType type=super.validateScoringFrame(frame); if (type == null) { return null; } Operation op=frame.getOperation(); Boolean fromValue=op.get("from", Boolean.class); if ((fromValue == null) || (!fromValue.booleanValue())) { return null; } return type; }
@Override protected OperationType validateFrameOperation (Frame frame) { OperationType opType=super.validateFrameOperation(frame); if (opType == null) { return null; } // even if correct type, check if marked as endpoint Operation operation=frame.getOperation(); Boolean endPoint=operation.get(ENDPOINT_VALIDITY_PROP, Boolean.class); if ((endPoint == null) || (!endPoint.booleanValue())) { return null; } return opType; }
public List<TraceError> locateErrors(Trace trace) { Frame root = trace.getRootFrame(); if (root == null) { return EMPTY_LIST; } Operation rootOp = root.getOperation(); String exception = rootOp.get(EXCEPTION, String.class); if (exception != null) { int chars = Math.min(exception.length(), MAX_ERROR_LENGTH); return singletonList(new TraceError(exception.substring(0, chars))); } return EMPTY_LIST; } }
public List<TraceError> locateErrors(Trace trace) { Frame root = trace.getRootFrame(); if (root == null) { return Collections.emptyList(); } Operation rootOp = root.getOperation(); String exception = rootOp.get(OperationFields.EXCEPTION, String.class); if (!StringUtil.isEmpty(exception)) { int chars = Math.min(exception.length(), MAX_ERROR_LENGTH); return Collections.singletonList(new TraceError(exception.substring(0, chars))); } return Collections.emptyList(); } }
@Override public TraceError locateFrameError(Frame frame) { Operation op = frame.getOperation(); return new TraceError(op.getLabel()); } }
@Override protected EndPointAnalysis makeEndPoint(Frame lifecycleFrame, int depth) { Operation op = lifecycleFrame.getOperation(); String endPointExample = op.get("event", String.class); return new EndPointAnalysis(ENDPOINT_NAME, ENDPOINT_LABEL, endPointExample, getOperationScore(op, depth), op); } }
@Override protected EndPointAnalysis makeEndPoint(Frame dispatchFrame, int depth) { Operation op=dispatchFrame.getOperation(); String label=op.getLabel(); EndPointName name=EndPointName.valueOf(label.replace('/', '_')); return new EndPointAnalysis(name, label, label, getOperationScore(op, depth), op); } }
@Override public TraceError locateFrameError(Frame frame) { Operation op=frame.getOperation(); String remoteError=op.get(HttpInvokerRequestExecutorOperationCollector.REMOTE_EXCEPTION, String.class); if (StringUtil.isEmpty(remoteError)) { return null; } else { return new TraceError(remoteError); } }
@Override protected EndPointAnalysis makeEndPoint(Frame frame, int depth) { Operation op=frame.getOperation(); return new EndPointAnalysis(EndPointName.valueOf(op), op.getLabel(), op.getLabel(), getOperationScore(op, depth), op); }
@Override protected EndPointAnalysis makeEndPoint(Frame frame, int depth) { Operation op=frame.getOperation(); EndPointName endPointName=EndPointName.valueOf(op); String example=EndPointAnalysis.getHttpExampleRequest(frame); return new EndPointAnalysis(endPointName, op.getLabel(), example, getOperationScore(op, depth), op); } }
@Override protected EndPointAnalysis makeEndPoint(Frame controllerFrame, int depth) { Operation controllerOp = controllerFrame.getOperation(); String examplePath = EndPointAnalysis.getHttpExampleRequest(controllerFrame); EndPointName endPointName = EndPointName.valueOf(controllerOp); String endPointLabel = controllerOp.getLabel(); return new EndPointAnalysis(endPointName, endPointLabel, examplePath, getOperationScore(controllerOp, depth), controllerOp); } }
@Override protected EndPointAnalysis makeEndPoint(Frame si, int depth) { Operation op = si.getOperation(); String exampleRequest = op.get(SpringIntegrationDefinitions.SI_COMPONENT_TYPE_ATTR, String.class); String opLabel = op.getLabel(); EndPointName name = EndPointName.valueOf(opLabel); String label = name.getName(); return new EndPointAnalysis(name, label, exampleRequest, ANALYSIS_SCORE, op); } }
@Override protected EndPointAnalysis makeEndPoint(Frame annotatedFrame, int depth) { EndPointAnalysis result=super.makeEndPoint(annotatedFrame, depth); Operation operation=annotatedFrame.getOperation(); String annotatedName=operation.get(ENDPOINT_NAME_OVERRIDE_PROP, String.class); if (!StringUtil.isEmpty(annotatedName)) { result.setEndPoint(EndPointName.valueOf(annotatedName)); } Boolean useDepthScore=operation.get(DEPTH_SCORE_PROP, Boolean.class); if ((useDepthScore != null) && useDepthScore.booleanValue()) { result.setScore(EndPointAnalysis.depth2score(depth)); } return result; }
@Override protected EndPointAnalysis makeEndPoint(Frame grailsFrame, int depth) { Operation operation = grailsFrame.getOperation(); String resourceKey = makeResourceKey(operation.getSourceCodeLocation()); String resourceLabel = operation.getLabel(); String exampleRequest = EndPointAnalysis.getHttpExampleRequest(grailsFrame); return new EndPointAnalysis(EndPointName.valueOf(resourceKey), resourceLabel, exampleRequest, getOperationScore(operation, depth), operation); }
@Override public TraceError locateFrameError(Frame httpFrame) { Operation op = (httpFrame == null) ? null : httpFrame.getOperation(); // NOTE: if an IOException occurred we will not have a response either OperationMap response = (op == null) ? null : op.get("response", OperationMap.class); if (response == null) { return null; } int statusCode = response.getInt(STATUS_CODE_ATTR, (-1)); if ((statusCode < 0) /* no code */ || (!httpStatusIsError(statusCode))) { return null; } String reasonPhrase = response.get(REASON_PHRASE_ATTR, String.class); return new TraceError(createErrorMessage(statusCode, reasonPhrase)); }
@Override public void serialize(Frame value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeObjectField("id", value.getId()); jgen.writeObjectField("range",value.getRange()); jgen.writeObjectField("operation",value.getOperation()); jgen.writeObjectField("children",value.getChildren()); jgen.writeEndObject(); } }
@Override public void serialize(Frame value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeObjectField("id", value.getId()); jgen.writeObjectField("range", value.getRange()); jgen.writeObjectField("operation", value.getOperation()); jgen.writeObjectField("children", value.getChildren()); jgen.writeEndObject(); } }
@Override protected EndPointAnalysis makeEndPoint(Frame httpFrame, int depth) { Operation op = httpFrame.getOperation(); OperationMap request = op.get("request", OperationMap.class); String servletName=(request == null) ? null : request.get("servletName", String.class); String endPointKey=sanitizeEndPointKey(servletName); String endPointLabel = "Servlet: " + servletName; String example=EndPointAnalysis.createHttpExampleRequest(request); if (StringUtil.isEmpty(example)) { example = op.getLabel(); } return new EndPointAnalysis(EndPointName.valueOf(endPointKey), endPointLabel, example, getOperationScore(op, depth), op); }