Skip to content

Commit aa9a4fc

Browse files
alanzmeta-codesync[bot]
authored andcommitted
Add timing telemetry to elp lint too
Summary: We now have the ability to provide telemetry for command line usage of ELP. The initial version did not include for the `elp lint` command. This diff adds that. Reviewed By: jcpetruzza Differential Revision: D85756130 fbshipit-source-id: c52da5864e12290857fc12e05edc097309b94de5
1 parent 87391f5 commit aa9a4fc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

crates/elp/src/bin/lint_cli.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::path::Path;
1616
use std::path::PathBuf;
1717
use std::str;
1818
use std::sync::Arc;
19+
use std::time::SystemTime;
1920

2021
use anyhow::Result;
2122
use anyhow::bail;
@@ -51,6 +52,7 @@ use elp_ide::elp_ide_db::elp_base_db::ProjectId;
5152
use elp_ide::elp_ide_db::elp_base_db::Vfs;
5253
use elp_ide::elp_ide_db::elp_base_db::VfsPath;
5354
use elp_ide::elp_ide_db::source_change::SourceChange;
55+
use elp_log::telemetry;
5456
use elp_project_model::AppName;
5557
use elp_project_model::AppType;
5658
use elp_project_model::DiscoverConfig;
@@ -75,6 +77,7 @@ pub fn run_lint_command(
7577
cli: &mut dyn Cli,
7678
query_config: &BuckQueryConfig,
7779
) -> Result<()> {
80+
let start_time = SystemTime::now();
7881
let memory_start = MemoryUsage::now();
7982

8083
if let Some(to) = &args.to {
@@ -86,9 +89,12 @@ pub fn run_lint_command(
8689
// We load the project after loading config, in case it bails with
8790
// errors. No point wasting time if the config is wrong.
8891
let mut loaded = load_project(args, cli, query_config)?;
92+
telemetry::report_elapsed_time("lint operational", start_time);
8993

9094
let result = do_codemod(cli, &mut loaded, &diagnostics_config, args);
9195

96+
telemetry::report_elapsed_time("lint done", start_time);
97+
9298
let memory_end = MemoryUsage::now();
9399
let memory_used = memory_end - memory_start;
94100

0 commit comments

Comments
 (0)