Formatting Timelion values as percentage

I have a Timelion chart that is showing MetricBeat data, so I would like the system.cpu.user.pct for example, to be formatted as a percentage, not a 0-1 value.

Is there any way to format values in Timelion? The documentation is very sparse.

(.es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.system.pct',offset='-28d'), .es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.user.pct',offset='-28d')).sum().movingaverage(window=2).label('-4w').color(#ffcfb0),
(.es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.system.pct',offset='-21d'), .es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.user.pct',offset='-21d')).sum().movingaverage(window=2).label('-3w').color(#ffc5a0),
(.es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.system.pct',offset='-14d'), .es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.user.pct',offset='-14d')).sum().movingaverage(window=2).label('-2w').color(#ffbb90),
(.es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.system.pct',offset='-7d'), .es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.user.pct',offset='-7d')).sum().movingaverage(window=2).label('-1w').color(#ffb180),
(.es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.system.pct'), .es(index='metricbeat-*',q='metricset.name:cpu',metric='avg:system.cpu.user.pct',offset='-7d')).sum().label('Today').movingaverage(window=2).color(#ff2c0f),

I don't think this is currently possible. I've added an enhancement request for this feature here: https://github.com/elastic/kibana/issues/10518

Can you not use the multiply function to multiply all data points by a factor of 100.0 to get the data points in the right range?

Can you not use the multiply function to multiply all data points by a factor of 100.0 to get the data points in the right range?

Good call. You could do something like this:

.multiply(100).yaxis(units="custom::%")

1 Like

Good idea, I'll give that a shot.

Those Timelion scripts get pretty long don't they, for something we have a one-line URL-style editor for :slight_smile:
At least you can paste in a command that has newlines in it, so I can store them elsewhere. Although that doesn't work in the visualisation screen - that rejects anything with new-lines in it.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.