/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } InvocationIdentifier other = (InvocationIdentifier) obj; if (this.diagnosisTimerData == null) { if (other.diagnosisTimerData != null) { return false; } } else if (!this.diagnosisTimerData.equals(other.diagnosisTimerData)) { return false; } if (this.invocationId != other.invocationId) { return false; } if (this.methodIdent != other.methodIdent) { return false; } return true; }
/** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = 1; result = (prime * result) + ((this.diagnosisTimerData == null) ? 0 : this.diagnosisTimerData.hashCode()); result = (prime * result) + (int) (this.invocationId ^ (this.invocationId >>> 32)); result = (prime * result) + (int) (this.methodIdent ^ (this.methodIdent >>> 32)); return result; }
@BeforeMethod public void init() { when(problemOccurrence.getApplicationNameIdent()).thenReturn(APP_ID); when(problemOccurrence.getBusinessTransactionNameIdent()).thenReturn(BUSINESS_TX_ID); when(problemOccurrence.getProblemContext()).thenReturn(invocationIdentifier); when(problemOccurrence.getRequestRoot()).thenReturn(invocationIdentifier); when(problemOccurrence.getGlobalContext()).thenReturn(invocationIdentifier); when(problemOccurrence.getCauseType()).thenReturn(causeType); when(problemOccurrence.getSourceType()).thenReturn(sourceType); when(problemOccurrence.getRootCause()).thenReturn(rootCause); when(invocationIdentifier.getDiagnosisTimerData()).thenReturn(diagnosisTimerData); when(rootCause.getAggregatedDiagnosisTimerData()).thenReturn(aggregatedDiagnosisTimerData); when(diagnosisTimerData.getDuration()).thenReturn(DURATION); when(diagnosisTimerData.getExclusiveDuration()).thenReturn(EXCLUSIVE_DURATION); when(aggregatedDiagnosisTimerData.getExclusiveDuration()).thenReturn(EXCLUSIVE_DURATION); when(applicationData.getName()).thenReturn(APPLICATION_NAME); when(businessTransactionData.getName()).thenReturn(BUSINESS_TX); when(methodIdent.getMethodName()).thenReturn(METHOD); when(methodIdent.getFQN()).thenReturn(FQN); }
/** * Create new InvocationIdentifier based on InvocationSequenceData. * * @param invocationSequenceData * the InvocationIdentifier the InvocationIdentifier is created */ public InvocationIdentifier(final InvocationSequenceData invocationSequenceData) { if (null == invocationSequenceData) { throw new IllegalArgumentException("Cannot create InvocationIdentifier when invocationSequenceData is null."); } this.methodIdent = invocationSequenceData.getMethodIdent(); this.invocationId = invocationSequenceData.getId(); TimerData timerData = null; if (InvocationSequenceDataHelper.hasSQLData(invocationSequenceData)) { timerData = invocationSequenceData.getSqlStatementData(); } else if (InvocationSequenceDataHelper.hasTimerData(invocationSequenceData)) { timerData = invocationSequenceData.getTimerData(); } else { throw new IllegalStateException("Timer data unknown."); } this.diagnosisTimerData = new DiagnosisTimerData(timerData); }
/** * Add fields to builder. * * @param data * ProblemOccurrence instance * @param builder * Builder that can be used to create influx points. */ protected void addFields(ProblemOccurrence data, Builder builder) { builder.addField(Series.ProblemOccurrenceInformation.FIELD_INVOCATION_ROOT_DURATION, data.getRequestRoot().getDiagnosisTimerData().getDuration()); builder.addField(Series.ProblemOccurrenceInformation.FIELD_GLOBAL_CONTEXT_METHOD_EXCLUSIVE_TIME, data.getGlobalContext().getDiagnosisTimerData().getExclusiveDuration()); builder.addField(Series.ProblemOccurrenceInformation.FIELD_ROOTCAUSE_METHOD_EXCLUSIVE_TIME, data.getRootCause().getAggregatedDiagnosisTimerData().getExclusiveDuration()); builder.addField(Series.ProblemOccurrenceInformation.FIELD_ROOTCAUSE_METHOD_EXCLUSIVE_COUNT, data.getRootCause().getAggregatedDiagnosisTimerData().getExclusiveCount()); }
/** * {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); long temp; temp = Double.doubleToLongBits(this.exclusiveCount); result = (prime * result) + (int) (temp ^ (temp >>> 32)); return result; }
/** * {@inheritDoc} */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } AggregatedDiagnosisTimerData other = (AggregatedDiagnosisTimerData) obj; if (Double.doubleToLongBits(this.exclusiveCount) != Double.doubleToLongBits(other.exclusiveCount)) { return false; } return true; }