public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { CloudInitLogParsedResult parsedResult = tableData.QueryOutput <CloudInitLogParsedResult>( DataOutputPath.Create(SourceParserIds.CloudInitLog, CloudInitDataCooker.CookerId, "ParsedResult")); var logEntries = parsedResult.LogEntries; var baseProjection = Projection.Index(logEntries); var fileNameProjection = baseProjection.Compose(x => x.FilePath); var lineNumberProjection = baseProjection.Compose(x => x.LineNumber); var eventTimeProjection = baseProjection.Compose(x => x.EventTimestamp); var pythonFileProjection = baseProjection.Compose(x => x.PythonFile); var logLevelProjection = baseProjection.Compose(x => x.LogLevel); var logProjection = baseProjection.Compose(x => x.Log); var config = new TableConfiguration("Default") { Columns = new[] { FileNameColumn, LogLevelColumn, TableConfiguration.PivotColumn, PythonFileColumn, LineNumberColumn, LogColumn, EventTimestampDateTimeColumn, TableConfiguration.GraphColumn, EventTimestampColumn, }, Layout = TableLayoutStyle.GraphAndTable, }; config.AddColumnRole(ColumnRole.StartTime, EventTimestampColumn); // // // Use the table builder to build the table. // Add and set table configuration if applicable. // Then set the row count (we have one row per file) and then add the columns using AddColumn. // tableBuilder .AddTableConfiguration(config) .SetDefaultTableConfiguration(config) .SetRowCount(logEntries.Count) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineNumberColumn, lineNumberProjection) .AddColumn(EventTimestampColumn, eventTimeProjection) .AddColumn(PythonFileColumn, pythonFileProjection) .AddColumn(LogLevelColumn, logLevelProjection) .AddColumn(LogColumn, logProjection) ; }
public static void BuildTable(ITableBuilder tableBuilder, IDataExtensionRetrieval tableData) { CloudInitLogParsedResult parsedResult = tableData.QueryOutput <CloudInitLogParsedResult>( DataOutputPath.ForSource(SourceParserIds.CloudInitLog, CloudInitDataCooker.CookerId, nameof(CloudInitDataCooker.ParsedResult))); var fileNames = parsedResult.FileToMetadata.Keys.ToArray(); var fileNameProjection = Projection.Index(fileNames.AsReadOnly()); var lineCountProjection = fileNameProjection.Compose( fileName => parsedResult.FileToMetadata[fileName].LineCount); tableBuilder.SetRowCount(fileNames.Length) .AddColumn(FileNameColumn, fileNameProjection) .AddColumn(LineCountColumn, lineCountProjection); }