private void ExtractTagsFromCollections(ReportAddedToIncident e, TagIdentifierContext ctx) { foreach (var collection in e.Report.ContextCollections) { string tagsStr; if (!collection.Properties.TryGetValue("OneTrueTags", out tagsStr)) { continue; } try { var tags = tagsStr.Split(','); foreach (var tag in tags) { ctx.AddTag(tag, 1); } } catch (Exception ex) { _logger.Error( "Failed to parse tags from '" + collection.Name + "', invalid tag string: '" + tagsStr + "'.", ex); } } }
/// <summary> /// Process an event asynchronously. /// </summary> /// <param name="e">event to process</param> /// <returns> /// Task to wait on. /// </returns> public async Task HandleAsync(ReportAddedToIncident e) { if (e.Incident.ReportCount != 1) { var tags = await _repository.GetTagsAsync(e.Incident.Id); if (tags.Count > 0) { return; } } _logger.Debug("Checking tags.."); var ctx = new TagIdentifierContext(e.Report); var identifierProvider = new IdentifierProvider(); var identifiers = identifierProvider.GetIdentifiers(ctx); foreach (var identifier in identifiers) { identifier.Identify(ctx); } ExtractTagsFromCollections(e, ctx); _logger.Debug("done.."); await _repository.AddAsync(e.Incident.Id, ctx.Tags.ToArray()); }
private void ExtractTagsFromCollections(ReportAddedToIncident e, TagIdentifierContext ctx) { foreach (var collection in e.Report.ContextCollections) { // Comma seperated tags if (collection.Properties.TryGetValue("OneTrueTags", out var tagsStr) && collection.Properties.TryGetValue("ErrTags", out tagsStr)) { try { var tags = tagsStr.Split(','); foreach (var tag in tags) { ctx.AddTag(tag, 1); } } catch (Exception ex) { _logger.Error( "Failed to parse tags from '" + collection.Name + "', invalid tag string: '" + tagsStr + "'.", ex); } } //Tag array foreach (var property in collection.Properties) { if (property.Key.StartsWith("ErrTags[")) { ctx.AddTag(property.Value, 1); } } } }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.Windows.Forms", "winforms"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("Newtonsoft.Json", "json.net"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.Data", "ado.net"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("MarkdownSharp", "MarkdownSharp"); }
public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.ServiceModel", "wcf"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.Linq.Enumerable", "linq"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.Runtime.Serialization", "datacontractserializer"); context.AddIfFound("System.Runtime.Serialization.XmlObjectSerializer", "xml-serialization"); context.AddIfFound("System.Runtime.Serialization.XmlObjectSerializer.WriteObject", "xml-serialization"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.Data.SqlClient", "sql-server"); //TODO: Can we identify the version in some way? }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } if (context.IsFound("System.Windows.Forms")) { return; } context.AddIfFound("Program.Main(String[] args)", "console-application"); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } var propertyValue = context.GetPropertyValue("ExceptionProperties", "Message"); if (propertyValue != null && propertyValue.Contains(".cshtml")) { context.AddTag("razor", 0); } }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("FluentNHibernate", "fluent-nhibernate"); context.AddIfFound("FluentNHibernate.Mapping", "fluent-nhibernate-mapping"); context.AddIfFound("NHibernate.", "nhibernate"); context.AddIfFound("NHibernate.Criterion", "nhibernate-criteria"); context.AddIfFound("NHibernate.Linq", "linq-to-nhibernate"); context.AddIfFound("NHibernate.Mapping.", "nhibernate-mapping"); //linq-to-nhibernate }
/// <inheritdoc /> public void Identify(TagIdentifierContext context) { var name = GetVersionAssemblyName(context.ApplicationId); if (name == null) { return; } var version = context.GetPropertyValue("Assemblies", name); if (version != null) { context.AddTag("v" + version, 1); } }
public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } var property = context.GetPropertyValue("Assembly", "Microsoft.CSharp"); if (property == null) { return; } context.AddTag("c#", 99); var pos = property.IndexOf("."); if (pos != -1) { context.AddTag("c#-" + property.Substring(pos + 1, 3), 99); } }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } context.AddIfFound("System.Web", "http"); var orderNumber = context.AddIfFound("System.Web.Mvc", "asp.net-mvc"); if (orderNumber != -1) { var propertyValue = context.GetPropertyValue("Assemblies", "System.Web.Mvc"); if (!string.IsNullOrEmpty(propertyValue)) { var version = propertyValue.Substring(0, 1); if (version != "0" && version != "1") { context.AddTag("asp.net-mvc-" + version, orderNumber); } } context.AddTag("asp.net", 99); } orderNumber = context.AddIfFound("System.Web.Http.WebHost", "asp.net-web-api"); if (orderNumber != -1) { var propertyValue = context.GetPropertyValue("Assemblies", "System.Web.Http.WebHost"); if (!string.IsNullOrEmpty(propertyValue)) { var version = propertyValue.Substring(0, 1); context.AddTag("asp.net-web-api-" + version, orderNumber); } context.AddTag("asp.net", 99); } }
/// <summary> /// Process an event asynchronously. /// </summary> /// <param name="e">event to process</param> /// <returns> /// Task to wait on. /// </returns> public async Task HandleAsync(IMessageContext context, ReportAddedToIncident e) { _logger.Debug("Checking tags.."); var tags = await _repository.GetIncidentTagsAsync(e.Incident.Id); var ctx = new TagIdentifierContext(e.Report, tags); var identifiers = _tagIdentifierProvider.GetIdentifiers(ctx); foreach (var identifier in identifiers) { identifier.Identify(ctx); } ExtractTagsFromCollections(e, ctx); _logger.DebugFormat("Done, identified {0} new tags", ctx.NewTags); if (ctx.NewTags.Count == 0) { return; } await _repository.AddAsync(e.Incident.Id, ctx.NewTags.ToArray()); }
/// <summary> /// Check if the wanted tag is supported. /// </summary> /// <param name="context">Error context providing information to search through</param> public void Identify(TagIdentifierContext context) { if (context == null) { throw new ArgumentNullException("context"); } var orderNumber = context.AddIfFound("EntityFramework", "entity-framework"); if (orderNumber != -1) { var propertyValue = context.GetPropertyValue("Assemblies", "entity-framework"); if (!string.IsNullOrEmpty(propertyValue)) { context.AddTag("entity-framework-" + propertyValue.Substring(0, 1), orderNumber); } } var property2 = context.GetPropertyValue("Assemblies", "EntityFramework.SqlServer"); if (property2 != null) { context.AddTag("sqlserver", 99); } }