-
Notifications
You must be signed in to change notification settings - Fork 60
Events not sent to Segment servers: "Unexpected Status Code" #163
Comments
I find it weird that we see:
|
In case it can help, I have attached somme logs coming from Analytics.Net before/after the error. |
@mabead May I ask if you have any custom settings for the configuration of the client or are you just using the default values of the configuration? |
@juliette-ruchel Here's how we initialize the segment client: using SegmentSdk = Segment;
// ...
private void Initialize()
{
var segmentConfig = new SegmentSdk.Config()
.SetAsync(_configuration.SendMessagesAsynchronously); // SendMessagesAsynchronously = true
if (!string.IsNullOrEmpty(_configuration.DotNetBackEndSourceKey))
{
LandrMusicClient = new SegmentSdk.Client(_configuration.DotNetBackEndSourceKey, segmentConfig);
LandrMusicClient.Failed += LogFailure;
}
SegmentSdk.Logger.Handlers += LogSegmentEvent;
}
private void LogFailure(SegmentSdk.Model.BaseAction action, Exception e)
{
string details = null;
if (e != null)
{
details = e.Message;
}
_logger.LogError(LoggingEvents.SegmentFailure, e, $"Failed to send analytic event {action.Type} for user {action.UserId} and message {action.MessageId} to segment.io server. Details: {details}");
}
private void LogSegmentEvent(SegmentSdk.Logger.Level level, string message, IDictionary<string, object> args)
{
var fullMessage = message;
if (args != null)
{
fullMessage += " " + string.Join(", ", args.Select(x => $"{x.Key}: {x.Value}"));
}
switch (level)
{
case SegmentSdk.Logger.Level.DEBUG:
_logger.LogDebug(LoggingEvents.SegmentLog, fullMessage);
break;
case SegmentSdk.Logger.Level.INFO:
_logger.LogInformation(LoggingEvents.SegmentLog, fullMessage);
break;
case SegmentSdk.Logger.Level.WARN:
_logger.LogWarning(LoggingEvents.SegmentLog, fullMessage);
break;
case SegmentSdk.Logger.Level.ERROR:
_logger.LogError(LoggingEvents.SegmentLog, fullMessage);
break;
default:
_logger.LogError(LoggingEvents.SegmentLog, $"Unknown segment logging level {level} => {fullMessage}");
break;
}
} We are therefore using the default values. |
Thanks for the information! |
@pooyaj I could give it a try but I don't see a new version of Analytics.net available on nuget. As soon as you have a new version, I will be able to try it out. |
In order to get the fix for #156, I used version 3.7.0 of
Analytics.Net
. Unfortunately, I still get some errors that tell me that messages are lost.First, here's what my
Failed
callback looks like:With this, I got these error logs after a few hours:
Is there anything that I could do to help you troubleshoot this?
The text was updated successfully, but these errors were encountered: