telegraf/plugins/processors/starlark/testdata/ratio.star

8 lines
213 B
Plaintext

# Compute the ratio of two integer fields.
def apply(metric):
used = float(metric.fields['used'])
total = float(metric.fields['total'])
metric.fields['usage'] = (used / total) * 100
return metric