[infer][logging] support passing arbitrary scuba columns to infer

Summary:
`infer_events` table is a key-value storage that also have list of fields common for entire infer run.
Infer should be agnostic of many of such fields (e.g. diff number).
Hence we will pass such extra fields through CI.

Note that only "normals" (strings in scuba terminology) are currently supported.
Reason being: most of things that are technically ints (like IDs) should actually be normals (because average etc does not make sense for them; and group by, in contrast, does).

Reviewed By: jvillard

Differential Revision: D15376636

fbshipit-source-id: 729eaabfc
master
Mitya Lyubarskiy 6 years ago committed by Facebook Github Bot
parent 6f06e9b20f
commit 04c3ccaac5

@ -1579,6 +1579,10 @@ INTERNAL OPTIONS
Activates: (direct) logging to scuba (Conversely: Activates: (direct) logging to scuba (Conversely:
--no-scuba-logging) --no-scuba-logging)
--scuba-normal +key=value
add an extra string (normal) field to be set for each sample of
scuba, format <name>=<value>
--seconds-per-iteration float --seconds-per-iteration float
Set the number of seconds per iteration (see --iterations) Set the number of seconds per iteration (see --iterations)

@ -2017,6 +2017,11 @@ and select =
and scuba_logging = CLOpt.mk_bool ~long:"scuba-logging" "(direct) logging to scuba " and scuba_logging = CLOpt.mk_bool ~long:"scuba-logging" "(direct) logging to scuba "
and scuba_normals =
CLOpt.mk_string_map ~long:"scuba-normal"
"add an extra string (normal) field to be set for each sample of scuba, format <name>=<value>"
and siof_safe_methods = and siof_safe_methods =
CLOpt.mk_string_list ~long:"siof-safe-methods" CLOpt.mk_string_list ~long:"siof-safe-methods"
~in_help:InferCommand.[(Analyze, manual_siof)] ~in_help:InferCommand.[(Analyze, manual_siof)]
@ -2997,6 +3002,8 @@ and select = !select
and scuba_logging = !scuba_logging and scuba_logging = !scuba_logging
and scuba_normals = !scuba_normals
and show_buckets = !print_buckets and show_buckets = !print_buckets
and siof = !siof and siof = !siof

@ -600,6 +600,8 @@ val results_dir : string
val scuba_logging : bool val scuba_logging : bool
val scuba_normals : string String.Map.t
val seconds_per_iteration : float option val seconds_per_iteration : float option
val select : int option val select : int option

@ -17,6 +17,11 @@ let maybe_add_normal ~name ~value sample =
match value with None -> sample | Some value -> Scuba.add_normal ~name ~value sample match value with None -> sample | Some value -> Scuba.add_normal ~name ~value sample
let set_command_line_normales sample =
let add_normal ~key ~data = Scuba.add_normal ~name:key ~value:data in
Map.fold Config.scuba_normals ~init:sample ~f:add_normal
let set_common_fields sample = let set_common_fields sample =
let open Scuba in let open Scuba in
sample sample
@ -29,7 +34,7 @@ let set_common_fields sample =
let create_sample ~event_name ~value = let create_sample ~event_name ~value =
Scuba.new_sample ~time:None |> set_common_fields Scuba.new_sample ~time:None |> set_common_fields |> set_command_line_normales
|> Scuba.add_normal ~name:"event" ~value:event_name |> Scuba.add_normal ~name:"event" ~value:event_name
|> Scuba.add_int ~name:"value" ~value |> Scuba.add_int ~name:"value" ~value

Loading…
Cancel
Save