Cht-core: Consider refactoring how sentinel views are compiled

Created on 21 Jul 2016  路  9Comments  路  Source: medic/cht-core

In sentinel every time we change a view we try to remember to run the ddoc compile script which uses kanso to build the ddoc. The result is the committed to the repo, and when sentinel starts up it uploads the ddoc to the db in a custom way.

Since this was developed we made generic code to compile ddocs, attach them to medic, and install them when api starts up (see medic-webapp/ddocs/medic-client). It'd be good to be able to reuse the same mechanism so we don't have to remember to compile the ddoc, and we only have one script for managing ddocs.

The easiest way is to move the sentinel views into medic-webapp/ddocs but it's a shame to separate the views from the code that executes them. It might be better to leave the views in sentinel and have webapp compile views in medic-webapp/sentinel/...

Sentinel Performance Technical issue

Most helpful comment

By this I mean:

  • trace every view and make sure it's used
  • see how it's used and remove any unnecessary data like excessive emitted data or docs
  • see if views can be consolidated, two views basically providing the same data should be merged into one

All 9 comments

It's probably worth confirming that sentinel even needs a ddoc... I'd vote for having some settings for each transition or even package wide that allows one to easily tweak where sentinel gets its data from.

Right. Another option is to merge everything into the "medic" ddoc.

Maybe also take it as an opportunity to do some view consolidation and auditing.

By this I mean:

  • trace every view and make sure it's used
  • see how it's used and remove any unnecessary data like excessive emitted data or docs
  • see if views can be consolidated, two views basically providing the same data should be merged into one

No active work here yet.

Code review

Two PRs: https://github.com/medic/medic-sentinel/pull/82 & https://github.com/medic/medic-webapp/pull/2591

Once I removed the duplicate and unused views there were only 6 left so I decided it wasn't worth maintaining the additional ddoc. This meant I could get rid of a lot of code, mostly in kanso dependencies. If you ignore these there are significant changes to the server initialisation (because it no longer has to check the ddoc version) and updating some view references to the new ddoc.

I'll let you have the pleasure of merging this one @garethbowen.

Merged.

For acceptance testing check that there is no medic-sentinel ddoc.

Was this page helpful?
0 / 5 - 0 ratings