[ 
https://issues.apache.org/jira/browse/SOLR-14683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17228512#comment-17228512
 ] 

Andrzej Bialecki commented on SOLR-14683:
-----------------------------------------

{quote}Solr's JSON Response writer already has long standing support to output 
{{Float.NaN}} as a quoted string {{"NaN"}}
{quote}
Therein lies the problem ;) since there is no standard way to do it Solr 
decided to use a STRING (quoted) value of {{"NaN"}}... but some other libraries 
(and the popular extended spec [http://json5.org|http://json5.org%29/]) use 
unquoted values for {{NaN, Infinity, -Infinity}}. Some other parsers use {{nan, 
inf, -inf}} - that's the beauty of standards, there are so many of them to 
choose from... /s

Taking all this into account returning {{null}} for NaN or undefined seems like 
the safest option.

> Review the metrics API to ensure consistent placeholders for missing values
> ---------------------------------------------------------------------------
>
>                 Key: SOLR-14683
>                 URL: https://issues.apache.org/jira/browse/SOLR-14683
>             Project: Solr
>          Issue Type: Improvement
>          Components: metrics
>            Reporter: Andrzej Bialecki
>            Assignee: Andrzej Bialecki
>            Priority: Major
>
> Spin-off from SOLR-14657. Some gauges can legitimately be missing or in an 
> unknown state at some points in time, eg. during SolrCore startup or shutdown.
> Currently the API returns placeholders with either impossible values for 
> numeric gauges (such as index size -1) or empty maps / strings for other 
> non-numeric gauges.
> [~hossman] noticed that the values for these placeholders may be misleading, 
> depending on how the user treats them - if the client has no special logic to 
> treat them as "missing values" it may erroneously treat them as valid data. 
> E.g. numeric values of -1 or 0 may severely skew averages and produce 
> misleading peaks / valleys in metrics histories.
> On the other hand returning a literal {{null}} value instead of the expected 
> number may also cause unexpected client issues - although in this case it's 
> clearer that there's actually no data available, so long-term this may be a 
> better strategy than returning impossible values, even if it means that the 
> client should learn to handle {{null}} values appropriately.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to