public void writeStats( PlannerContext plannerContext, RuleResult ruleResult )
{
Path path = getPlanStatsPath();
if( path == null )
return;
File file = path.resolve( String.format( "planner-stats-%s-%s.txt", ruleResult.getRegistry().getName(), ruleResult.getResultStatus() ) ).toFile();
processLogger.logInfo( "writing planner stats to: {}", file );
file.getParentFile().mkdirs();
try( PrintWriter writer = new PrintWriter( file ) )
{
Flow flow = plannerContext.getFlow();
Map<Object, Object> configAsProperties = flow.getConfigAsProperties();
writer.format( "cascading version: %s, build: %s\n", emptyOrValue( Version.getReleaseFull() ), emptyOrValue( Version.getReleaseBuild() ) );
writer.format( "application id: %s\n", emptyOrValue( AppProps.getApplicationID( configAsProperties ) ) );
writer.format( "application name: %s\n", emptyOrValue( AppProps.getApplicationName( configAsProperties ) ) );
writer.format( "application version: %s\n", emptyOrValue( AppProps.getApplicationVersion( configAsProperties ) ) );
writer.format( "platform: %s\n", emptyOrValue( flow.getPlatformInfo() ) );
writer.format( "frameworks: %s\n", emptyOrValue( AppProps.getApplicationFrameworks( configAsProperties ) ) );
writer.println();
ruleResult.writeStats( writer );
}
catch( IOException exception )
{
processLogger.logError( "could not write stats", exception );
}
}