...
Code Block | ||
---|---|---|
| ||
{ "instrument_details": { "type": "COUNTER", "key": "count" }, "name": "attendance_by_school_grade_for_a_day", "is_active": true, "event_schema": { "$schema": "https://json-schema.org/draft/2019-09/schema", "$id": "http://example.com/example.json", "type": "object", "default": {}, "title": "attendance_by_school_grade_for_a_day", "required": ["date", "grade", "school_id", "count"], "properties": { "date": { "type": "string", "default": "", "title": "The date Schema", "examples": ["2019-01-01"] }, "grade": { "type": "integer", "default": 0, "title": "The grade Schema", "examples": [1] }, "school_id": { "type": "integer", "default": 0, "title": "The school_id Schema", "examples": [901] } }, "examples": [ { "date": "2019-01-01", "grade": 1, "school_id": 901, "count": 23 } ] } } |
Instruments: Currently only a Counter
COUNTER
instrument is supported.
2. Publish an event that satisfies the grammar
...
An update to the schema is not supported yet. To update please create a new schema and tie it up to the Dataset Model. Please note that this is a slower process and would lead to a downtime of the cQube instance until the migration is completed. Currently, it can only happen through private APIs exposed to a developer.
A relationnal relational database is used to store the data in a flat manner. All fields are flattened and used as column names when creating a dimension table.
The schema provided to insert data is used to validate the data before inserting it into the database. This is to ensure that the data is in the correct format and that the data types are correct. AJV is used to validate the data.
4. Datasets
Dataset insert
requires an input that looks like the following.
Code Block |
---|
{
"name": "attendance_school",
"data": {
"date": "2019-01-01", // This is a dimension
"school_id": 901, // This is a dimension
"grade": 1,
},
"counter": 190
}
|
Note: id
, created_at
, updated_at
, count
, sum
, and percentage
are all automatically added to the dataset. Mapping a dataset to a dimension happens the DatasetGrammar
which is defined ahead of time.
Dataset Grammar
Defines
How the dataset is defined
How it is liked to dimensions
Which fields needs to cached/indexed to be queried faster
Code Block |
---|
{
"indexes": [["date"], ["school_id"]] // For faster queries
"title": "attendance_school_grade", //name of the dataset
"schema": {
// Will be a JSONSchema. Right now just sharing an example here
"date": "2019-01-01", // Dimension
"grade": 1, // Addtional filterable data => indexed
"school_id": 901, // Dimension
},
"dimensionMappings": [
{
"key": "school_id",
"dimension": {
"name": "Dimension1",
"mapped_to": "Dimension1.school_id" //Optional in case of time.
}
},
{
"key": "date",
"dimension": {
"name": "Last 7 Days"
}
}
]
} |
5. Instruments
cQube implements Opentelemetry Instruments which can be of the following types. A single instrument allows for a lot of functionalities downstream so please ensure you have all the use cases covered before adding a new instrument
...