Opened 7 months ago

Closed 6 months ago

Last modified 6 months ago

#2684 closed enhancement (fixed)

Replace jrobin with rrd4j

Reported by: zzz Owned by: zzz
Priority: minor Milestone: 0.9.46
Component: apps/console Version: 0.9.44
Keywords: Cc: Reportage
Parent Tickets: Sensitive: no

Description

rrd4j is the actively maintained fork of jrobin.
Apache 2.0 licensed.
Java 7 minimum.
Current release 3.5, Feb. 10 2019
Not in Debian
https://github.com/rrd4j/rrd4j

Subtickets

Change History (7)

comment:1 Changed 7 months ago by zzz

Milestone: undecided0.9.46

I spent a couple hours working on this to see if it worked.
About 20 errors due to changed API that I fixed.
About 30 deprecation warnings remain, presumably the deprecated methods still work for now but I was unable to test.

The graphing dies at runtime due to failure to load ttf fonts. The font loading has changed and rrd4j wants the ttf files in the classpath, which means to work as-is we'd have to bundle them in the jar. That would be 600KB and would be unacceptable in Debian packages. There's no way to override this behavior, as noted at https://github.com/rrd4j/rrd4j/issues/113 . I'm not sure why rrd4j can't find the fonts in the java font path.

Alternative is to modify the source. One possibility is at the link in the github issue above. But there's no cross-platform way to know where the fonts are. Modifying the source to change back to what jrobin does may be an option.

If we can figure out the font loading issue, and subsequent testing goes well, this is a possibility for .46 timeframe.

comment:2 Changed 7 months ago by zzz

As a temp workaround so I could test, I put the ttf's in the jar.
The fonts looked terrible so I spent a couple hours figuring out why.
The answer was simple - a new setTextAntiAliasing(true) call.
But along the way I discovered several things about the fonts…

  • Our attempt to set "Droid Sans" and "Droid Sans Mono" don't work and probably never have worked. These font names are not found in my testing on linux, windows, or mac. They fall back to Java default fonts "Dialog" and "Monospaced" respectively. These were added by str4d in 2017.
  • The setSmallFont() call does not override all the specific fonts, it only sets the default, so it isn't helpful.
  • We override all the fonts, so there's no reason to worry about trying to load the DejaVu? fonts. We can just set the defaults to Monospaced and be done with it.

The graphs look pretty much the same as before. The grid is solid line now, but I think I see how to restore the previous dashed line.

comment:3 Changed 6 months ago by zzz

Owner: changed from sadie to zzz
Status: newaccepted

Fix issues from comment 2 above in 52c5811e6712b3892dcf758559638dff7706c33b 0.9.44-6:

Clean up font setting, fix bugs
Unit font now monospaced on Linux and Mac as intended
Don't set Droid Sans font, not present in any platform by default
Fix font scaling for Japanese
Detect more RTL languages
Make fonts configurable

Figured out how to restore the previous grid style with rrd4j, so that should be the last of the issues for rrd4j. Render time comparisons to follow. Plan is to migrate to rrd4j for the .46 release.

comment:4 Changed 6 months ago by zzz

SummaryRender?.render() average time (ms) n~=550

jrobin: 87
rrd4j: 80

probably within margin of error, and not surprising, as the time is probably dominated by IO and the Java Graphics libs.

comment:5 Changed 6 months ago by zzz

Patch is ready to go, will be applied soon after the .45 release.
http://stats.i2p/docs/rrd4j.diff.gz

comment:6 Changed 6 months ago by zzz

Resolution: fixed
Status: acceptedclosed

comment:7 Changed 6 months ago by zzz

Inadvertently missed checking in a lot of the rrd4j source, it's in there now in 0.9.45-2

Note: See TracTickets for help on using tickets.