コード例 #1
0
        public override Task<object> CreateFromEventAsync(WebHookDataContext ctx) {
            if (ctx.Version.Major != 2)
                return Task.FromResult<object>(null);

            return Task.FromResult<object>(new WebHookEvent {
                Id = ctx.Event.Id,
                OccurrenceDate = ctx.Event.Date,
                Tags = ctx.Event.Tags,
                Message = ctx.Event.Message,
                Type = ctx.Event.Type,
                Source = ctx.Event.Source,
                ProjectId = ctx.Event.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Event.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                StackId = ctx.Event.StackId,
                StackTitle = ctx.Stack.Title,
                StackDescription = ctx.Stack.Description,
                StackTags = ctx.Stack.Tags,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.IsRegression,
                IsNew = ctx.IsNew
            });
        }
コード例 #2
0
        public override Task<object> CreateFromStackAsync(WebHookDataContext ctx)
        {
            if (ctx.Version.Major != 1)
                return Task.FromResult<object>(null);

              return Task.FromResult<object>(new VersionOneWebHookStack {
                Id = ctx.Stack.Id,
                Title = ctx.Stack.Title,
                Description = ctx.Stack.Description,
                Tags = ctx.Stack.Tags,
                RequestPath = ctx.Stack.SignatureInfo.ContainsKey("Path") ? ctx.Stack.SignatureInfo["Path"] : null,
                Type = ctx.Stack.SignatureInfo.ContainsKey("ExceptionType") ? ctx.Stack.SignatureInfo["ExceptionType"] : null,
                TargetMethod = ctx.Stack.SignatureInfo.ContainsKey("Method") ? ctx.Stack.SignatureInfo["Method"] : null,
                ProjectId = ctx.Stack.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Stack.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.Stack.IsRegressed,
                IsCritical = ctx.Stack.OccurrencesAreCritical || ctx.Stack.Tags != null && ctx.Stack.Tags.Contains("Critical"),
                FixedInVersion = ctx.Stack.FixedInVersion
            });
        }
コード例 #3
0
        public override void Process(EventContext ctx) {
            // if they don't have premium features, then we don't need to queue notifications
            if (!ctx.Organization.HasPremiumFeatures)
                return;

            _notificationQueue.Enqueue(new EventNotification {
                Event = ctx.Event,
                IsNew = ctx.IsNew,
                IsCritical = ctx.Event.IsCritical(),
                IsRegression = ctx.IsRegression,
                //TotalOccurrences = ctx.Stack.TotalOccurrences,
                ProjectName = ctx.Project.Name
            });

            foreach (WebHook hook in _webHookRepository.GetByOrganizationIdOrProjectId(ctx.Event.OrganizationId, ctx.Event.ProjectId)) {
                bool shouldCall = hook.EventTypes.Contains(WebHookRepository.EventTypes.NewError) && ctx.IsNew
                                  || hook.EventTypes.Contains(WebHookRepository.EventTypes.ErrorRegression) && ctx.IsRegression
                                  || hook.EventTypes.Contains(WebHookRepository.EventTypes.CriticalError) && ctx.Event.Tags != null && ctx.Event.Tags.Contains("Critical");

                if (!shouldCall)
                    continue;

                Log.Trace().Project(ctx.Event.ProjectId).Message("Web hook queued: project={0} url={1}", ctx.Event.ProjectId, hook.Url).Write();

                // TODO: Should we be using the hook's project id and organization id?
                var context = new WebHookDataContext(hook.Version, ctx.Event, ctx.Organization, ctx.Project, ctx.Stack, ctx.IsNew, ctx.IsRegression);
                _webHookNotificationQueue.Enqueue(new WebHookNotification {
                    OrganizationId = ctx.Event.OrganizationId,
                    ProjectId = ctx.Event.ProjectId, 
                    Url = hook.Url,
                    Data = _webHookDataPluginManager.CreateFromEvent(context)
                });
            }
        }
コード例 #4
0
        public override object CreateFromEvent(WebHookDataContext ctx)
        {
            if (ctx.Event == null)
                throw new ArgumentException("Event cannot be null.");

            if (ctx.Project == null)
                ctx.Project = _projectRepository.GetById(ctx.Event.ProjectId, true);

            if (ctx.Project == null)
                throw new ArgumentException("Project not found.");

            if (ctx.Organization == null)
                ctx.Organization = _organizationRepository.GetById(ctx.Event.OrganizationId);

            if (ctx.Organization == null)
                throw new ArgumentException("Organization not found.");

            if (ctx.Stack == null)
                ctx.Stack = _stackRepository.GetById(ctx.Event.StackId);

            if (ctx.Stack == null)
                throw new ArgumentException("Stack not found.");

            return null;
        }
コード例 #5
0
        public override async Task <object> CreateFromStackAsync(WebHookDataContext ctx)
        {
            if (ctx.Stack == null)
            {
                throw new ArgumentException("Stack cannot be null.");
            }

            if (ctx.Project == null)
            {
                ctx.Project = await _projectRepository.GetByIdAsync(ctx.Stack.ProjectId, o => o.Cache()).AnyContext();
            }

            if (ctx.Project == null)
            {
                throw new ArgumentException("Project not found.");
            }

            if (ctx.Organization == null)
            {
                ctx.Organization = await _organizationRepository.GetByIdAsync(ctx.Stack.OrganizationId, o => o.Cache()).AnyContext();
            }

            if (ctx.Organization == null)
            {
                throw new ArgumentException("Organization not found.");
            }

            return(null);
        }
コード例 #6
0
ファイル: LoadDefaults.cs プロジェクト: yicong/Exceptionless
        public override object CreateFromStack(WebHookDataContext ctx)
        {
            if (ctx.Stack == null)
            {
                throw new ArgumentException("Stack cannot be null.");
            }

            if (ctx.Project == null)
            {
                ctx.Project = _projectRepository.GetById(ctx.Stack.ProjectId, true);
            }

            if (ctx.Project == null)
            {
                throw new ArgumentException("Project not found.");
            }

            if (ctx.Organization == null)
            {
                ctx.Organization = _organizationRepository.GetById(ctx.Stack.OrganizationId);
            }

            if (ctx.Organization == null)
            {
                throw new ArgumentException("Organization not found.");
            }

            return(null);
        }
コード例 #7
0
        public override Task <object> CreateFromStackAsync(WebHookDataContext ctx)
        {
            if (!String.Equals(ctx.Version, Models.WebHook.KnownVersions.Version1))
            {
                return(Task.FromResult <object>(null));
            }

            return(Task.FromResult <object>(new VersionOneWebHookStack(_options.BaseURL)
            {
                Id = ctx.Stack.Id,
                Status = ctx.Stack.Status,
                Title = ctx.Stack.Title,
                Description = ctx.Stack.Description,
                Tags = ctx.Stack.Tags,
                RequestPath = ctx.Stack.SignatureInfo.ContainsKey("Path") ? ctx.Stack.SignatureInfo["Path"] : null,
                Type = ctx.Stack.SignatureInfo.ContainsKey("ExceptionType") ? ctx.Stack.SignatureInfo["ExceptionType"] : null,
                TargetMethod = ctx.Stack.SignatureInfo.ContainsKey("Method") ? ctx.Stack.SignatureInfo["Method"] : null,
                ProjectId = ctx.Stack.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Stack.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.Stack.Status == StackStatus.Regressed,
                IsCritical = ctx.Stack.OccurrencesAreCritical || ctx.Stack.Tags != null && ctx.Stack.Tags.Contains("Critical"),
                FixedInVersion = ctx.Stack.FixedInVersion
            }));
        }
コード例 #8
0
        public override async Task ProcessAsync(EventContext ctx) {
            // if they don't have premium features, then we don't need to queue notifications
            if (!ctx.Organization.HasPremiumFeatures)
                return;

            if (ShouldQueueNotification(ctx))
                await _notificationQueue.EnqueueAsync(new EventNotificationWorkItem {
                    EventId = ctx.Event.Id,
                    IsNew = ctx.IsNew,
                    IsCritical = ctx.Event.IsCritical(),
                    IsRegression = ctx.IsRegression,
                    TotalOccurrences = ctx.Stack.TotalOccurrences,
                    ProjectName = ctx.Project.Name
                }).AnyContext();

            foreach (WebHook hook in (await _webHookRepository.GetByOrganizationIdOrProjectIdAsync(ctx.Event.OrganizationId, ctx.Event.ProjectId).AnyContext()).Documents) {
                if (!ShouldCallWebHook(hook, ctx))
                    continue;

                var context = new WebHookDataContext(hook.Version, ctx.Event, ctx.Organization, ctx.Project, ctx.Stack, ctx.IsNew, ctx.IsRegression);
                var notification = new WebHookNotification {
                    OrganizationId = ctx.Event.OrganizationId,
                    ProjectId = ctx.Event.ProjectId,
                    Url = hook.Url,
                    Data = await _webHookDataPluginManager.CreateFromEventAsync(context).AnyContext()
                };

                await _webHookNotificationQueue.EnqueueAsync(notification).AnyContext();
                Logger.Trace().Project(ctx.Event.ProjectId).Message("Web hook queued: project={0} url={1}", ctx.Event.ProjectId, hook.Url).Property("Web Hook Notification", notification).Write();
            }
        }
コード例 #9
0
        public override object CreateFromStack(WebHookDataContext ctx)
        {
            if (ctx.Version.Major != 1)
            {
                return(null);
            }

            return(new VersionOneWebHookStack {
                Id = ctx.Stack.Id,
                Title = ctx.Stack.Title,
                Description = ctx.Stack.Description,
                Tags = ctx.Stack.Tags,
                RequestPath = ctx.Stack.SignatureInfo.ContainsKey("Path") ? ctx.Stack.SignatureInfo["Path"] : null,
                Type = ctx.Stack.SignatureInfo.ContainsKey("ExceptionType") ? ctx.Stack.SignatureInfo["ExceptionType"] : null,
                TargetMethod = ctx.Stack.SignatureInfo.ContainsKey("Method") ? ctx.Stack.SignatureInfo["Method"] : null,
                ProjectId = ctx.Stack.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Stack.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.Stack.IsRegressed,
                IsCritical = ctx.Stack.OccurrencesAreCritical || ctx.Stack.Tags != null && ctx.Stack.Tags.Contains("Critical"),
                FixedInVersion = ctx.Stack.FixedInVersion
            });
        }
コード例 #10
0
        public override Task <object> CreateFromEventAsync(WebHookDataContext ctx)
        {
            if (ctx.Version.Major != 2)
            {
                return(Task.FromResult <object>(null));
            }

            return(Task.FromResult <object>(new WebHookEvent {
                Id = ctx.Event.Id,
                OccurrenceDate = ctx.Event.Date,
                Tags = ctx.Event.Tags,
                Message = ctx.Event.Message,
                Type = ctx.Event.Type,
                Source = ctx.Event.Source,
                ProjectId = ctx.Event.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Event.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                StackId = ctx.Event.StackId,
                StackTitle = ctx.Stack.Title,
                StackDescription = ctx.Stack.Description,
                StackTags = ctx.Stack.Tags,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.IsRegression,
                IsNew = ctx.IsNew
            }));
        }
コード例 #11
0
        public override Task <object> CreateFromEventAsync(WebHookDataContext ctx)
        {
            if (!String.Equals(ctx.Version, Models.WebHook.KnownVersions.Version1))
            {
                return(Task.FromResult <object>(null));
            }

            var error = ctx.Event.GetError();

            if (error == null)
            {
                return(Task.FromResult <object>(null));
            }

            var requestInfo     = ctx.Event.GetRequestInfo();
            var environmentInfo = ctx.Event.GetEnvironmentInfo();

            return(Task.FromResult <object>(new VersionOneWebHookEvent(_options.BaseURL)
            {
                Id = ctx.Event.Id,
                OccurrenceDate = ctx.Event.Date,
                Tags = ctx.Event.Tags,
                MachineName = environmentInfo?.MachineName,
                RequestPath = requestInfo?.GetFullPath(),
                IpAddress = requestInfo != null ? requestInfo.ClientIpAddress : environmentInfo?.IpAddress,
                Message = error.Message,
                Type = error.Type,
                Code = error.Code,
                TargetMethod = error.TargetMethod?.GetFullName(),
                ProjectId = ctx.Event.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Event.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                ErrorStackId = ctx.Event.StackId,
                ErrorStackStatus = ctx.Stack.Status,
                ErrorStackTitle = ctx.Stack.Title,
                ErrorStackDescription = ctx.Stack.Description,
                ErrorStackTags = ctx.Stack.Tags,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.IsRegression,
                IsNew = ctx.IsNew
            }));
        }
コード例 #12
0
        public override async Task<object> CreateFromStackAsync(WebHookDataContext ctx) {
            if (ctx.Stack == null)
                throw new ArgumentException("Stack cannot be null.");

            if (ctx.Project == null)
                ctx.Project = await _projectRepository.GetByIdAsync(ctx.Stack.ProjectId, true).AnyContext();

            if (ctx.Project == null)
                throw new ArgumentException("Project not found.");

            if (ctx.Organization == null)
                ctx.Organization = await _organizationRepository.GetByIdAsync(ctx.Stack.OrganizationId).AnyContext();

            if (ctx.Organization == null)
                throw new ArgumentException("Organization not found.");

            return null;
        }
コード例 #13
0
        public override object CreateFromEvent(WebHookDataContext ctx)
        {
            if (ctx.Version.Major != 1)
            {
                return(null);
            }

            var error = ctx.Event.GetError();

            if (error == null)
            {
                return(null);
            }

            var requestInfo     = ctx.Event.GetRequestInfo();
            var environmentInfo = ctx.Event.GetEnvironmentInfo();

            return(new VersionOneWebHookEvent {
                Id = ctx.Event.Id,
                OccurrenceDate = ctx.Event.Date,
                Tags = ctx.Event.Tags,
                MachineName = environmentInfo != null ? environmentInfo.MachineName : null,
                RequestPath = requestInfo != null?requestInfo.GetFullPath() : null,
                                  IpAddress = requestInfo != null ? requestInfo.ClientIpAddress : environmentInfo != null ? environmentInfo.IpAddress : null,
                                  Message = error.Message,
                                  Type = error.Type,
                                  Code = error.Code,
                                  TargetMethod = error.TargetMethod != null?error.TargetMethod.GetFullName() : null,
                                                     ProjectId = ctx.Event.ProjectId,
                                                     ProjectName = ctx.Project.Name,
                                                     OrganizationId = ctx.Event.OrganizationId,
                                                     OrganizationName = ctx.Organization.Name,
                                                     ErrorStackId = ctx.Event.StackId,
                                                     ErrorStackTitle = ctx.Stack.Title,
                                                     ErrorStackDescription = ctx.Stack.Description,
                                                     ErrorStackTags = ctx.Stack.Tags,
                                                     TotalOccurrences = ctx.Stack.TotalOccurrences,
                                                     FirstOccurrence = ctx.Stack.FirstOccurrence,
                                                     LastOccurrence = ctx.Stack.LastOccurrence,
                                                     DateFixed = ctx.Stack.DateFixed,
                                                     IsRegression = ctx.IsRegression,
                                                     IsNew = ctx.IsNew
            });
        }
コード例 #14
0
        /// <summary>
        /// Runs all of the event plugins create method.
        /// </summary>
        public object CreateFromStack(WebHookDataContext context)
        {
            foreach (var plugin in Plugins.Values)
            {
                try {
                    var data = plugin.CreateFromStack(context);
                    if (data == null)
                    {
                        continue;
                    }

                    return(data);
                } catch (Exception ex) {
                    Log.Error().Exception(ex).Message("Error calling create from stack in plugin \"{0}\": {1}", plugin.GetType().FullName, ex.Message).Write();
                }
            }

            return(null);
        }
コード例 #15
0
        private WebHookDataContext GetWebHookDataContext(Version version) {
            var json = File.ReadAllText(Path.GetFullPath(@"..\..\ErrorData\1477.expected.json"));

            var settings = IoC.GetInstance<JsonSerializerSettings>();
            settings.Formatting = Formatting.Indented;

            var ev = JsonConvert.DeserializeObject<PersistentEvent>(json, settings);
            ev.OrganizationId = TestConstants.OrganizationId;
            ev.ProjectId = TestConstants.ProjectId;
            ev.StackId = TestConstants.StackId;
            ev.Id = TestConstants.EventId;

            var context = new WebHookDataContext(version, ev, OrganizationData.GenerateSampleOrganization(), ProjectData.GenerateSampleProject());
            context.Stack = StackData.GenerateStack(id: TestConstants.StackId, organizationId: TestConstants.OrganizationId, projectId: TestConstants.ProjectId, title: _formattingPluginManager.GetStackTitle(ev), signatureHash: "722e7afd4dca4a3c91f4d94fec89dfdc");
            context.Stack.Tags = new TagSet { "Test" };
            context.Stack.FirstOccurrence = context.Stack.LastOccurrence = ev.Date.DateTime;

            return context;
        }
コード例 #16
0
        /// <summary>
        /// Runs all of the event plugins create method.
        /// </summary>
        public async Task <object> CreateFromStackAsync(WebHookDataContext context)
        {
            foreach (var plugin in Plugins.Values)
            {
                try {
                    var data = await plugin.CreateFromStackAsync(context).AnyContext();

                    if (data == null)
                    {
                        continue;
                    }

                    return(data);
                } catch (Exception ex) {
                    Logger.Error().Exception(ex).Message("Error calling create from stack in plugin \"{0}\": {1}", plugin.GetType().FullName, ex.Message).Property("Stack", context.Stack).Write();
                }
            }

            return(null);
        }
コード例 #17
0
        private WebHookDataContext GetWebHookDataContext(Version version) {
            var json = File.ReadAllText(Path.GetFullPath(@"..\..\ErrorData\1477.expected.json"));

            var settings = new JsonSerializerSettings {
                MissingMemberHandling = MissingMemberHandling.Ignore,
                ContractResolver = new ExtensionContractResolver()
            };

            var ev = JsonConvert.DeserializeObject<PersistentEvent>(json, settings);
            ev.Id = TestConstants.EventId;
            ev.OrganizationId = TestConstants.OrganizationId;
            ev.ProjectId = TestConstants.ProjectId;
            ev.StackId = TestConstants.StackId;

            var context = new WebHookDataContext(version, ev, OrganizationData.GenerateSampleOrganization(), ProjectData.GenerateSampleProject());
            context.Stack = StackData.GenerateStack(id: TestConstants.StackId, organizationId: TestConstants.OrganizationId, projectId: TestConstants.ProjectId, title: ev.Message, signatureHash: "722e7afd4dca4a3c91f4d94fec89dfdc");
            context.Stack.Tags = new TagSet { "Test" };
            context.Stack.FirstOccurrence = context.Stack.LastOccurrence = ev.Date.DateTime;

            return context;
        }
コード例 #18
0
        public override async Task <object> CreateFromEventAsync(WebHookDataContext ctx)
        {
            if (ctx.Event == null)
            {
                throw new ArgumentException("Event cannot be null.");
            }

            if (ctx.Project == null)
            {
                ctx.Project = await _projectRepository.GetByIdAsync(ctx.Event.ProjectId, true).AnyContext();
            }

            if (ctx.Project == null)
            {
                throw new ArgumentException("Project not found.");
            }

            if (ctx.Organization == null)
            {
                ctx.Organization = await _organizationRepository.GetByIdAsync(ctx.Event.OrganizationId, true).AnyContext();
            }

            if (ctx.Organization == null)
            {
                throw new ArgumentException("Organization not found.");
            }

            if (ctx.Stack == null)
            {
                ctx.Stack = await _stackRepository.GetByIdAsync(ctx.Event.StackId).AnyContext();
            }

            if (ctx.Stack == null)
            {
                throw new ArgumentException("Stack not found.");
            }

            return(null);
        }
コード例 #19
0
        public override Task<object> CreateFromEventAsync(WebHookDataContext ctx)
        {
            if (ctx.Version.Major != 1)
                return Task.FromResult<object>(null);

            var error = ctx.Event.GetError();
            if (error == null)
                return Task.FromResult<object>(null);

            var requestInfo = ctx.Event.GetRequestInfo();
            var environmentInfo = ctx.Event.GetEnvironmentInfo();

            return Task.FromResult<object>(new VersionOneWebHookEvent {
                Id = ctx.Event.Id,
                OccurrenceDate = ctx.Event.Date,
                Tags = ctx.Event.Tags,
                MachineName = environmentInfo?.MachineName,
                RequestPath = requestInfo?.GetFullPath(),
                IpAddress = requestInfo != null ? requestInfo.ClientIpAddress : environmentInfo?.IpAddress,
                Message = error.Message,
                Type = error.Type,
                Code = error.Code,
                TargetMethod = error.TargetMethod?.GetFullName(),
                ProjectId = ctx.Event.ProjectId,
                ProjectName = ctx.Project.Name,
                OrganizationId = ctx.Event.OrganizationId,
                OrganizationName = ctx.Organization.Name,
                ErrorStackId = ctx.Event.StackId,
                ErrorStackTitle = ctx.Stack.Title,
                ErrorStackDescription = ctx.Stack.Description,
                ErrorStackTags = ctx.Stack.Tags,
                TotalOccurrences = ctx.Stack.TotalOccurrences,
                FirstOccurrence = ctx.Stack.FirstOccurrence,
                LastOccurrence = ctx.Stack.LastOccurrence,
                DateFixed = ctx.Stack.DateFixed,
                IsRegression = ctx.IsRegression,
                IsNew = ctx.IsNew
            });
        }
コード例 #20
0
        /// <summary>
        /// Runs all of the event plugins create method.
        /// </summary>
        public async Task <object> CreateFromStackAsync(WebHookDataContext context)
        {
            string metricPrefix = String.Concat(_metricPrefix, nameof(CreateFromStackAsync).ToLower(), ".");

            foreach (var plugin in Plugins.Values)
            {
                string metricName = String.Concat(metricPrefix, plugin.Name.ToLower());
                try {
                    object data = null;
                    await _metricsClient.TimeAsync(async() => data = await plugin.CreateFromStackAsync(context).AnyContext(), metricName).AnyContext();

                    if (data == null)
                    {
                        continue;
                    }

                    return(data);
                } catch (Exception ex) {
                    _logger.LogError(ex, "Error calling create from stack {stack} in plugin {PluginName}: {Message}", context.Stack.Id, plugin.Name, ex.Message);
                }
            }

            return(null);
        }
コード例 #21
0
        /// <summary>
        /// Runs all of the event plugins create method.
        /// </summary>
        public async Task <object> CreateFromStackAsync(WebHookDataContext context)
        {
            string metricPrefix = String.Concat(_metricPrefix, nameof(CreateFromStackAsync).ToLower(), ".");

            foreach (var plugin in Plugins.Values)
            {
                string metricName = String.Concat(metricPrefix, plugin.GetType().Name.ToLower());
                try {
                    object data = null;
                    await _metricsClient.TimeAsync(async() => data = await plugin.CreateFromStackAsync(context).AnyContext(), metricName).AnyContext();

                    if (data == null)
                    {
                        continue;
                    }

                    return(data);
                } catch (Exception ex) {
                    _logger.Error().Exception(ex).Message("Error calling create from stack in plugin \"{0}\": {1}", plugin.GetType().FullName, ex.Message).Property("Stack", context.Stack).Write();
                }
            }

            return(null);
        }
コード例 #22
0
 public abstract object CreateFromEvent(WebHookDataContext ctx);
コード例 #23
0
 public abstract object CreateFromStack(WebHookDataContext ctx);
コード例 #24
0
 public abstract object CreateFromEvent(WebHookDataContext ctx);
コード例 #25
0
 public abstract Task <object> CreateFromStackAsync(WebHookDataContext ctx);
コード例 #26
0
 public abstract object CreateFromStack(WebHookDataContext ctx);
コード例 #27
0
 public abstract Task<object> CreateFromStackAsync(WebHookDataContext ctx);