Wrong numbers in metrics.metric ? [OJS]

Hi to all,
I’m doing a check about numbers of downloads.
To know the number of full-text download of an article (id=2599) in a specific day (20180125) the SQL code is:
select sum(metric) from metrics where submission_id=‘2599’ and assoc_type = ‘260’ and day = ‘20180125’;
Is it correct ?

Because I find the number in metrics.metric if I check apache logs. Instead of ‘1’ I find ‘18’ inside 18 rows.
And 18 download is probably more correct.
Do you find similar problems about the number inside metrics.metric ?

Zeno Tajoli

Summing the metric field across just a submission and day will not get what you are wanting.

There are multiple other columns in this table which present facets for counting. For example, you might have a metric_type of “ojs::counter” and of “ojs::legacyDefault” for the same article and date. Similarly, the counts might be broken out over country, region, city, etc.

The overview at https://pkp.sfu.ca/wiki/index.php?title=OJSdeStatisticsConcept#Metrics_Table may help describe this further.

thank you for the link, a good reading.
I re-import data of 2018-01-25 with ojs log files.
Now the result of select sum(metric) from metrics where submission_id=‘2599’ and assoc_type = ‘260’ and day = ‘20180125’; is 18, the same number of downloads that I count from apache logs.
In fact I have all facets with same values:
metric_type = ‘ojs::counter’
file_type = ‘2’
country_id = ‘IT’

I think that at 26/Jan/2018 I had problem with anacron plugin in same way.

Zeno Tajoli

Hello @ctgraham,

This link is dead. is there a description of the metrics table assoc_type,… for OJS3?


The description of the statistics framework in OJS3 is here:

This may not be quite as technical as the old wiki reference.

@marc, you took a backup of the wiki before it was decommissioned, didn’t you?

Thank you @ctgraham,

I was looking for some more detail about variables in the metrics table. For example different values for assosc_type variable and what do they mean.

Is the new technical reference or the old wiki for 2.4.6 available elsewhere?


Yes… there is a copy here: https://pkp.sfu.ca/wiki

Notice it’s a “static” replica (no search function) so you need to follow the links to find what you are looking for… that probably it’s this?



(Clinton, I edited the post to show the official PKP url instead of the temporary copy.)

Thanks, @marc

@alirezaaa, the new technical documentation is being built here:

But it doesn’t currently cover the statistics/metrics, to my knowledge.

The assoc_type and assoc_id columns are used throughout the product to point dynamically to different “Associated IDs” by an “Associated Type”. For example: articles, issues, galleys, etc.

Some additional description, and where to find the constants in the code, is here:

1 Like