From 9d9df458b60f08f3d15f5b2f1719eed1b291a36b Mon Sep 17 00:00:00 2001 From: Artem Pianykh Date: Mon, 24 Jun 2019 01:57:42 -0700 Subject: [PATCH] [infra] Add Config.execution_id and log it to scuba as a normal Reviewed By: mityal Differential Revision: D15920237 fbshipit-source-id: f0117b5f8 --- infer/src/base/Config.ml | 3 +++ infer/src/base/Config.mli | 2 ++ infer/src/infer.ml | 3 ++- infer/src/scuba/ScubaLogging.ml | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index a0df8274d..2a6d004b2 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -3229,3 +3229,6 @@ let is_in_custom_symbols list_name symbol = Str.string_match regexp symbol 0 | None -> false + + +let execution_id = Random.self_init () ; Random.int64 Int64.max_value diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 09e920665..dc3c4a7f0 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -739,3 +739,5 @@ val java_package_is_external : string -> bool val quandaryBO_filtered_issues : IssueType.t list (** List of issues that are enabled by QuandaryBO but should not be in the final report.json *) + +val execution_id : Int64.t diff --git a/infer/src/infer.ml b/infer/src/infer.ml index 53cae0c46..514a27fca 100644 --- a/infer/src/infer.ml +++ b/infer/src/infer.ml @@ -122,8 +122,9 @@ let () = setup () ; log_environment_info () ; prepare_events_logging () ; - if Config.debug_mode && CLOpt.is_originator then + if Config.debug_mode && CLOpt.is_originator then ( L.progress "Logs in %s@." (Config.results_dir ^/ Config.log_file) ; + L.progress "Execution ID %Ld@." Config.execution_id ) ; ( if Config.test_determinator then ( TestDeterminator.test_to_run_java Config.modified_lines Config.profiler_samples Config.method_decls_info ; diff --git a/infer/src/scuba/ScubaLogging.ml b/infer/src/scuba/ScubaLogging.ml index da8650fec..0b00a564b 100644 --- a/infer/src/scuba/ScubaLogging.ml +++ b/infer/src/scuba/ScubaLogging.ml @@ -31,6 +31,7 @@ let set_common_fields sample = |> maybe_add_normal ~name:"job_id" ~value:Config.job_id |> add_normal ~name:"command" ~value:(InferCommand.to_string Config.command) |> add_normal ~name:"infer_commit" ~value:Version.commit + |> add_normal ~name:"execution_id" ~value:(Int64.to_string Config.execution_id) let sample_from_event ({label; created_at_ts; data} : LogEntry.t) =