danielplohmann / mcrit

The MinHash-based Code Relationship & Investigation Toolkit (MCRIT) is a framework created to simplify the application of the MinHash algorithm in the context of code similarity.
GNU General Public License v3.0
86 stars 12 forks source link

QoL: Add last index timestamp to server statistics #58

Closed yankovs closed 10 months ago

yankovs commented 10 months ago

It would be nice if part of the statistics was a timestamp of the last time a file was indexed (successfully) in the system.

This is useful when the match reports of MCRIT are stored elsewhere other than MCRIT itself. So in my case, a short summary of the report is stored on a different system. In such cases, since the data already exists in this other platform, this sort of information can help with the question of whether to re-query a file for matches - if the DB didn't change at all, there's no need to even fetch the cached result.

danielplohmann commented 10 months ago

v1.2.20 will give you a timestamp in the status:

curl http://127.0.0.1:8000/status                     
{
    "status": "successful",
    "data": {
        "status": {
            "db_state": 286,
            "db_timestamp": "2023-12-28T07:13:42",
            "storage_type": "mongodb",
            "num_bands": 20,
            "num_samples": 194,
            "num_families": 24,
            "num_functions": 195551,
            "num_pichashes": 0
        }
    }
}