in src/Serilog.Sinks.AzureDataExplorer/Sinks/AzureDataExplorerSink.cs [114:161]
public AzureDataExplorerSink(AzureDataExplorerSinkOptions options)
{
if (options == null) throw new ArgumentNullException(nameof(options));
m_options = options;
m_databaseName = options.DatabaseName ?? throw new ArgumentNullException(nameof(options.DatabaseName));
m_tableName = options.TableName ?? throw new ArgumentNullException(nameof(options.TableName));
if (options.IngestionEndpointUri == null) throw new ArgumentNullException(nameof(options.IngestionEndpointUri));
m_formatProvider = options.FormatProvider;
var mappingName = options.MappingName;
m_flushImmediately = options.FlushImmediately;
m_streamingIngestion = options.UseStreamingIngestion;
m_ingestionMapping = new IngestionMapping();
if (!string.IsNullOrEmpty(mappingName))
{
m_ingestionMapping.IngestionMappingReference = mappingName;
}
else if (options.ColumnsMapping?.Any() == true)
{
m_ingestionMapping.IngestionMappings = options.ColumnsMapping.Select(m => new ColumnMapping
{
ColumnName = m.ColumnName,
ColumnType = m.ColumnType,
Properties = new Dictionary<string, string>(1)
{
{
MappingConsts.Path, m.ValuePath
}
}
}).ToList();
}
else
{
m_ingestionMapping.IngestionMappings = SDefaultIngestionColumnMapping;
}
var kcsb = options.GetKustoConnectionStringBuilder();
var engineKcsb = options.GetKustoEngineConnectionStringBuilder();
if (options.UseStreamingIngestion)
{
m_ingestClient = KustoIngestFactory.CreateManagedStreamingIngestClient(engineKcsb, kcsb);
}
else
{
m_ingestClient = KustoIngestFactory.CreateQueuedIngestClient(kcsb);
}
}