Skip to content

Commit

Permalink
Implemented dropping events, rejected by Loki (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
mishamyte authored Aug 30, 2021
1 parent 7f00aff commit 30aa016
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Serilog.Sinks.Grafana.Loki/LokiSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ private async Task OnTick()
}
else
{
_connectionSchedule.MarkFailure();

SelfLog.WriteLine(
"Received failure on HTTP shipping {0}: {1}",
response.StatusCode,
await response.Content.ReadAsStringAsync().ConfigureAwait(false));
"Received failure on HTTP shipping ({0}): {1}. {2} log events will be dropped",
(int)response.StatusCode,
await response.Content.ReadAsStringAsync().ConfigureAwait(false),
_waitingBatch.Count);

_connectionSchedule.MarkFailure();
_waitingBatch.Clear();

break;
}
Expand Down

0 comments on commit 30aa016

Please sign in to comment.