Help starlark simple script

Hello @pietro.ficeli,
You just have a indent problem see this community question for an example of how to fix it:

source = '''
def apply(metric):
    used = float(metric.fields[‘MemoryUsed’])
    total = float(metric.fields[‘MemoryTotal’])
    metric.fields[‘usage’] = (used / total) * 100
    return metric

I believe that should work.