Skip to content

Commit

Permalink
Merge pull request #6255 from QualitativeDataRepository/IQSS/6212
Browse files Browse the repository at this point in the history
IQSS/6212 - Support collecting MDC metrics without display
  • Loading branch information
kcondon authored Oct 7, 2019
2 parents 72fba02 + ee2095e commit 3bf9091
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 21 deletions.
5 changes: 5 additions & 0 deletions doc/sphinx-guides/source/admin/make-data-count.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ To make Dataverse log dataset usage (views and downloads) for Make Data Count, y

After you have your first day of logs, you can process them the next day.

Enable or Disable Display of Make Data Count Metrics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

By default, when MDC logging is enabled (when ``:MDCLogPath`` is set), Dataverse will display MDC metrics instead of it's internal (legacy) metrics. You can avoid this (e.g. to collect MDC metrics for some period of time before starting to display them) by setting ``:DisplayMDCMetrics`` to false.

Configure Counter Processor
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 2 additions & 0 deletions doc/sphinx-guides/source/developers/make-data-count.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ To get the ``REPORT_ID``, look at the logs generated in ``/usr/local/counter-pro

To read more about the Make Data Count api, see https://github.com/datacite/sashimi

You can compare the MDC metrics display with Dataverse's original by toggling the ``:DisplayMDCMetrics`` setting (true by default to display MDC metrics).

Resources
---------

Expand Down
7 changes: 7 additions & 0 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1770,6 +1770,13 @@ Sets the path where the raw Make Data Count logs are stored before being process

``curl -X PUT -d '/usr/local/glassfish4/glassfish/domains/domain1/logs' http://localhost:8080/api/admin/settings/:MDCLogPath``

:DisplayMDCMetrics
++++++++++++++++++

``:DisplayMDCMetrics`` can be set to false to disable display of MDC metrics (e.g. to enable collection of MDC metrics for some period prior to completing the set-up of Counter and performing the other steps described in the :doc:`/admin/make-data-count` section of the Admin Guide).

``curl -X PUT -d 'false' http://localhost:8080/api/admin/settings/:DisplayMDCMetrics``

.. _:Languages:

:Languages
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/edu/harvard/iq/dataverse/SettingsWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,6 @@ private void initLocaleSettings() {
}
}

public boolean isMakeDataCountEnabled(){
String logPath = systemConfig.getMDCLogPath();
if (logPath != null) {
return true;
} else {
return false;
}
}

public boolean isDoiInstallation() {
String protocol = getValueForKey(SettingsServiceBean.Key.Protocol);
if ("doi".equals(protocol)) {
Expand All @@ -259,6 +250,12 @@ public boolean isDoiInstallation() {
return false;
}
}

public boolean isMakeDataCountDisplayEnabled() {
boolean safeDefaultIfKeyNotFound = (getValueForKey(SettingsServiceBean.Key.MDCLogPath)!=null); //Backward compatible
return isTrueForKey(SettingsServiceBean.Key.DisplayMDCMetrics, safeDefaultIfKeyNotFound);

}

}

Original file line number Diff line number Diff line change
Expand Up @@ -401,10 +401,10 @@ Whether Harvesting (OAI) service is enabled
* inheritance. "*" means inherit assignments for all roles
*/
InheritParentRoleAssignments,
/*
*
*/
MDCLogPath,

/** Make Data Count Logging and Display */
MDCLogPath,
DisplayMDCMetrics,

/**
* Allow CORS flag (true or false). It is true by default
Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -382,35 +382,35 @@
<div id="metrics-heading">
#{bundle['metrics.dataset.title']}
<span class="glyphicon glyphicon-question-sign tooltip-icon" data-toggle="tooltip" data-placement="auto top"
data-original-title="#{settingsWrapper.makeDataCountEnabled ? bundle['metrics.dataset.tip.makedatacount'] : bundle['metrics.dataset.tip.default']}"></span>
data-original-title="#{settingsWrapper.makeDataCountDisplayEnabled ? bundle['metrics.dataset.tip.makedatacount'] : bundle['metrics.dataset.tip.default']}"></span>
</div>
<div id="metrics-body">
<!-- Classic downloads -->
<div class="metrics-count-block" jsf:rendered="#{!settingsWrapper.makeDataCountEnabled}">
<div class="metrics-count-block" jsf:rendered="#{!settingsWrapper.makeDataCountDisplayEnabled}">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDatasetId(DatasetPage.dataset.id)}"/>
</h:outputFormat>
<span class="glyphicon glyphicon-question-sign tooltip-icon"
data-toggle="tooltip" data-placement="auto top" data-original-title="#{bundle['metrics.dataset.downloads.default.tip']}"></span>
</div>
<!-- Make Data Count views -->
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountEnabled}">
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountDisplayEnabled}">
<h:outputFormat value="{0} #{bundle['metrics.views']}">
<f:param value="#{datasetMetricsServiceBean.getMetrics(DatasetPage.dataset).getViewsTotal()}"/>
</h:outputFormat>
<span class="glyphicon glyphicon-question-sign tooltip-icon"
data-toggle="tooltip" data-placement="auto top" data-original-title="#{bundle['metrics.dataset.views.tip']}"></span>
</div>
<!-- Make Data Count downloads -->
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountEnabled}">
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountDisplayEnabled}">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{datasetMetricsServiceBean.getMetrics(DatasetPage.dataset).getDownloadsTotal()}"/>
</h:outputFormat>
<span class="glyphicon glyphicon-question-sign tooltip-icon"
data-toggle="tooltip" data-placement="auto top" data-original-title="#{bundle['metrics.dataset.downloads.makedatacount.tip']}"></span>
</div>
<!-- Make Data Count citations (DOIs only, not Handles) -->
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountEnabled and settingsWrapper.doiInstallation}">
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountDisplayEnabled and settingsWrapper.doiInstallation}">
<p:commandLink oncomplete="PF('citationsDialog').show();">
<h:outputFormat value="{0} #{bundle['metrics.citations']}">
<f:param value="#{fn:length(datasetExternalCitationsServiceBean.getDatasetExternalCitationsByDataset(DatasetPage.dataset))}"/>
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/file.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -323,19 +323,19 @@
<div id="metrics-heading">
#{bundle['metrics.file.title']}
<span class="glyphicon glyphicon-question-sign tooltip-icon" data-toggle="tooltip" data-placement="auto top"
data-original-title="#{settingsWrapper.makeDataCountEnabled ? bundle['metrics.file.tip.makedatacount'] : bundle['metrics.file.tip.default']}"></span>
data-original-title="#{settingsWrapper.makeDataCountDisplayEnabled ? bundle['metrics.file.tip.makedatacount'] : bundle['metrics.file.tip.default']}"></span>
</div>
<div id="metrics-body">
<!-- Classic downloads -->
<div class="metrics-count-block" jsf:rendered="#{!settingsWrapper.makeDataCountEnabled}">
<div class="metrics-count-block" jsf:rendered="#{!settingsWrapper.makeDataCountDisplayEnabled}">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDataFileId(FilePage.fileId)}"/>
</h:outputFormat>
<span class="glyphicon glyphicon-question-sign tooltip-icon"
data-toggle="tooltip" data-placement="auto top" data-original-title="#{bundle['metrics.file.downloads.tip']}"></span>
</div>
<!-- Make Data Count downloads -->
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountEnabled}">
<div class="metrics-count-block" jsf:rendered="#{settingsWrapper.makeDataCountDisplayEnabled}">
<h:outputFormat value="{0} #{bundle['metrics.downloads']}">
<f:param value="#{guestbookResponseServiceBean.getCountGuestbookResponsesByDataFileId(FilePage.fileId)}"/>
</h:outputFormat>
Expand Down

0 comments on commit 3bf9091

Please sign in to comment.