{"id":22360367,"url":"https://github.com/sergueik/chrome_page_performance_sqlite_java","last_synced_at":"2026-02-13T08:52:14.914Z","repository":{"id":31301513,"uuid":"127497426","full_name":"sergueik/chrome_page_performance_sqlite_java","owner":"sergueik","description":"collects page performance metrics through javascript methods supported  by chome  and firefox","archived":false,"fork":false,"pushed_at":"2024-10-03T18:42:56.000Z","size":163,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-04T16:15:44.532Z","etag":null,"topics":["chrome","java","selenium-webdriver"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sergueik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-03-31T04:02:22.000Z","updated_at":"2024-02-06T15:20:23.000Z","dependencies_parsed_at":"2023-12-03T00:26:24.478Z","dependency_job_id":"5de7ee50-8340-4c85-80f3-61fd1a1cf478","html_url":"https://github.com/sergueik/chrome_page_performance_sqlite_java","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergueik%2Fchrome_page_performance_sqlite_java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergueik%2Fchrome_page_performance_sqlite_java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergueik%2Fchrome_page_performance_sqlite_java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sergueik%2Fchrome_page_performance_sqlite_java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sergueik","download_url":"https://codeload.github.com/sergueik/chrome_page_performance_sqlite_java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236541921,"owners_count":19165763,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome","java","selenium-webdriver"],"created_at":"2024-12-04T16:16:01.163Z","updated_at":"2025-10-05T09:24:34.993Z","avatar_url":"https://github.com/sergueik.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Info ###\n\nThe __Java Chrome Page Element Load Timing Collector__ project is based on [Szada30/Java-Selenium-LoadTime](https://github.com/Szada30/Java-Selenium-LoadTime) project and [.Net version of the Chrome Page Element Load Timing Collector](https://github.com/sergueik/chrome_page_performance_sqlite).\n\nSelenium driver is used to launch the Chrome browser (alternatively [Chome Devkit Protocol driver](https://github.com/ChromeDevTools/awesome-chrome-devtools) may be used)\nand load the target page then collects the page performance timings offered by Chrome browser:\n```javascript\nvar performance = window.performance;\nvar timings = performance.timing;\nreturn timings;\n```\nAlternatively the more advanced `timing.js` script from [Addy Osmani's repository](https://github.com/addyosmani/timing.js/blob/master/timing.js\n) is called, and the results are deserialized into a `Map\u003cString, Double\u003e` either implicitly by deserializing the string value produced by `JSON.stringify()` method with [one of many available](https://stleary.github.io/JSON-java/) __JSON__ parsing libraries or by extracting the object via home-brewed parser of the value returned by Javascript API, as shown below.\n\n![data.db](https://github.com/sergueik/chrome_page_performance_sqlite_java/blob/master/screenshots/data.png)\n\nSee [https://github.com/addyosmani/timing.js/blob/master/timing.js](https://github.com/addyosmani/timing.js/blob/master/timing.js) for details of how the `timings.loadTime`,`timings.domReadyTime`  etc. are calculated):\n```javascript\n(function(window) {\n    'use strict';\n    window.timing = window.timing ||\n        {\n            getTimes: function(opt) {\n                var performance = window.performance ||\n                    window.webkitPerformance || window.msPerformance ||\n                    window.mozPerformance;\n                if (performance === undefined) {\n                    return '';\n                }\n                var timings = performance.timing || {};\n                NOTE: legacy conversion\n                if (opt \u0026\u0026 opt['stringify']){\n                    return JSON.stringify(timings);\n                } else {\n                \treturn timings;\n                }\n            },\n            getNetwork: function(opt) {\n                var network = performance.getEntries() || {};\n                if (opt \u0026\u0026 opt['stringify']){\n                \treturn JSON.stringify(network);\n                } else {\n                \treturn network;\n                }\n            }\n        }\n})(typeof window !== 'undefined' ? window : {});\nreturn window.timing.getTimes();\nreturn window.timing.getNetwork({stringify:true});\n```\nRunning this  Javascript in the browser will return\n```javascript\n{\n  unloadEventEnd = 1512339255280,\n  responseEnd = 1512339255305,\n  responseStart = 1512339255277,\n  domInteractive = 1512339256932,\n  domainLookupEnd = 1512339255033,\n  unloadEventStart = 1512339255279,\n  domComplete = 1512339263380,\n  domContentLoadedEventStart = 1512339256932,\n  domainLookupStart = 1512339255033,\n  redirectEnd = 0,\n  redirectStart = 0,\n  connectEnd = 1512339255033,\n  toJSON = {},\n  connectStart = 1512339255033,\n  loadEventStart = 1512339263380,\n  navigationStart = 1512339255032,\n  requestStart = 1512339255035,\n  secureConnectionStart = 0,\n  fetchStart = 1512339255033,\n  domContentLoadedEventEnd = 1512339256934,\n  domLoading = 1512339255302,\n  loadEventEnd = 1512339263471\n}\n```\nof (when `opt[stringify]` is set):\n```javascript\n{\n  \"navigationStart\": 1512338852987,\n  \"unloadEventStart\": 1512338855099,\n  \"unloadEventEnd\": 1512338855100,\n  \"redirectStart\": 0,\n  \"redirectEnd\": 0,\n  \"fetchStart\": 1512338852988,\n  \"domainLookupStart\": 1512338852988,\n  \"domainLookupEnd\": 1512338852988,\n  \"connectStart\": 1512338852988,\n  \"connectEnd\": 1512338852988,\n  \"secureConnectionStart\": 0,\n  \"requestStart\": 1512338852990,\n  \"responseStart\": 1512338855090,\n  \"responseEnd\": 1512338855130,\n  \"domLoading\": 1512338855135,\n  \"domInteractive\": 1512338856653,\n  \"domContentLoadedEventStart\": 1512338856655,\n  \"domContentLoadedEventEnd\": 1512338856658,\n  \"domComplete\": 1512338862728,\n  \"loadEventStart\": 1512338862728,\n  \"loadEventEnd\": 1512338862864\n}\n```\nThe Java application subsequently dumps the results ino SQLite database using [JDBC](https://www.tutorialspoint.com/sqlite/sqlite_java.htm)\n\nThis is a lot easier to process than the full SeleniumDriver log: \n```java\nChromeOptions options = new ChromeOptions();\nLoggingPreferences loggingPreferences = new LoggingPreferences();\nloggingPreferences.enable(LogType.PERFORMANCE, Level.ALL);\ncapabilities.setCapability(CapabilityType.LOGGING_PREFS,\n    loggingPreferences);\n  driver = new ChromeDriver(capabilities);\n\nLogEntries logEntries = driver.manage().logs().get(LogType.PERFORMANCE);\n```\nwhich looks like\n\n```javascript\n...\n{\n    \"message\": {\n        \"method\": \"Page.loadEventFired\",\n        \"params\": {\n            \"timestamp\": 534304.116728\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Page.frameStoppedLoading\",\n        \"params\": {\n            \"frameId\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Page.domContentEventFired\",\n        \"params\": {\n            \"timestamp\": 534304.117791\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Page.frameStartedLoading\",\n        \"params\": {\n            \"frameId\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Network.requestWillBeSent\",\n        \"params\": {\n            \"documentURL\": \"https://www.priceline.com/\",\n            \"frameId\": \"2C55735DE539FCE8BEA1A6CA827A511\",\n            \"initiator\": {\n                \"type\": \"other\"\n            },\n            \"loaderId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"request\": {\n                \"headers\": {\n                    \"Upgrade-Insecure-Requests\": \"1\",\n                    \"User-Agent\": \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/65.0.3325.181 Safari/537.36\"\n                },\n                \"initialPriority\": \"VeryHigh\",\n                \"method\": \"GET\",\n                \"mixedContentType\": \"none\",\n                \"referrerPolicy\": \"no-referrer-when-downgrade\",\n                \"url\": \"https://www.priceline.com/\"\n            },\n            \"requestId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"timestamp\": 534305.113269,\n            \"type\": \"Document\",\n            \"wallTime\": 1523124859.15939\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Network.responseReceived\",\n        \"params\": {\n            \"frameId\": \"2C55735DE539FCE8BEA1A6CA827A511\",\n            \"loaderId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"requestId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"response\": {\n                \"connectionId\": 9,\n                \"connectionReused\": false,\n                \"encodedDataLength\": 711,\n                \"fromDiskCache\": false,\n                \"fromServiceWorker\": false,\n                \"headers\": {\n                    \"accept-ranges\": \"bytes\\nbytes\",\n                    \"content-encoding\": \"gzip\",\n                    \"content-type\": \"text/html; charset=utf-8\",\n                    \"date\": \"Sat, 07 Apr 2018 18:14:21 GMT\",\n                    \"etag\": \"W/\\\"4f6f6-OEvAhjqSi26QYORsGBqJx8NiXSI\\\"\",\n                    \"server\": \"nginx\",\n                    \"set-cookie\": \"SITESERVER=ID=2201b110990e4a5e879513e0bd7a5b1b; Domain=.priceline.com; Path=/; Expires=Mon, 30 Mar 2048 18:14:20 GMT; Secure\\nvid=v2018040718142064586c21; Domain=.priceline.com; Path=/; HttpOnly; Secure\\nReferral=CLICKID=\u0026WEBENTRYTIME=4%2F7%2F2018%2014%3A14%3A20\u0026ID=DIRECT\u0026PRODUCTID=\u0026SOURCEID=DT; Domain=.priceline.com; Path=/; Expires=Mon, 07 May 2018 18:14:20 GMT; HttpOnly; Secure\\npclnguidse=52a268c6b2019fe7ab28a88500e6e1968b93f219;Path=/;Domain=.priceline.com\\npclnguidpe=52a268c6b2019fe7ab28a88500e6e1968b93f219;Path=/;Domain=.priceline.com;Expires=Tue, 04-Apr-2028 18:14:21 GMT\",\n                    \"status\": \"200\",\n                    \"vary\": \"Accept-Encoding\",\n                    \"via\": \"1.1 varnish\\n1.1 varnish\",\n                    \"wsheader\": \"ws=fMIA/fIAD/ny-home001 D=0.437 NT=448\",\n                    \"x-cache\": \"MISS, MISS\",\n                    \"x-cache-hits\": \"0, 0\",\n                    \"x-served-by\": \"cache-iad2127-IAD, cache-mia17629-MIA\",\n                    \"x-timer\": \"S1523124861.619507,VS0,VE484\"\n                },\n                \"mimeType\": \"text/html\",\n                \"protocol\": \"h2\",\n                \"remoteIPAddress\": \"151.101.2.186\",\n                \"remotePort\": 443,\n                \"requestHeaders\": {\n                    \":authority\": \"www.priceline.com\",\n                    \":method\": \"GET\",\n                    \":path\": \"/\",\n                    \":scheme\": \"https\",\n                    \"accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8\",\n                    \"accept-encoding\": \"gzip, deflate\",\n                    \"upgrade-insecure-requests\": \"1\",\n                    \"user-agent\": \"Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/65.0.3325.181 Safari/537.36\"\n                },\n                \"securityDetails\": {\n                    \"certificateId\": 0,\n                    \"cipher\": \"AES_128_GCM\",\n                    \"issuer\": \"GlobalSign CloudSSL CA - SHA256 - G3\",\n                    \"keyExchange\": \"ECDHE_RSA\",\n                    \"keyExchangeGroup\": \"X25519\",\n                    \"protocol\": \"TLS 1.2\",\n                    \"sanList\": [\"priceline.map.fastly.net\", \"*.pclncdn.com\", \"*.priceline.com\", \"mobileimg.priceline.com\", \"pclncdn.com\", \"tickets.priceline.com\", \"travel.priceline.com\", \"www.priceline.com\"],\n                    \"signedCertificateTimestampList\": [{\n                        \"hashAlgorithm\": \"SHA-256\",\n                        \"logDescription\": \"Symantec log\",\n                        \"logId\": \"DDEB1D2B7A0D4FA6208B81AD8168707E2E8E9D01D55C888D3D11C4CDB6ECBECC\",\n                        \"origin\": \"Embedded in certificate\",\n                        \"signatureAlgorithm\": \"ECDSA\",\n                        \"signatureData\": \"3046022100EF2C99BC7629C684FDF08D939F2AD190D767DA05308DD170FC5F9543BDD7A28D0221009DC0CAC7EF21919E7D3F699961E51D4312E8022FAB904959FF8BE973EFC6F578\",\n                        \"status\": \"Verified\",\n                        \"timestamp\": 1516741627217.0\n                    }, {\n                        \"hashAlgorithm\": \"SHA-256\",\n                        \"logDescription\": \"Google 'Skydiver' log\",\n                        \"logId\": \"BBD9DFBC1F8A71B593942397AA927B473857950AAB52E81A909664368E1ED185\",\n                        \"origin\": \"Embedded in certificate\",\n                        \"signatureAlgorithm\": \"ECDSA\",\n                        \"signatureData\": \"304402205B7043E321863ABDC7CDCA3828E36E3CE7D25661E3E508B3A67C499A6F32A6FA022037E03E4F8A57A3E71E8F5ABB0043EDD8502AAF67845B7BB4054BD7526CC99C18\",\n                        \"status\": \"Verified\",\n                        \"timestamp\": 1516741627363.0\n                    }, {\n                        \"hashAlgorithm\": \"SHA-256\",\n                        \"logDescription\": \"DigiCert Log Server\",\n                        \"logId\": \"5614069A2FD7C2ECD3F5E1BD44B23EC74676B9BC99115CC0EF949855D689D0DD\",\n                        \"origin\": \"Embedded in certificate\",\n                        \"signatureAlgorithm\": \"ECDSA\",\n                        \"signatureData\": \"3046022100D5B55C035E35C5DC9EC5BBD954F5C985799F31861D0E20E837412BCAE186BB1C0221008393F5E08D549877235006A5F276A9CD326AEE37EA67937E6162B2560CFE8B94\",\n                        \"status\": \"Verified\",\n                        \"timestamp\": 1516741627307.0\n                    }, {\n                        \"hashAlgorithm\": \"SHA-256\",\n                        \"logDescription\": \"Google 'Rocketeer' log\",\n                        \"logId\": \"EE4BBDB775CE60BAE142691FABE19E66A30F7E5FB072D88300C47B897AA8FDCB\",\n                        \"origin\": \"Embedded in certificate\",\n                        \"signatureAlgorithm\": \"ECDSA\",\n                        \"signatureData\": \"304402203B3F86F6E547BF5F6E14E218A7EFBD09DDA0F617BBA2B3CE0A8B1F1198236083022048F02E2079AEF019969E54D47E954E09F960A655AC5FA967C5805288C71374AD\",\n                        \"status\": \"Verified\",\n                        \"timestamp\": 1516741627937.0\n                    }],\n                    \"subjectName\": \"priceline.map.fastly.net\",\n                    \"validFrom\": 1516741624,\n                    \"validTo\": 1536238759\n                },\n                \"securityState\": \"secure\",\n                \"status\": 200,\n                \"statusText\": \"\",\n                \"timing\": {\n                    \"connectEnd\": 307.547000003979,\n                    \"connectStart\": 138.16199998837,\n                    \"dnsEnd\": 138.16199998837,\n                    \"dnsStart\": 129.266000003554,\n                    \"proxyEnd\": 126.842000056058,\n                    \"proxyStart\": 114.427000051364,\n                    \"pushEnd\": 0,\n                    \"pushStart\": 0,\n                    \"receiveHeadersEnd\": 812.544999993406,\n                    \"requestTime\": 534304.292439,\n                    \"sendEnd\": 309.232000028715,\n                    \"sendStart\": 308.51000000257,\n                    \"sslEnd\": 307.429000036791,\n                    \"sslStart\": 176.882000057958,\n                    \"workerReady\": -1,\n                    \"workerStart\": -1\n                },\n                \"url\": \"https://www.priceline.com/\"\n            },\n            \"timestamp\": 534305.117249,\n            \"type\": \"Document\"\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Network.dataReceived\",\n        \"params\": {\n            \"dataLength\": 16862,\n            \"encodedDataLength\": 0,\n            \"requestId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"timestamp\": 534305.117938\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Page.frameNavigated\",\n        \"params\": {\n            \"frame\": {\n                \"id\": \"2C55735DE539FCE8BEA1A6CA827A511\",\n                \"loaderId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n                \"mimeType\": \"text/html\",\n                \"securityOrigin\": \"https://www.priceline.com\",\n                \"url\": \"https://www.priceline.com/\"\n            }\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Network.dataReceived\",\n        \"params\": {\n            \"dataLength\": 48674,\n            \"encodedDataLength\": 0,\n            \"requestId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"timestamp\": 534305.151364\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n}, {\n    \"message\": {\n        \"method\": \"Network.dataReceived\",\n        \"params\": {\n            \"dataLength\": 65536,\n            \"encodedDataLength\": 0,\n            \"requestId\": \"14DFFA25E9B5979541C96D5481B309AA\",\n            \"timestamp\": 534305.176181\n        }\n    },\n    \"webview\": \"2C55735DE539FCE8BEA1A6CA827A511\"\n},\n...\n\n```\n\nLoading results into ELK is a work in progress.\nSome tests work successfully only when the browser is visible , and fail with timeout exception when headless. \nIt is not related to the main objective of this project.\n\n### See Also\n\n * [Chrome DevTools API](https://chromedevtools.github.io/devtools-protocol/tot/Performance/#method-getMetrics), also covered in [sergueik/selenium_cdp](https://github.com/sergueik/selenium_cdp/search?q=performance) and [cdp-webdriver](https://github.com/sergueik/cdp_webdriver/search?q=performance) \n * https://github.com/sirensolutions/kibi/tree/master/native-bindings\n * https://www.elastic.co/blog/logstash-jdbc-input-plugin\n * https://www.elastic.co/guide/en/logstash/current/plugins-inputs-sqlite.html\n * https://developers.google.com/web/tools/chrome-devtools/evaluate-performance/\n * https://developers.google.com/web/tools/chrome-devtools/network-performance/understanding-resource-timing\n * https://chrome.google.com/webstore/detail/web-performance-timing-ap/nllipdabkglnhmanndddgcihbcmjpfej\n * https://github.com/addyosmani/timing.js/blob/master/timing.js\n * https://github.com/ChrisLMerrill/muse-webperformance-graphite\n * https://stackoverflow.com/questions/32219113/how-to-extract-network-tab-contents-of-chrome-developer-tools-via-json/37133568#37133568\n * [visualization](https://github.com/kaaes/timing) another [visualization](https://github.com/sunnylost/navigation-timing) of __Navigation Timing object__ (in Javascript)\n * [post timing info frm browser to server](https://github.com/NickMRamirez/timing)\n * https://github.com/kristopher/timing-js/blob/master/timing.js\n#### Note\n\nThe project was earlier develped inside a repository [sergueik/selenium_java](https://github.com/sergueik/selenium_java.git) - check the old past histories there.\n\n### License\nThis project is licensed under the terms of the MIT license.\n\n### Author\n\n[Serguei Kouzmine](kouzmine_serguei@yahoo.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergueik%2Fchrome_page_performance_sqlite_java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsergueik%2Fchrome_page_performance_sqlite_java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsergueik%2Fchrome_page_performance_sqlite_java/lists"}