MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / stats

Method stats

rust/src/lib.rs:994–1031  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

992 }
993
994 fn stats(&self) -> Result<(), Error> {
995 if !self.is_avoid_stats() && !self.is_offline() {
996 let props = Props::sanitized(
997 self.get_browser_name(),
998 self.get_browser_version(),
999 self.get_os(),
1000 self.get_normalized_arch().unwrap_or(ARCH_OTHER),
1001 self.get_language_binding(),
1002 self.get_selenium_version(),
1003 );
1004 let http_client = match self.get_http_client() {
1005 Ok(http_client) => http_client.to_owned(),
1006 Err(err) => {
1007 self.get_logger()
1008 .debug(format!("Skipping stats: {}", format_error(&err)));
1009 return Ok(());
1010 }
1011 };
1012 let sender = self.get_sender().to_owned();
1013 let cache_path = self.get_cache_path()?;
1014 let mut metadata = get_metadata(self.get_logger(), &cache_path);
1015 if !is_stats_in_metadata(&metadata.stats, &props) {
1016 self.get_logger()
1017 .debug(format!("Sending stats to Plausible: {:?}", props,));
1018 let stats_ttl = self.get_ttl();
1019 if stats_ttl > 0 {
1020 metadata
1021 .stats
1022 .push(create_stats_metadata(&props, stats_ttl));
1023 write_metadata(&metadata, self.get_logger(), cache_path);
1024 }
1025 thread::spawn(move || {
1026 send_stats_to_plausible(http_client, props, sender);
1027 });
1028 }
1029 }
1030 Ok(())
1031 }
1032
1033 fn check_error_with_driver_in_path(
1034 &mut self,

Callers 1

mainFunction · 0.80

Implementers 8

edge.rsrust/src/edge.rs
iexplorer.rsrust/src/iexplorer.rs
safaritp.rsrust/src/safaritp.rs
electron.rsrust/src/electron.rs
chrome.rsrust/src/chrome.rs
firefox.rsrust/src/firefox.rs
grid.rsrust/src/grid.rs
safari.rsrust/src/safari.rs

Calls 15

get_metadataFunction · 0.85
is_stats_in_metadataFunction · 0.85
create_stats_metadataFunction · 0.85
write_metadataFunction · 0.85
send_stats_to_plausibleFunction · 0.85
is_avoid_statsMethod · 0.80
is_offlineMethod · 0.80
get_browser_versionMethod · 0.80
get_osMethod · 0.80
get_normalized_archMethod · 0.80
get_language_bindingMethod · 0.80
get_selenium_versionMethod · 0.80

Tested by

no test coverage detected