User telemetry

Performance data of certain user actions

Introduced in v3.4.0

The app collects performance data on certain user actions which is then aggregated over each calendar month and replicated to the server. This can be used to evaluate the performance of the code and configuration and to evaluate where improvements can be made.

The aggregate doc for the previous month is created when the first telemetry item is recorded each month. This is stored in the medic-user-<username>-meta database on the device and replicated to the server when an internet connection is available. This user specific server db is then replicated into the medic-users-meta database which holds all aggregate telemetry docs for all users.

The aggregate docs’ IDs follow the pattern telemetry-<year>-<month>-<username>-<uuid>.

Performance data

Each aggregate data point has the following fields.

sumA sum of all the recorded times in milliseconds.
minThe smallest time recorded in milliseconds.
maxThe largest time recorded in milliseconds.
countThe number of times recorded.
sumsqrThe sum of squares of the times recorded in milliseconds.

The telemetry data gathered changes with different versions of the framework. Currently, the data points collected are:

boot_timeThe overall boot time including loading the code, purging, and accessing the database.
boot_time:1:to_first_code_executionThe time between the page loading and the JavaScript starting to run.
boot_time:2:to_bootstrapThe time between JavaScript starting and the bootstrapping (purging, initial replication, etc) to complete.
boot_time:3:to_angular_bootstrapThe time between bootstrapping completing and the webapp being ready to use.
boot_time:4:to_db_warmedThe time between the webapp being ready to use and the database being ready to use.
enketo:reports:<form>:<action>:<component>The time taken to fill in Enketo forms. The action can either be “add” or “edit”. The component is one of: “render” covers getting the form and rendering it on screen; “user_edit_time” is the time the user took to fill in and submit the form; or “save” is about converting the form into a report and saving it.
enketo:contacts:<form>:add:<component>As above but for Contact creation forms.
enketo:tasks:<form>:<action>:<component>As above but for forms on the Tasks tab.
search:contactsThe time taken to list all contacts.
search:contacts:<filter[:filter]>The time taken to search all contacts using the given filters.
search:reportsThe time taken to list all reports.
search:reports:<filter[:filter]>The time taken to search all reports using the given filters.
client-date-offsetThe difference between the client datetime and the server datetime. Only recorded if the difference is large enough that it may cause issues.
analytics:targets:loadThe time taken to load the targets page. Added in 3.9
tasks:loadThe time taken to load the tasks page. Added in 3.9
tasks:refreshThe time taken to refresh tasks on the tasks page. Added in 3.9
rules-engine:initializeThe time taken to initialize the rules-engine . Added in 3.9
rules-engine:update-emissionsThe time taken to update emissions in the rules-engine, when receiving a change. Added in 3.9
rules-engine:tasks:all-contactsThe time taken to fetch tasks for all contacts in rules-engine. Added in 3.9
rules-engine:tasks:some-contactsThe time taken to fetch tasks for some specific contacts in rules-engine. Added in 3.9
rules-engine:targetsTime taken for the rules-engine to fetch targets. Added in 3.9
rules-engine:targets:dirty-contactsNumber of “dirty” contacts[1] when fetching targets in the rules-engine. Added in 3.9
rules-engine:tasks:dirty-contactsNumber of “dirty” contacts[1] when fetching tasks in the rules-engine. Added in 3.9
rules-engine:ensureTaskFreshness:cancelThe time taken to cancel the automated task freshness thread in the rules-engine. This event is only recorded when the thread is cancelled before executing the refresh. Added in 3.9
rules-engine:ensureTargetFreshness:cancelThe time taken to cancel the automated target freshness thread in the rules-engine. This event is only recorded when the thread is cancelled before executing the refresh. Added in 3.9

[1] “Dirty” indicates that the contact’s task documents are not up to date. They will be refreshed before being used.


When the aggregate doc is created the Telemetry service also includes a snapshot of some metadata.

yearThe year the data was collected.
monthThe month the data was collected.
userThe username of the logged in user.
deviceIdA unique key for this device.
versions.appThe version of the webapp.
versions.forms.<form>The version of each form.
userAgentThe userAgent string from the user’s browser.
hardwareConcurrencyThe number of cores reported from the browser.
screen.widthThe width of the screen in pixels.
screen.heightThe height of the screen in pixels. version of the Android app. version of Android OS. API of the Android OS. version of Android OS (detailed).
deviceInfo.hardware.deviceThe Android device name.
deviceInfo.hardware.modelThe Android model name.
deviceInfo.hardware.manufacturerThe Android device manufacturer.
deviceInfo.hardware.hardwareThe Android device hardware.
deviceInfo.hardware.cpuInfoThe Android device CPU information. available storage on the device. total storage on the device.
deviceInfo.ram.freeThe available RAM on the device.
deviceInfo.ram.totalThe total RAM on the device.
deviceInfo.ram.thresholdThe level of RAM at which certain services will be killed by Android. reported download speed of the network. reported upload speed of the network.
dbInfo.doc_countThe number of docs in the local database.
dbInfo.update_seqThe update sequence of the local database.
dbInfo.idb_attachment_formatThe format of database attachments.
dbInfo.db_nameThe name of the local database.
dbInfo.auto_compactionWhether or not auto compaction is set.
dbInfo.adapterThe database adapter being used.

Export data to JSON

To export all telemetry in JSON for further analysis or visualization, first meet these prerequisites:

  1. Ensure that both node and npm are installed and that the needed node libraries are installed: npm install inquirer pouchdb-core fs path minimist pouchdb-adapter-http
  2. Get a current copy of the export script: curl -s -o get_users_meta_docs.js

To export the data open a terminal in the folder where you want to save the export, and run this command:

node get_users_meta_docs.js --mode batch --type telemetry https://USERNAME:PASSWORD@COUCHDB_SERVER:COUCHDB_PORT/medic-users-meta > telemetry.json

For example, if your username is admin, your password is pass, your CouchDB server is localhost and your CouchDB port is 5984, you would run:

node get_users_meta_docs.js --mode batch --type telemetry https://admin:pass@localhost:5984/medic-users-meta > telemetry.json

This will save a file named telemetry.json containing all the telemetry data in the current directory.

CHT Core Framework > Overview > Data Flows

An overview of data flows in the CHT for analytics, impact monitoring, and data science