{"id":20913068,"url":"https://github.com/mattbostock/webdriver_exporter","last_synced_at":"2025-05-13T09:31:16.162Z","repository":{"id":57568167,"uuid":"62992650","full_name":"mattbostock/webdriver_exporter","owner":"mattbostock","description":"Probes a web page using the WebDriver protocol and exposes metrics for Prometheus such as Navigation Timings","archived":false,"fork":false,"pushed_at":"2019-02-23T20:37:19.000Z","size":232,"stargazers_count":81,"open_issues_count":4,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-01T20:31:42.694Z","etag":null,"topics":["chromedriver","metrics","navigation-timing","probe","prometheus","prometheus-exporter","webdriver-exporter","webdriver-protocol"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattbostock.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}},"created_at":"2016-07-10T10:02:02.000Z","updated_at":"2024-01-10T11:27:22.000Z","dependencies_parsed_at":"2022-08-28T10:01:57.183Z","dependency_job_id":null,"html_url":"https://github.com/mattbostock/webdriver_exporter","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fwebdriver_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fwebdriver_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fwebdriver_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fwebdriver_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattbostock","download_url":"https://codeload.github.com/mattbostock/webdriver_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913046,"owners_count":21983246,"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":["chromedriver","metrics","navigation-timing","probe","prometheus","prometheus-exporter","webdriver-exporter","webdriver-protocol"],"created_at":"2024-11-18T14:34:44.514Z","updated_at":"2025-05-13T09:31:15.562Z","avatar_url":"https://github.com/mattbostock.png","language":"Go","readme":"# WebDriver Exporter\n\nProbes a web page using the [WebDriver protocol][] and exposes metrics for\n[Prometheus][] such as [Navigation Timings][].\n\n[Prometheus]: https://prometheus.io/\n[Navigation Timings]: https://www.w3.org/TR/navigation-timing/\n[WebDriver protocol]: https://www.w3.org/TR/webdriver/\n\n## Alpha quality\n\nThis is alpha-quality code, without tests. Run it in Production at your own\nrisk.\n\n## Example output\n\n```\nnavigation_timing_secure_connection_start_seconds 1468151331.286000\nnavigation_timing_dom_complete_seconds 1468151332.641000\nnavigation_timing_dom_content_loaded_event_end_seconds 1468151332.167000\nnavigation_timing_load_event_end_seconds 1468151332.643000\nnavigation_timing_response_end_seconds 1468151331.645000\nnavigation_timing_redirect_start_seconds 0.000000\nnavigation_timing_request_start_seconds 1468151331.465000\nnavigation_timing_response_start_seconds 1468151331.643000\nnavigation_timing_dom_content_loaded_event_start_seconds 1468151332.158000\nnavigation_timing_dom_interactive_seconds 1468151332.158000\nnavigation_timing_dom_loading_seconds 1468151331.647000\nnavigation_timing_fetch_start_seconds 1468151331.221000\nnavigation_timing_connect_end_seconds 1468151331.465000\nnavigation_timing_connect_start_seconds 1468151331.277000\nnavigation_timing_domain_lookup_end_seconds 1468151331.277000\nnavigation_timing_unload_event_start_seconds 0.000000\nnavigation_timing_unload_event_end_seconds 0.000000\nnavigation_timing_domain_lookup_start_seconds 1468151331.271000\nnavigation_timing_load_event_start_seconds 1468151332.641000\nnavigation_timing_navigation_start_seconds 1468151330.960000\nnavigation_timing_redirect_end_seconds 0.000000\nbrowser_log_warning_count 0\nbrowser_log_severe_count 1\nprobe_duration_seconds 2.596026\nprobe_success 1\n```\n\n## Building and running\n\n### Prerequisites\n\nYou'll need [chromedriver][]:\n\n    # On Mac OS X using Homebrew\n    brew install chromedriver\n\nTo run WebDriver Exporter on a server with a headless Chrome browser,\nyou'll need something like [xvfb][].\n\n[chromedriver]: https://sites.google.com/a/chromium.org/chromedriver/\n[xvfb]: https://www.x.org/archive/X11R7.6/doc/man/man1/Xvfb.1.xhtml\n\n### Building locally\n\n    go get ./...\n    go build\n    ./webdriver_exporter \u003cflags\u003e\n\nVisiting [http://localhost:9156/probe?target=https://prometheus.io/](http://localhost:9156/probe?target=https://prometheus.io/)\nwill return metrics for prometheus.io.\n\n## Prometheus Configuration\n\nThe WebDriver Exporter needs to be passed the target as a parameter,\nthis can be done with relabelling.\n\nExample configuration:\n\n```yaml\nscrape_configs:\n  - job_name: 'webdriver'\n    metrics_path: /probe\n    static_configs:\n      - targets:\n        - https://prometheus.io/   # Target to probe\n    relabel_configs:\n      - source_labels: [__address__]\n        regex: (.*)(:80)?\n        target_label: __param_target\n        replacement: ${1}\n      - source_labels: [__param_target]\n        regex: (.*)\n        target_label: instance\n        replacement: ${1}\n      - source_labels: []\n        regex: .*\n        target_label: __address__\n        replacement: 127.0.0.1:9156  # WebDriver Exporter\n```\n\n\nExample recording rules:\n\n```\n# Official time breakdown: https://www.w3.org/TR/navigation-timing/\ninstance:navigation_timing_back_end_seconds = navigation_timing_response_start_seconds{job=\"webdriver\"} - navigation_timing_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_dom_content_loaded_seconds = navigation_timing_dom_content_loaded_event_start_seconds{job=\"webdriver\"} - navigation_timing_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_dom_interactive_seconds = navigation_timing_dom_interactive_seconds{job=\"webdriver\"} - navigation_timing_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_domain_lookup_seconds = navigation_timing_domain_lookup_end_seconds{job=\"webdriver\"} - navigation_timing_domain_lookup_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_front_end_seconds = navigation_timing_load_event_start_seconds{job=\"webdriver\"} - navigation_timing_response_end_seconds{job=\"webdriver\"}\ninstance:navigation_timing_page_download_seconds = navigation_timing_response_end_seconds{job=\"webdriver\"} - navigation_timing_response_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_page_load_seconds = navigation_timing_load_event_start_seconds{job=\"webdriver\"} - navigation_timing_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_redirection_seconds = navigation_timing_fetch_start_seconds{job=\"webdriver\"} - navigation_timing_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_server_connection_seconds = navigation_timing_connect_end_seconds{job=\"webdriver\"} - navigation_timing_connect_start_seconds{job=\"webdriver\"}\n# Other\ninstance:navigation_timing_latency_seconds = navigation_timing_response_start_seconds{job=\"webdriver\"} - navigation_timing_fetch_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_transfer_seconds = navigation_timing_response_end_seconds{job=\"webdriver\"} - navigation_timing_response_start_seconds{job=\"webdriver\"}\ninstance:navigation_timing_dom_processing_interactive_seconds = navigation_timing_dom_interactive_seconds{job=\"webdriver\"} - navigation_timing_dom_loading_seconds{job=\"webdriver\"}\ninstance:navigation_timing_dom_processing_complete_seconds = navigation_timing_dom_complete_seconds{job=\"webdriver\"} - navigation_timing_dom_interactive_seconds{job=\"webdriver\"}\ninstance:navigation_timing_onload_seconds = navigation_timing_load_event_end_seconds{job=\"webdriver\"} - navigation_timing_load_event_start_seconds{job=\"webdriver\"}\n```\n\n## Limitations\n\n### Chromedriver only (currently)\n\nOnly Chromedriver is supported currently. Adding support for other webdrivers\n(e.g. Selenium, phantomjs) should be relatively trivial. Pull requests are\nencouraged.\n\nAt the time of writing, PhantomJS did not support probing of sites with strict\n[Content Security Policies][]; see [ariya/phantomjs#13114][].\n\n[Content Security Policies]: https://www.w3.org/TR/CSP1/\n[ariya/phantomjs#13114]: https://github.com/ariya/phantomjs/issues/13114\n\n### Requires exact URL as target\n\nTo ensure that the timings returned are for the target requested, the page URL\nis strictly matched against the requested target.\n\nFor example, if you try to probe `https://example.com/`, the probe will fail if\nthe page redirects to `https://example.com/foo`. Similarly, make sure that you\nuse `https` as the URL scheme if your target enforces HTTPS.\n\nThis requirement could be loosened if there's enough demand for it.\n\n### Probe timeout hardcoded at 5 seconds\n\nChrome is set to timeout after 5 seconds if it hasn't yet loaded the page. Pull\nrequests to make this value configurable are welcomed.\n\n### Probes are slow to initialise\n\nWe start a new [Chromedriver][] session for each probe to ensure that the\ncache, cookies and local storage are clean. If we could retain the session and\nclear the cache, the time to complete a probe would be significantly reduced.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattbostock%2Fwebdriver_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattbostock%2Fwebdriver_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattbostock%2Fwebdriver_exporter/lists"}