Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Events lost before reaching the segment servers #156

Closed
mabead opened this issue Feb 1, 2021 · 0 comments · Fixed by #158
Closed

Events lost before reaching the segment servers #156

mabead opened this issue Feb 1, 2021 · 0 comments · Fixed by #158

Comments

@mabead
Copy link

mabead commented Feb 1, 2021

When using Analytics.NET version 3.4.2-beta, I found out thta a few analytics events per hour are not successfully sent to the segment servers. To troubleshoot this, I configured the Segment.Client.Failed callback:

private void LogFailure(SegmentSdk.Model.BaseAction action, Exception e)
{
    _logger.LogError(e, $"Failed to send analytic event {action.Type} for user {action.UserId} to segment.io server");
}

myClient.Failed += LogFailure;

With this in-place, I now see this error log pop-up a few times per hour. Here's what the error looks like this (The response ended prematurely):

Failed to send analytic event track for user c08cb1fb-f963-4238-b075-570f08a88892 to segment.io server
System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Segment.Request.BlockingRequestHandler.MakeRequest(Batch batch)

From what I can see, the events are then completely lost. The consequence of this are pretty bad for us:

  • we do an Identify to set a few traits on the user.
  • these traits are then used by the customer.io destination to send some promotional messages and communications
  • since some events are lost, it means that customer.io sends the wrong communications to a few of our users

Chameleon is also used to create some on-boarding flows. Since the traits are not always sent correctly, it means that some users see the wrong on-boarding flows.

After looking at the Analytics.NET code, I can see that all unexpected exceptions are not retried:

Fail(batch, e, watch.ElapsedMilliseconds);

So my question is:

  • would it be possible for you to retry exceptions like this?

This would clearly help in having more accurate analytics.

Regards,
Maxime

@mabead mabead changed the title Events "silently" lost before reaching the segment servers Events lost before reaching the segment servers Feb 1, 2021
@nd4p90x nd4p90x added this to To do in Analytics.NET via automation Feb 3, 2021
@nd4p90x nd4p90x linked a pull request Feb 11, 2021 that will close this issue
@nd4p90x nd4p90x closed this as completed Feb 11, 2021
Analytics.NET automation moved this from To do to Done Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants