From 3ab9a41177c4ab5bee3514ea9ef28a6d94fea57b Mon Sep 17 00:00:00 2001 From: stephanie0x00 <9821756+stephanie0x00@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:06:23 +0200 Subject: [PATCH] Add docs for xtdb analyze bits. (#3688) --- .../developer_documentation/octopoes.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/source/developer_documentation/octopoes.md b/docs/source/developer_documentation/octopoes.md index 59e87f8e038..d2400d51992 100644 --- a/docs/source/developer_documentation/octopoes.md +++ b/docs/source/developer_documentation/octopoes.md @@ -381,6 +381,38 @@ $ ./xtdb-cli.py -n MyOrganisationName attribute-stats |jq .  } ``` +### XTDB analyze bits tool + +This guide assumes the following: + +- A virtual environment for the octopoes folder is created and the development requirements are installed. + +This tooling can be used when you are developing bits (business rules). It outputs the transaction times in the database, the source and bit information, including parameters and how long the running time was. + +Enable the `GATHER_BIT_METRICS` setting in the following file. The flag is at the bottom of the file. Change `GATHER_BIT_METRICS=False` to `GATHER_BIT_METRICS=True`. + +``` +octopoes/octopoes/config/settings.py +``` + +Run a `make reset` in your KAT instance to enable the setting: + +``` +make reset +``` + +Create some data by adding a hostname, enable some boefjes, etc. This will allow the bit metrics to be gathered. You can query the bit metrics using the following commands. The `node` is the name of your organisation. In this example the organisation name is 'aa'. + +``` +python3 octopoes/tools/analyze-bit-metric.py --node "aa" raw |jq +``` + +``` +python3 octopoes/tools/xtdb-cli.py -n "aa" history --with-docs "BIT_METRIC" |jq +``` + +If you want to query the XTDB database directly, you can use the XTDB-tool. This is explained on the following page: https://docs.openkat.nl/developer_documentation/octopoes.html#xtdb-cli-tool. + ## OOI OOI objects are instances of relatively simple classes, which inherit from `OOI`.