rueckstiess / mtools

A collection of scripts to set up MongoDB test environments and parse and visualize MongoDB log files.
Apache License 2.0
1.88k stars 400 forks source link

mplotqueries with --events graphs the first/last event on top of the y axis #278

Open victorhooi opened 10 years ago

victorhooi commented 10 years ago

I am trying to graph the following events from a logfile:

> grep "going to start draining shard:" some_mongos.log
2014-09-17T14:40:46.353+0000 [conn1593] going to start draining shard: bvprod4
2014-09-17T17:19:18.670+0000 [conn1593] going to start draining shard: bvprod8
2014-09-17T18:05:43.747+0000 [conn1593] going to start draining shard: bvprod12
2014-09-17T19:49:39.329+0000 [conn1593] going to start draining shard: bvprod20

This is the mplotqueries command line I'm using:

> grep "going to start draining shard:" some_mongos.log | mplotqueries --type event

However, the graph ends up looking like this:

mtools_events_on_axis

In this case, the first and last event seem to have been graphed on top of the left and right sides of the graph box.

Is there some way that graphing events/ranges will automatically add a bit of space on the left/right, so that you can see the first/last events?

rueckstiess commented 10 years ago

I ran into the same problem before. It's mostly an issue with event plots that have only a few events. The (ugly) workaround is to add a log line at the beginning and end of the file manually for padding.

It should probably just add 10% of the total time span left and right as padding automatically.