Skip to content
Permalink
Browse files

Merge pull request #238 from iteratec/feature/adaptInteractiveMetrics…

…PersistenceToWpt

Feature/adapt interactive metrics persistence to wpt
  • Loading branch information...
Johannes Weiß
Johannes Weiß committed Aug 14, 2019
2 parents fedc45a + 393f88c commit d4cc0cad08ca666d59357f632a19e85132720201
@@ -430,8 +430,8 @@ OpenSpeedMonitor.ChartModules.AggregationData.MeasurandOrder = [
"VISUALLY_COMPLETE_95",
"VISUALLY_COMPLETE_90",
"VISUALLY_COMPLETE_85",
"CONSISTENTLY_INTERACTIVE",
"FIRST_INTERACTIVE",
"TIME_TO_INTERACTIVE",
"FIRST_CPU_IDLE",
"SPEED_INDEX",
"DOC_COMPLETE_TIME",
"LOAD_TIME",
@@ -76,8 +76,8 @@ class EventResult implements CsiValue, RepresentableWptResult {
Double csByWptDocCompleteInPercent
Double csByWptVisuallyCompleteInPercent

Integer consistentlyInteractiveInMillisecs
Integer firstInteractiveInMillisecs
Integer firstCpuIdleInMillisecs
Integer timeToInteractiveInMillisecs
Integer visuallyComplete85InMillisecs
Integer visuallyComplete90InMillisecs
Integer visuallyComplete95InMillisecs
@@ -171,8 +171,8 @@ class EventResult implements CsiValue, RepresentableWptResult {
firstMeaningfulPaint(nullable: true)
firstContentfulPaint(nullable: true)

consistentlyInteractiveInMillisecs(nullable: true)
firstInteractiveInMillisecs(nullable: true)
firstCpuIdleInMillisecs(nullable: true)
timeToInteractiveInMillisecs(nullable: true)

visuallyComplete85InMillisecs(nullable: true)
visuallyComplete90InMillisecs(nullable: true)
@@ -346,8 +346,8 @@ de.iteratec.isr.measurand.VISUALLY_COMPLETE_85=85% Visually Complete
de.iteratec.isr.measurand.VISUALLY_COMPLETE_90=90% Visually Complete
de.iteratec.isr.measurand.VISUALLY_COMPLETE_95=95% Visually Complete
de.iteratec.isr.measurand.VISUALLY_COMPLETE_99=99% Visually Complete
de.iteratec.isr.measurand.FIRST_INTERACTIVE=First Interactive
de.iteratec.isr.measurand.CONSISTENTLY_INTERACTIVE=Consistently Interactive
de.iteratec.isr.measurand.FIRST_CPU_IDLE=First CPU Idle
de.iteratec.isr.measurand.TIME_TO_INTERACTIVE=Time to Interactive
de.iteratec.isr.measurand.JS_TOTAL_BYTES=Bytes Javascript
de.iteratec.isr.measurand.IMAGE_TOTAL_BYTES=Bytes Images
de.iteratec.isr.measurand.CSS_TOTAL_BYTES=Bytes CSS
@@ -1092,8 +1092,8 @@ frontend.de.iteratec.isr.measurand.VISUALLY_COMPLETE_85=85% Visually Complete
frontend.de.iteratec.isr.measurand.VISUALLY_COMPLETE_90=90% Visually Complete
frontend.de.iteratec.isr.measurand.VISUALLY_COMPLETE_95=95% Visually Complete
frontend.de.iteratec.isr.measurand.VISUALLY_COMPLETE_99=99% Visually Complete
frontend.de.iteratec.isr.measurand.FIRST_INTERACTIVE=First Interactive
frontend.de.iteratec.isr.measurand.CONSISTENTLY_INTERACTIVE=Consistently Interactive
frontend.de.iteratec.isr.measurand.FIRST_CPU_IDLE=First CPU Idle
frontend.de.iteratec.isr.measurand.TIME_TO_INTERACTIVE=Time to Interactive
frontend.de.iteratec.isr.measurand._HERO_Heading=Hero: Heading
frontend.de.iteratec.isr.measurand._HERO_BackgroundImage=Hero: Background image
frontend.de.iteratec.isr.measurand._HERO_FirstPaintedHero=Hero: First
@@ -338,8 +338,8 @@ de.iteratec.isr.measurand.SPEED_INDEX=Speed Index
de.iteratec.isr.measurand.VISUALLY_COMPLETE=Visually Complete
de.iteratec.isr.measurand.CS_BY_WPT_DOC_COMPLETE=Kundenzufriedenheit (Document Complete)
de.iteratec.isr.measurand.CS_BY_WPT_VISUALLY_COMPLETE=Kundenzufriedenheit (Visually Complete)
de.iteratec.isr.measurand.FIRST_INTERACTIVE=First Interactive
de.iteratec.isr.measurand.CONSISTENTLY_INTERACTIVE=Consistently Interactive
de.iteratec.isr.measurand.FIRST_CPU_IDLE=First CPU Idle
de.iteratec.isr.measurand.TIME_TO_INTERACTIVE=Time to Interactive
de.iteratec.isr.measurand.JS_TOTAL_BYTES=Bytes Javascript
de.iteratec.isr.measurand.IMAGE_TOTAL_BYTES=Bytes Images
de.iteratec.isr.measurand.CSS_TOTAL_BYTES=Bytes CSS
@@ -1070,8 +1070,8 @@ frontend.de.iteratec.isr.measurand.CSS_TOTAL_BYTES=Bytes CSS
frontend.de.iteratec.isr.measurand.HTML_TOTAL_BYTES=Bytes HTML
frontend.de.iteratec.isr.measurand.FIRST_MEANINGFUL_PAINT=First Meaningful Paint
frontend.de.iteratec.isr.measurand.FIRST_CONTENTFUL_PAINT=First Contentful Paint
frontend.de.iteratec.isr.measurand.FIRST_INTERACTIVE=First Interactive
frontend.de.iteratec.isr.measurand.CONSISTENTLY_INTERACTIVE=Consistently Interactive
frontend.de.iteratec.isr.measurand.FIRST_CPU_IDLE=First CPU Idle
frontend.de.iteratec.isr.measurand.TIME_TO_INTERACTIVE=Time to Interactive
frontend.de.iteratec.isr.measurand._HERO_Heading=Hero: Heading
frontend.de.iteratec.isr.measurand._HERO_BackgroundImage=Hero: Background image
frontend.de.iteratec.isr.measurand._HERO_FirstPaintedHero=Hero: First
@@ -0,0 +1,28 @@
databaseChangeLog = {
changeSet(author: "nkuhn (generated)", id: "1565102741447-1") {
renameColumn(
tableName: "event_result",
oldColumnName: "first_interactive_in_millisecs",
newColumnName: "first_cpu_idle_in_millisecs",
columnDataType: "integer")
}
changeSet(author: "nkuhn (generated)", id: "1565102741447-2") {
renameColumn(
tableName: "event_result",
oldColumnName: "consistently_interactive_in_millisecs",
newColumnName: "time_to_interactive_in_millisecs",
columnDataType: "integer")
}
changeSet(author: "nkuhn", id: "1565102741447-3") {
sql('''
UPDATE performance_aspect
SET metric_identifier = 'TIME_TO_INTERACTIVE' where metric_identifier = 'CONSISTENTLY_INTERACTIVE';
''')
}
changeSet(author: "nkuhn", id: "1565102741447-4") {
sql('''
UPDATE performance_aspect
SET metric_identifier = 'FIRST_CPU_IDLE' where metric_identifier = 'FIRST_INTERACTIVE';
''')
}
}
@@ -79,4 +79,5 @@ databaseChangeLog = {
include file: '2019-05-06-v512-add-os-and-device-type.groovy'
include file: '2019-05-20-migrate-otto-locations.groovy'
include file: '2019-06-19-add-user-timing-idx.groovy'
include file: '2019-08-05-rename-interactive-fields.groovy'
}
@@ -27,7 +27,6 @@ import de.iteratec.osm.measurement.environment.WebPageTestServer
import de.iteratec.osm.measurement.schedule.Job
import de.iteratec.osm.measurement.schedule.JobDaoService
import de.iteratec.osm.measurement.schedule.JobGroup
import de.iteratec.osm.report.external.GraphiteComunicationFailureException
import de.iteratec.osm.report.external.GraphiteReportService
import de.iteratec.osm.report.external.MetricReportingService
import de.iteratec.osm.result.*
@@ -40,7 +39,6 @@ import org.springframework.transaction.annotation.Propagation
import java.util.zip.GZIPOutputStream

import static de.iteratec.osm.util.PerformanceLoggingService.LogLevel.DEBUG

/**
* Persists locations and results. Observer of JobResultPersisterService.
*/
@@ -280,6 +278,7 @@ class EventResultPersisterService implements iResultListener {
result.deviceType = result.location.deviceType
result.operatingSystem = result.location.operatingSystem
setAllMeasurands(viewTag, result)
adaptInteractivityMeasurands(viewTag, result)
result.testAgent = jobRun.testAgent
setConnectivity(result, jobRun)
result.oneBasedStepIndexInJourney = testStepOneBasedIndex
@@ -328,6 +327,13 @@ class EventResultPersisterService implements iResultListener {
return !viewTag.getProperty(tag).isEmpty() && viewTag.getProperty(tag).toString().isBigInteger() && viewTag.getProperty(tag).toBigInteger() > 0
}

private void adaptInteractivityMeasurands(GPathResult viewTag, EventResult result) {
if (!tagExists(viewTag, Measurand.FIRST_CPU_IDLE.getTagInResultXml()) && tagExists(viewTag, Measurand.TIME_TO_INTERACTIVE.getTagInResultXml())) {
result.firstCpuIdleInMillisecs = viewTag.getProperty(Measurand.TIME_TO_INTERACTIVE.getTagInResultXml()).toInteger()
result.timeToInteractiveInMillisecs = null
}
}

private void setBreakdownMeasurands(GPathResult viewtag, EventResult result) {
if(tagExists(viewtag.parent(), "breakdown")) {
viewtag.parent().breakdown.children().forEach { measurand ->
@@ -108,8 +108,8 @@
VISUALLY_COMPLETE: '${message(code: 'de.iteratec.isr.measurand.VISUALLY_COMPLETE')}',
CS_BY_WPT_DOC_COMPLETE: '${message(code: 'de.iteratec.isr.measurand.CS_BY_WPT_DOC_COMPLETE')}',
CS_BY_WPT_VISUALLY_COMPLETE: '${message(code: 'de.iteratec.isr.measurand.CS_BY_WPT_VISUALLY_COMPLETE')}',
FIRST_INTERACTIVE: '${message(code: 'de.iteratec.isr.measurand.FIRST_INTERACTIVE')}',
CONSISTENTLY_INTERACTIVE: '${message(code: 'de.iteratec.isr.measurand.CONSISTENTLY_INTERACTIVE')}'
FIRST_CPU_IDLE: '${message(code: 'de.iteratec.isr.measurand.FIRST_CPU_IDLE')}',
TIME_TO_INTERACTIVE: '${message(code: 'de.iteratec.isr.measurand.TIME_TO_INTERACTIVE')}'
};
OpenSpeedMonitor.i18n.thresholdButtons = {
submit: '${message(code: 'job.threshold.submit')}',
@@ -15,7 +15,7 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
JobGroup jobGroup
Page page1, page2
Browser browser1, browser2
SelectedMeasurand docComplete, countRequest, startRender, firstContentfulPaint, visuallyCompleteInMillisecs, consistentlyInteractiveInMillisecs
SelectedMeasurand docComplete, countRequest, startRender, firstContentfulPaint, visuallyCompleteInMillisecs, timeToInteractiveInMillisecs

def setup() {
jobGroup = JobGroup.build()
@@ -28,7 +28,7 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
startRender = createMeasurand("START_RENDER")
firstContentfulPaint = createMeasurand("FIRST_CONTENTFUL_PAINT")
visuallyCompleteInMillisecs = createMeasurand("VISUALLY_COMPLETE")
consistentlyInteractiveInMillisecs = createMeasurand("CONSISTENTLY_INTERACTIVE")
timeToInteractiveInMillisecs = createMeasurand("TIME_TO_INTERACTIVE")
}

void "avg of aspect metrics, all results share the same aspect metrics, grouped by jobgroup, page + browser"() {
@@ -37,12 +37,12 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
int resultCounter = 0
10.times {
persistEventResult([
startRenderInMillisecs : 300 + resultCounter,
firstContentfulPaint : 400 + resultCounter,
docCompleteTimeInMillisecs : 1200 + resultCounter,
docCompleteRequests : 35 + resultCounter,
visuallyCompleteInMillisecs : 500 + resultCounter,
consistentlyInteractiveInMillisecs: 600 + resultCounter
startRenderInMillisecs : 300 + resultCounter,
firstContentfulPaint : 400 + resultCounter,
docCompleteTimeInMillisecs : 1200 + resultCounter,
docCompleteRequests : 35 + resultCounter,
visuallyCompleteInMillisecs : 500 + resultCounter,
timeToInteractiveInMillisecs: 600 + resultCounter
])
resultCounter++
}
@@ -64,7 +64,7 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
result.docCompleteTimeInMillisecs == 1204.5
!result.docCompleteRequests
!result.visuallyCompleteInMillisecs
!result.consistentlyInteractiveInMillisecs
!result.timeToInteractiveInMillisecs
result.PAGE_CONSTRUCTION_STARTED == 404.5
}

@@ -74,12 +74,12 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
persistAspect(PerformanceAspectType.PAGE_CONSTRUCTION_STARTED, startRender, page1, browser2)
10.times {
LinkedHashMap<String, Integer> metrics = [
startRenderInMillisecs : 300,
firstContentfulPaint : 400,
docCompleteTimeInMillisecs : 1200,
docCompleteRequests : 35,
visuallyCompleteInMillisecs : 500,
consistentlyInteractiveInMillisecs: 600
startRenderInMillisecs : 300,
firstContentfulPaint : 400,
docCompleteTimeInMillisecs : 1200,
docCompleteRequests : 35,
visuallyCompleteInMillisecs : 500,
timeToInteractiveInMillisecs: 600
]
persistEventResult(metrics, page1, browser1)
persistEventResult(metrics, page1, browser2)
@@ -100,24 +100,24 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
result.docCompleteTimeInMillisecs == 1200
!result.docCompleteRequests
!result.visuallyCompleteInMillisecs
!result.consistentlyInteractiveInMillisecs
!result.timeToInteractiveInMillisecs
result.PAGE_CONSTRUCTION_STARTED == (10*300+10*400)/20
}

void "avg of aspect metrics for multiple aspects, results with different aspect metrics, grouped by jobgroup + page"() {
given: "Twenty EventResults with different aspect metrics and matching Aspects in db."
persistAspect(PerformanceAspectType.PAGE_CONSTRUCTION_STARTED, firstContentfulPaint, page1, browser1)
persistAspect(PerformanceAspectType.PAGE_CONSTRUCTION_STARTED, startRender, page1, browser2)
persistAspect(PerformanceAspectType.PAGE_SHOWS_USEFUL_CONTENT, consistentlyInteractiveInMillisecs, page1, browser1)
persistAspect(PerformanceAspectType.PAGE_SHOWS_USEFUL_CONTENT, timeToInteractiveInMillisecs, page1, browser1)
int visCompleteAsDefault = 500 // for PAGE_SHOWS_USEFUL_CONTENT
10.times {
LinkedHashMap<String, Integer> metrics = [
startRenderInMillisecs : 300,
firstContentfulPaint : 400,
docCompleteTimeInMillisecs : 1200,
docCompleteRequests : 35,
visuallyCompleteInMillisecs : visCompleteAsDefault,
consistentlyInteractiveInMillisecs: 600
startRenderInMillisecs : 300,
firstContentfulPaint : 400,
docCompleteTimeInMillisecs : 1200,
docCompleteRequests : 35,
visuallyCompleteInMillisecs : visCompleteAsDefault,
timeToInteractiveInMillisecs: 600
]
persistEventResult(metrics, page1, browser1)
persistEventResult(metrics, page1, browser2)
@@ -138,7 +138,7 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
result.docCompleteTimeInMillisecs == 1200
!result.docCompleteRequests
!result.visuallyCompleteInMillisecs
!result.consistentlyInteractiveInMillisecs
!result.timeToInteractiveInMillisecs
result.PAGE_CONSTRUCTION_STARTED == (10*300+10*400)/20
result.PAGE_SHOWS_USEFUL_CONTENT == (10*600+10*visCompleteAsDefault)/20
}
@@ -149,12 +149,12 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
int firstContentfulPaintValue = 300
10.times {
LinkedHashMap<String, Integer> metrics = [
startRenderInMillisecs : 300,
firstContentfulPaint : firstContentfulPaintValue,
docCompleteTimeInMillisecs : 1200,
docCompleteRequests : 35,
visuallyCompleteInMillisecs : 500,
consistentlyInteractiveInMillisecs: 600
startRenderInMillisecs : 300,
firstContentfulPaint : firstContentfulPaintValue,
docCompleteTimeInMillisecs : 1200,
docCompleteRequests : 35,
visuallyCompleteInMillisecs : 500,
timeToInteractiveInMillisecs: 600
]
persistEventResult(metrics, page1, browser1)
}
@@ -176,7 +176,7 @@ class QueryAspectsViaBuilderAverageSpec extends NonTransactionalIntegrationSpec
!result.docCompleteTimeInMillisecs
!result.docCompleteRequests
!result.visuallyCompleteInMillisecs
!result.consistentlyInteractiveInMillisecs
!result.timeToInteractiveInMillisecs
}

private void persistEventResult(Map<String, Integer> measurands, Page page = page1, Browser browser = browser1) {

0 comments on commit d4cc0ca

Please sign in to comment.
You can’t perform that action at this time.