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 GitHub
parent b6ad581b45
commit f7dda12b4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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