You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The CSW harvester of the geonetwork sometimes increments two metrics for a single record. This is not desired and does not happen in other harvesters AFAICT.
This can happen if a new or existing record cannot be retrived, validated or is a duplicate. In both addMetadata and updatingLocalMetadata, the function retriveMetadata is called.
This function increments one of the metrics and returns null if retrival or validation fails or if the record is a duplicate.
The error is that the calling functions also increment either unretrievable in case of new metadata or unchanged in case of updating existing metadata when null is returned, which causes the erronious behavior:
The solution seems to just not increment any counter if retriveMetadata return null
To Reproduce
Steps to reproduce the behavior:
Add a harvester that harvests a CSW with known-unretrivable records or records that dont validate
Run the harvester
Notice that the number of total records is smaller than all added + doesNotValidate + unretrievable
Expected behavior
A single record only increments the number of total records and one of the other status metrics.
Screenshots
The count of all other metrics besides total combined in this screenshot is 2969, which is 4 entries more than should be possible
Desktop (please complete the following information):
GeoNetwork Version 4.2.5 (but latest main branch affected as well)
Additional context
This bug makes the metrics way less useful, as you cannot say for certain what errors occured and what is just a byproduct of the current behaviour, which makes automated monitoring of these metrics impossible.
The text was updated successfully, but these errors were encountered:
josegar74
added a commit
to GeoCat/core-geonetwork
that referenced
this issue
May 19, 2024
…rtain conditions.
Retrieve metadata method increments metrics under certain conditions and returns null. Methods calling the retrieve metadata method increments additionally the unretrievable metric if null is returned. Sonarlint fixeas are already applied. Fixesgeonetwork#8039
Describe the bug
The CSW harvester of the geonetwork sometimes increments two metrics for a single record. This is not desired and does not happen in other harvesters AFAICT.
This can happen if a new or existing record cannot be retrived, validated or is a duplicate. In both
addMetadata
andupdatingLocalMetadata
, the functionretriveMetadata
is called.core-geonetwork/harvesters/src/main/java/org/fao/geonet/kernel/harvest/harvester/csw/Aligner.java
Line 504 in a79641b
This function increments one of the metrics and returns
null
if retrival or validation fails or if the record is a duplicate.The error is that the calling functions also increment either
unretrievable
in case of new metadata orunchanged
in case of updating existing metadata whennull
is returned, which causes the erronious behavior:core-geonetwork/harvesters/src/main/java/org/fao/geonet/kernel/harvest/harvester/csw/Aligner.java
Lines 280 to 290 in a79641b
core-geonetwork/harvesters/src/main/java/org/fao/geonet/kernel/harvest/harvester/csw/Aligner.java
Lines 441 to 447 in a79641b
The solution seems to just not increment any counter if
retriveMetadata
returnnull
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A single record only increments the number of total records and one of the other status metrics.
Screenshots
The count of all other metrics besides total combined in this screenshot is 2969, which is 4 entries more than should be possible
Desktop (please complete the following information):
Additional context
This bug makes the metrics way less useful, as you cannot say for certain what errors occured and what is just a byproduct of the current behaviour, which makes automated monitoring of these metrics impossible.
The text was updated successfully, but these errors were encountered: