Unverified Commit dd05e46f authored by alespour's avatar alespour Committed by GitHub

[telegraf] render percentiles as floats (#396)

* fix: percentiles are always floats * refactor: simplified array iteration * bump version
parent 54dfd107
apiVersion: v2 apiVersion: v2
name: telegraf name: telegraf
version: 1.8.9 version: 1.8.10
appVersion: 1.21.1 appVersion: 1.21.1
deprecated: false deprecated: false
description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics. description: Telegraf is an agent written in Go for collecting, processing, aggregating, and writing metrics.
......
...@@ -207,21 +207,24 @@ app.kubernetes.io/instance: {{ .Release.Name }} ...@@ -207,21 +207,24 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- range $b, $val := $value }} {{- range $b, $val := $value }}
{{- $i := int64 $b }} {{- $i := int64 $b }}
{{- $tp := typeOf $val }} {{- $tp := typeOf $val }}
{{- if eq $i $numOut }}
{{- if eq $tp "string" }} {{- if eq $tp "string" }}
{{ $val | quote }} {{ $val | quote }}
{{- end }} {{- end }}
{{- if eq $tp "float64" }} {{- if eq $tp "float64" }}
{{ $val | int64 }} {{- if eq $key "percentiles" }}
{{- $xval := float64 (int64 $val) }}
{{- if eq $val $xval }}
{{ $val | int64 }}.0
{{- else }}
{{ $val | float64 }}
{{- end }} {{- end }}
{{- else }} {{- else }}
{{- if eq $tp "string" }} {{ $val | int64 }}
{{ $val | quote }},
{{- end}}
{{- if eq $tp "float64" }}
{{ $val | int64 }},
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if ne $i $numOut -}}
,
{{- end -}}
{{- end }} {{- end }}
] ]
{{- end }} {{- end }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment