Skip to content

Commit 4c29106

Browse files
author
Colin
authored
CP-50078: Instrument xapi-storage-script with tracing (#5808)
* CP-50078: Check if SMAPI observation is enabled Modifies xapi-storage-script to determine if SMAPI observation is enabled by checking whether a configuration file exists for it within the file system. Internally, xapi queries the database to determine if a specific component should be observed but as xapi-storage-script is an external daemon, we rely on the file system. To avoid modifying much of the monadic structure, a configuration record is used to record whether observation is enabled. It is hoped this less invasive change will make it simpler to rework xapi-storage-script in the future. The path of the observer configuration directory is relocated to xapi-consts. Signed-off-by: Colin James <colin.barr@cloud.com> * CP-50078: Augment RPC transport to use observer.py Modifies the RPC transport (fork_exec_rpc) to take a "dbg" parameter that can encode a traceparent. If observation is enabled and a traceparent can be parsed from the dbg parameter, the storage plugin's script will be invoked via observer.py (for automatic instrumentation). This change does not yet seed each of the transports with the dbg parameter; the volume, datapath, etc. interfaces - defined in xapi-storage - use the convention of having dbg as the first parameter for each RPC function. The act of supplying this dbg parameter to the transport could be done implicitly, but this would be a contract that is hard to enforce, despite vastly reducing the pervasiveness of changes to come; each handler will need to partially apply its received dbg parameter to the RPC transport (e.g. volume_rpc ~dbg) at each usage site. The python3 path is relocated from xapi_globs.ml to become a constant within xapi-consts. Signed-off-by: Colin James <colin.barr@cloud.com> * CP-50078: Augment RPC transports for tracing This change is rather pervasive but it seeds the volume and datapath RPC transport with the received "dbg" parameter at each usage site. The change could be done implicitly if we could be promised that "dbg" always occurs as a first parameter - we would then just modify the transport to be aware of this contract and not have to partially apply it at each usage site. Signed-off-by: Colin James <colin.barr@cloud.com> --------- Signed-off-by: Colin James <colin.barr@cloud.com>
1 parent f0bbfa5 commit 4c29106

File tree

5 files changed

+117
-39
lines changed

5 files changed

+117
-39
lines changed

ocaml/xapi-consts/constants.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,10 @@ let good_ciphersuites =
399399

400400
let verify_certificates_path = "/var/xapi/verify-certificates"
401401

402+
let python3_path = "/usr/bin/python3"
403+
404+
let observer_config_dir = "/etc/xensource/observer"
405+
402406
let observer_component_xapi = "xapi"
403407

404408
let observer_component_xenopsd = "xenopsd"

ocaml/xapi-storage-script/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
sexplib0
2222
uri
2323
xapi-backtrace
24+
xapi-consts
2425
xapi-consts.xapi_version
2526
xapi-idl
2627
xapi-idl.rrd

0 commit comments

Comments
 (0)