app/vmselect: return +Inf as null in graphite render api (#5009)

Signed-off-by: Konstantin Kulikov <k.kulikov2@gmail.com>
This commit is contained in:
Konstantin 2023-09-15 20:23:59 +03:00 committed by Aliaksandr Valialkin
parent 609c76eec9
commit c1a8a2d54c
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ See https://graphite.readthedocs.io/en/stable/render_api.html#json
{% code timestamps := s.Timestamps %} {% code timestamps := s.Timestamps %}
{% for i, v := range s.Values %} {% for i, v := range s.Values %}
[ [
{% if math.IsNaN(v) %}null{% else %}{%f= v %}{% endif %}, {% if math.IsNaN(v) || math.IsInf(v, 0) %}null{% else %}{%f= v %}{% endif %},
{%dl= timestamps[i]/1e3 %} {%dl= timestamps[i]/1e3 %}
] ]
{% if i+1 < len(timestamps) %},{% endif %} {% if i+1 < len(timestamps) %},{% endif %}

View File

@ -148,7 +148,7 @@ func streamrenderSeriesJSON(qw422016 *qt422016.Writer, s *series) {
//line app/vmselect/graphite/render_response.qtpl:48 //line app/vmselect/graphite/render_response.qtpl:48
qw422016.N().S(`[`) qw422016.N().S(`[`)
//line app/vmselect/graphite/render_response.qtpl:50 //line app/vmselect/graphite/render_response.qtpl:50
if math.IsNaN(v) { if math.IsNaN(v) || math.IsInf(v, 0) {
//line app/vmselect/graphite/render_response.qtpl:50 //line app/vmselect/graphite/render_response.qtpl:50
qw422016.N().S(`null`) qw422016.N().S(`null`)
//line app/vmselect/graphite/render_response.qtpl:50 //line app/vmselect/graphite/render_response.qtpl:50