Skip to content

Commit f7c6f51

Browse files
committed
Improve export logging a tad
1 parent aa8267d commit f7c6f51

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Elastic.Markdown/Exporters/ElasticsearchMarkdownExporter.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,20 @@ public async ValueTask StartAsync(Cancel ctx = default)
187187
//The max num threads per allocated node, from testing its best to limit our max concurrency
188188
//producing to this number as well
189189
var options = NewOptions(transport);
190+
var i = 0;
190191
options.BufferOptions = new BufferOptions
191192
{
192193
OutboundBufferMaxSize = Endpoint.BufferSize,
193194
ExportMaxConcurrency = Endpoint.IndexNumThreads,
194195
ExportMaxRetries = Endpoint.MaxRetries,
195196
};
196197
options.SerializerContext = SourceGenerationContext.Default;
197-
options.ExportBufferCallback = () => _logger.LogInformation("Exported buffer to Elasticsearch");
198+
options.ExportBufferCallback = () =>
199+
{
200+
var count = Interlocked.Increment(ref i);
201+
_logger.LogInformation("Exported {Count} documents to Elasticsearch index {Format}",
202+
count * Endpoint.BufferSize, options.IndexFormat);
203+
};
198204
options.ExportExceptionCallback = e => _logger.LogError(e, "Failed to export document");
199205
options.ServerRejectionCallback = items => _logger.LogInformation("Server rejection: {Rejection}", items.First().Item2);
200206
_channel = NewChannel(options);

0 commit comments

Comments
 (0)