private async Task RetryEventsAsync(List <PersistentEvent> eventsToRetry, EventPostInfo ep, IQueueEntry <EventPost> queueEntry, Project project, bool isInternalProject)
        {
            _metrics.Gauge(MetricNames.EventsRetryCount, eventsToRetry.Count);
            foreach (var ev in eventsToRetry)
            {
                try {
                    var stream = new MemoryStream(ev.GetBytes(_jsonSerializerSettings));

                    // Put this single event back into the queue so we can retry it separately.
                    await _eventPostService.EnqueueAsync(new EventPost {
                        ApiVersion      = ep.ApiVersion,
                        CharSet         = ep.CharSet,
                        ContentEncoding = null,
                        IpAddress       = ep.IpAddress,
                        MediaType       = ep.MediaType,
                        OrganizationId  = ep.OrganizationId ?? project.OrganizationId,
                        ProjectId       = ep.ProjectId,
                        UserAgent       = ep.UserAgent,
                        ShouldArchive   = false
                    }, stream).AnyContext();
                } catch (Exception ex) {
                    if (!isInternalProject && _logger.IsEnabled(LogLevel.Critical))
                    {
                        using (_logger.BeginScope(new ExceptionlessState().Property("Event", new { ev.Date, ev.StackId, ev.Type, ev.Source, ev.Message, ev.Value, ev.Geo, ev.ReferenceId, ev.Tags })))
                            _logger.LogCritical(ex, "Error while requeuing event post {FilePath}: {Message}", queueEntry.Value.FilePath, ex.Message);
                    }

                    _metrics.Counter(MetricNames.EventsRetryErrors);
                }
            }
        }
Пример #2
0
        private async Task <string> EnqueueEventPostAsync(PersistentEvent ev)
        {
            var eventPostInfo = new EventPost {
                OrganizationId  = ev.OrganizationId,
                ProjectId       = ev.ProjectId,
                ApiVersion      = 2,
                CharSet         = "utf-8",
                ContentEncoding = "gzip",
                MediaType       = "application/json",
                UserAgent       = "exceptionless-test",
            };

            var stream = new MemoryStream(ev.GetBytes(_jsonSerializerSettings).Compress());

            return(await _eventPostService.EnqueueAsync(eventPostInfo, stream).AnyContext());
        }
Пример #3
0
    private Task <string> EnqueueEventPostAsync(List <PersistentEvent> ev)
    {
        var first = ev.First();

        var eventPostInfo = new EventPost(_options.EnableArchive)
        {
            OrganizationId  = first.OrganizationId,
            ProjectId       = first.ProjectId,
            ApiVersion      = 2,
            CharSet         = "utf-8",
            ContentEncoding = "gzip",
            MediaType       = "application/json",
            UserAgent       = "exceptionless-test",
        };

        var stream = new MemoryStream(_serializer.SerializeToBytes(ev).Compress());

        return(_eventPostService.EnqueueAsync(eventPostInfo, stream));
    }