Skip to content

Commit

Permalink
JPERF-1409 Revert adding requestId
Browse files Browse the repository at this point in the history
I've found no jira log entries in JPT that contain requestId.
In other words, I'm not sure if it's valuable so better skip it.
It can be easily added later
  • Loading branch information
mgrzaslewicz committed Nov 8, 2023
1 parent 21c68b9 commit f9aa00c
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 24 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Dropping a requirement of a major version of a dependency is a new contract.

### Added
- Add `nodeId` to `PerformanceServerTiming`. Aid with [JPERF-1409].
- Add `requestId` to `PerformanceServerTiming`. Aid with [JPERF-1409].
- Add `ActionMetric.toBackendTimeSlots()`. Aid with [JPERF-1409].

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ data class ActionMetric @Deprecated("Use ActionMetric.Builder instead.") constru
?.description
?.toLong()
?: throw Exception("No threadId in $this, so we cannot map it to a backend timeslot"),
requestId = resource
.serverTiming
.find { it.name == "requestId" }
?.description,
nodeId = resource
.serverTiming
.find { it.name == "nodeId" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ class BackendTimeSlot internal constructor(
val start: Instant,
val end: Instant,
val threadId: Long,
val requestId: String?,
val nodeId: String?
) {
val duration: Duration = Duration.between(start, end)

fun contains(instant: Instant): Boolean = instant.isAfter(start) && instant.isBefore(end)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
Expand All @@ -23,7 +22,6 @@ class BackendTimeSlot internal constructor(
if (start != other.start) return false
if (end != other.end) return false
if (threadId != other.threadId) return false
if (requestId != other.requestId) return false
if (nodeId != other.nodeId) return false
if (duration != other.duration) return false

Expand All @@ -34,14 +32,13 @@ class BackendTimeSlot internal constructor(
var result = start.hashCode()
result = 31 * result + end.hashCode()
result = 31 * result + threadId.hashCode()
result = 31 * result + (requestId?.hashCode() ?: 0)
result = 31 * result + (nodeId?.hashCode() ?: 0)
result = 31 * result + duration.hashCode()
return result
}

override fun toString(): String {
return "BackendTimeSlot(start=$start, end=$end, threadId=$threadId, requestId=$requestId, nodeId=$nodeId, duration=$duration)"
return "BackendTimeSlot(start=$start, end=$end, threadId=$threadId, nodeId=$nodeId, duration=$duration)"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ private fun parseServerTimings(
val result = jsServerTimings.map { parseServerTiming(it) }.toMutableList()
val responseHeaders = getResponseHeaders(jsExecutor)
val nodeId = responseHeaders["x-anodeid"]
val requestId = responseHeaders["x-arequestid"]
addAttribute(result, "nodeId", nodeId)
addAttribute(result, "requestId", requestId)
return result
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import com.atlassian.performance.tools.jiraactions.api.memories.UserMemory
import com.atlassian.performance.tools.jiraactions.api.page.isElementPresent
import com.atlassian.performance.tools.jiraactions.api.page.tolerateDirtyFormsOnCurrentPage
import com.atlassian.performance.tools.jiraactions.api.w3c.JavascriptW3cPerformanceTimeline
import com.atlassian.performance.tools.jiraactions.api.w3c.PerformanceResourceTiming
import com.atlassian.performance.tools.jiraactions.api.webdriver.sendKeysAndValidate
import org.apache.logging.log4j.LogManager
import org.apache.logging.log4j.Logger
Expand Down Expand Up @@ -99,17 +98,6 @@ abstract class AbstractJiraCoreScenario {
private fun assertDrilldown(metrics: List<ActionMetric>) {
val navigationsPerMetric = metrics.map { it.drilldown?.navigations ?: emptyList() }
assertThat(navigationsPerMetric).`as`("all results contain timings in drilldown").hasSize(metrics.size)
val navigationsCount = navigationsPerMetric.flatten().count()
val navigationsWithRequestIdCount =
navigationsPerMetric.flatten().mapNotNull { toRequestId(it.resource) }.count()
assertThat(navigationsWithRequestIdCount).`as`("all results contain requestIds in drilldown").isEqualTo(navigationsCount)
}

private fun toRequestId(resource: PerformanceResourceTiming): String? {
return resource
.serverTiming
?.find { it.name == "requestId" }
?.description
}

private fun goToServices(driver: RemoteWebDriver, jira: Jira) {
Expand Down

0 comments on commit f9aa00c

Please sign in to comment.