Skip to content

Commit

Permalink
Update to latest ingest that attempts to flush out buffer before full…
Browse files Browse the repository at this point in the history
…y disposing (#440)

This also updates our serology sink to implement `IDisposable` so it
waits to flush as well. See also #411
  • Loading branch information
Mpdreamz authored Sep 18, 2024
1 parent 88365f4 commit 5134fe2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Elastic.Ingest.Elasticsearch" Version="0.7.0" />
<PackageReference Include="Elastic.Ingest.Elasticsearch" Version="0.7.1" />
</ItemGroup>

</Project>
4 changes: 3 additions & 1 deletion src/Elastic.Serilog.Sinks/ElasticsearchSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public ElasticsearchSink(ElasticsearchSinkOptions options) : base(options) {}
}

/// <inheritdoc cref="ElasticsearchSink"/>>
public class ElasticsearchSink<TEcsDocument> : ILogEventSink
public class ElasticsearchSink<TEcsDocument> : ILogEventSink, IDisposable
where TEcsDocument : EcsDocument, new()
{
private readonly EcsTextFormatterConfiguration<TEcsDocument> _formatterConfiguration;
Expand Down Expand Up @@ -121,6 +121,8 @@ public void Emit(LogEvent logEvent)
_channel.TryWrite(ecsDoc);
}

/// <summary> Disposes and flushed <see cref="EcsDataStreamChannel{TEcsDocument}"/> </summary>
public void Dispose() => _channel.Dispose();
}

internal class SelfLogCallbackListener<TEcsDocument> : IChannelCallbacks<TEcsDocument, BulkResponse> where TEcsDocument : EcsDocument, new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ItemGroup>
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.12.1" />
<PackageReference Include="Elastic.Elasticsearch.Xunit" Version="0.4.3" />
<PackageReference Include="Elastic.Ingest.Elasticsearch" Version="0.7.0" />
<PackageReference Include="Elastic.Ingest.Elasticsearch" Version="0.7.1" />

</ItemGroup>

Expand Down

0 comments on commit 5134fe2

Please sign in to comment.