Skip to content

Commit

Permalink
Log invocation UUID for each Buck event
Browse files Browse the repository at this point in the history
Reviewed By: kinto0

Differential Revision: D47579485

fbshipit-source-id: 0177d31bedd9b0c51f29948f386fa10bb63893cc
  • Loading branch information
grievejia authored and facebook-github-bot committed Jul 20, 2023
1 parent f3e1cd3 commit 8ba1c37
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions source/server/buildSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ module BuckBuildSystem = struct
>>= fun Buck.Interface.
{
WithMetadata.data = { BuildResult.targets = normalized_targets; build_map };
metadata = _;
metadata;
} ->
Lwt.return (create ~targets ~builder ~normalized_targets ~build_map ())
Lwt.return
(create ~targets ~builder ~normalized_targets ~build_map () |> WithMetadata.create ?metadata)
let create_from_saved_state ~builder ~targets ~normalized_targets ~build_map () =
Expand All @@ -97,7 +98,8 @@ module BuckBuildSystem = struct
process another incremental update request to bring everything up-to-date again. If that
incremental update is correctly handled, the dead links will be properly cleaned up. *)
ClassicBuckBuilder.restore builder ~build_map
>>= fun () -> Lwt.return (create ~targets ~builder ~normalized_targets ~build_map ())
>>= fun () ->
Lwt.return (create ~targets ~builder ~normalized_targets ~build_map () |> WithMetadata.create)
end
(* This module defines how `State.t` will be preserved in the saved state. *)
Expand Down Expand Up @@ -132,12 +134,17 @@ module BuckBuildSystem = struct
(fun () ->
let start_timestamp = Core_unix.time () |> Int.of_float in
f ()
>>= fun result ->
>>= fun { WithMetadata.data = result; metadata } ->
let millisecond = Timer.stop_in_ms timer in
let normals = ("version", Version.version ()) :: normals () in
let integers =
("start time", start_timestamp) :: ("runtime", millisecond) :: integers result
in
let normals =
match metadata with
| None -> normals
| Some build_id -> ("buck uuid", build_id) :: normals
in
Statistics.buck_event ~normals ~integers ();
Lwt.return result)
(fun exn ->
Expand All @@ -153,7 +160,7 @@ module BuckBuildSystem = struct
module IncrementalBuilder = struct
type t = {
name: string;
run: unit -> ArtifactPath.Event.t list Lwt.t;
run: unit -> (ArtifactPath.Event.t list, string) WithMetadata.t Lwt.t;
}
end
Expand Down Expand Up @@ -187,10 +194,10 @@ module BuckBuildSystem = struct
build_map;
changed_artifacts;
};
metadata = _;
metadata;
} ->
State.update ~normalized_targets ~build_map state;
Lwt.return changed_artifacts
Lwt.return (WithMetadata.create ?metadata changed_artifacts)
in
if should_renormalize source_path_events then
{
Expand All @@ -212,7 +219,10 @@ module BuckBuildSystem = struct
List.partition_map source_path_events ~f:categorize
in
if List.is_empty removed_paths && not (should_reconstruct_build_map changed_paths) then
{ IncrementalBuilder.name = "skip_rebuild"; run = (fun () -> Lwt.return []) }
{
IncrementalBuilder.name = "skip_rebuild";
run = (fun () -> Lwt.return (WithMetadata.create []));
}
else
{
IncrementalBuilder.name = "skip_renormalize_optimized";
Expand Down

0 comments on commit 8ba1c37

Please sign in to comment.