Add model version in metadata

This commit is contained in:
Rodrigo Arias 2022-07-27 18:22:13 +02:00
parent 610516840e
commit 861a4b7f73
3 changed files with 22 additions and 1 deletions

5
ovni.c
View File

@ -176,7 +176,10 @@ proc_set_version(void)
die("json_value_get_object failed\n");
if(json_object_set_number(meta, "version", OVNI_METADATA_VERSION) != 0)
die("json_object_set_number for app_id failed\n");
die("json_object_set_number for version failed\n");
if(json_object_set_string(meta, "model_version", OVNI_MODEL_VERSION) != 0)
die("json_object_set_string for model_version failed\n");
}

1
ovni.h
View File

@ -50,6 +50,7 @@ typedef struct json_value_t JSON_Value;
#define OVNI_STREAM_MAGIC "ovni"
#define OVNI_STREAM_VERSION 1
#define OVNI_MODEL_VERSION "O1 V1 T1 M1 D1 K1"
/* ----------------------- common ------------------------ */

17
trace.c
View File

@ -146,6 +146,23 @@ check_metadata_version(struct ovni_eproc *proc)
proc->pid, version,
OVNI_METADATA_VERSION);
}
JSON_Value *mversion_val = json_object_get_value(meta, "model_version");
if(mversion_val == NULL)
{
die("process %d is missing attribute \"model_version\" in metadata\n",
proc->pid);
}
const char *mversion = json_string(mversion_val);
if(strcmp(mversion, OVNI_MODEL_VERSION) != 0)
{
die("pid %d: metadata model version mismatch '%s' (expected '%s')\n",
proc->pid, mversion,
OVNI_MODEL_VERSION);
}
}
static int