Documentation statistics charts in the Documentation Application

Hi,

While migrating the documentation to the new doc system, I ended up writing a set of wiki pages on xwiki.org that measure how the migration is going:

They are plain wiki pages, written without a work package or a review, they are just scripts. Along the way of creating Design page I realized that some of the charts could be created and stay even after the migration. I would like to add those to the Documentation Application, and I think the rest should stay where it is (under Documentation Scripts and Queries).

Proposal

1. The generic charts go to a new module, documentation-stats-ui, installed on its own.

Three charts describing the documentation of a wiki rather than the migration: pages per Diataxis type, pages per target audience, and the two crossed. For details see Documentation Statistics Application.

These need no configuration to be generic: a documentation page is a page carrying a DocApp.Code.DocumentationClass object, wherever it lives.

It would be a separate module rather than more pages in documentation-ui, because a wiki can reasonably want the Documentation Application without a statistics dashboard.

2. The migration pages stay where they are.

I am not sure it is worth moving them anywhere in the Documentation Application. They know about the legacy trees of xwiki.org, and they have an end date by construction: once the migration is finished we will not need them anymore.. So I propose to keep them as wiki pages on xwiki.org and eventually delete them/hide them when the migration is over.

Questions

If you can think of other statistics that make sense for any wiki using the Documentation Application, I am happy to add them to the design page. If you agree, I will create the work packages for proposal 1 in the Documentation Application project.

WDYT? Thanks!

Hi @elenicojocariu, thanks for this! Some feedback:

1. Performance is the main concern, both in the app and for the xwiki.org scripts

I timed the pages once, as a guest:

  • migration-progress/new-pages: ~10s per view. It fetches up to 5000 Solr results and counts them month by month in Velocity, on every display.
  • migration-progress/contributors: ~1.5s per view, with an HQL join on the revision history table each time.

These are public pages, so every visit, including from bots, runs these queries again and uses CPU on xwiki.org. We need to either make them cheap or restrict their view rights (e.g. to registered users or to the doc team) so they’re not crawled. Ideally both, plus some caching (the {{cache}} macro with a timeout is enough for numbers that change daily at most).

For the packaged app, I’d make it a hard requirement: no query whose cost grows with the wiki size on every page view. Also, the links to the detail pages in your post give a 404 now.

2. XWQL/HQL vs the event stream

Whatever is fastest, measured on xwiki.org’s real data:

  • For counts based on each page’s current state (pages per type/audience, pages created per month), Solr faceting (facet on the fields, rows=0) gives the totals in one request without returning any document, which should be orders of magnitude faster than the current approach.
  • For activity over time (who edited what in a month), the event store (activity stream) is also a Solr index on date/user/page, so it’s probably cheaper than joining XWikiRCSNodeInfo on each view. It may be incomplete for older history, though (retention, imported pages). Could you measure both before choosing?

3. Fewer stats, chosen because they’re actionable

I think we shouldn’t have too many stats. It’d be better to pick a few that give useful insight we can act on. A good test for each candidate: what would we do differently based on it?

A few ideas to start the discussion (I haven’t really thought them through yet):

  • A single type × audience view could perhaps replace the three separate charts, and show the gaps (e.g. no admin tutorials).
  • For activity, I think the number of distinct pages edited says more than “edits per page” or “most edited pages”, since someone can make lots of small saves on a single page.
  • Orphan pages could be interesting since the action is obvious (link them), as long as they’re cheap to compute.

What do others think are the most useful stats to keep?

4. +1 to keep the migration pages on xwiki.org and remove them once the migration is over, after fixing point 1 for them.

WDYT?