public override object GetData(ITabContext context) { var timelineMessages = context.GetMessages<ITimelineMessage>() .Where(m => m.EventName.StartsWith("WAZStorage:")).Cast<WindowsAzureStorageTimelineMessage>(); var model = new StorageModel(); if (timelineMessages != null) { model.Statistics.TotalStorageTx = timelineMessages.Count(); model.Statistics.TotalBlobTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Blob")); model.Statistics.TotalTableTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Table")); model.Statistics.TotalQueueTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Queue")); model.Statistics.TotalTrafficToStorage = timelineMessages.Sum(m => m.RequestSize).ToBytesHuman(); model.Statistics.TotalTrafficFromStorage = timelineMessages.Sum(m => m.ResponseSize).ToBytesHuman(); model.Statistics.PricePerTenThousandPageViews = string.Format("${0}", model.Statistics.TotalStorageTx * 1000 * 0.0000001 + timelineMessages.Sum(m => m.ResponseSize) * 10000 * (0.12 / 1024 / 1024 / 1024)); model.Requests = FlattenRequests(timelineMessages); model.Warnings = AnalyzeMessagesForWarnings(timelineMessages); return model; } return "No storage transactions have been utilized for this request."; }
public override object GetData(ITabContext context) { var items = new List<object>(); var cacheEnumerator = HttpRuntime.Cache.GetEnumerator(); while (cacheEnumerator.MoveNext()) { var key = cacheEnumerator.Key.ToString(); // if more properties want to be displayed in the future, here's a list of properties available // Value - UtcCreated - State - UtcExpires - SlidingExpiration - ExpiresBucket - ExpiresEntryRef // UsageBucket - UsageEntryRef - UtcLastUsageUpdate - Dependency - Key - IsOutputCache - IsPublic items.Add(new { Key = key, Value = Serialization.GetValueSafe(cacheEnumerator.Value), Created = GetCacheItemProperty(key, "UtcCreated"), Expiry = GetCacheItemProperty(key, "UtcExpires"), SlidingExpiration = GetCacheItemProperty(key, "SlidingExpiration") }); } return new { Settings = new { PhysicalMemoryLimit = HttpRuntime.Cache.EffectivePercentagePhysicalMemoryLimit, PrivateBytesLimit = HttpRuntime.Cache.EffectivePrivateBytesLimit, }, Items = items }; }
public override object GetData(ITabContext context) { var plugin = Plugin.Create("#", "Function", "Param"); List <Type[]> typeList = new List <Type[]>(); try { var types = from assembly in AppDomain.CurrentDomain.GetAssemblies() from type in assembly.GetTypes() where type.IsSubclassOf(typeof(System.Web.WebPages.HelperPage)) select type; foreach (var type in types) { if (type.Name != "WebGridRenderer") { foreach (var item in UmbracoFn.showMethodsList(type).Where(t => t.TypeName == "System.Web.WebPages.HelperResult")) { plugin.AddRow().Column("@" + type.Name).Column(item.FunctionName).Column(item.param); } } } return(plugin); } catch (Exception ex) { plugin.AddRow().Column(ex.ToString()); } return(plugin); }
public override object GetData(ITabContext context) { var getInvocationsRequest = new GetInvocationsRequest(); var getInvocationsResult = _getInvocationsHandler.Handle(getInvocationsRequest); var data = FormatInvocations(getInvocationsResult.Invocations); return data; }
public override object GetData(ITabContext context) { try { var sitecoreData = _sitecoreRequest.GetData(); if (!sitecoreData.HasData()) return null; var itemSummary = new ItemSummary(sitecoreData).Create(); if (string.IsNullOrEmpty(itemSummary)) return null; var plugin = Plugin.Create("Item", itemSummary); var itemSection = new ItemSection(sitecoreData).Create(); var contextSection = new ContextSection(sitecoreData).Create(); var serverSection = new ServerSection(sitecoreData).Create(); if (itemSection != null) plugin.AddRow().Column("Item").Column(itemSection).Selected(); if (contextSection != null) plugin.AddRow().Column("Context").Column(contextSection).Quiet(); if (serverSection != null) plugin.AddRow().Column("Server").Column(serverSection); return plugin; } catch (Exception ex) { return new { Exception = ex }; } }
public override object GetData(ITabContext context) { var plugin = Plugin.Create("Function", "Param", "Type"); try { string url = System.Web.HttpContext.Current.Request.Url.AbsoluteUri; int NodeId = -1; if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request["glimpse7GetMediaById"])) { Int32.TryParse(System.Web.HttpContext.Current.Request["glimpse7GetMediaById"], out NodeId); } if (NodeId > 0) { dynamic mediaItem = new DynamicMedia(NodeId); return(UmbracoFn.showMethodsValue(mediaItem, "media")); } else { return(UmbracoFn.showMethods(typeof(DynamicMedia))); } } catch (Exception ex) { plugin.AddRow().Column(ex.ToString()); } return(plugin); }
public void HandleNullFindViewMessageCollection(Metadata sut, ITabContext context) { context.TabStore.Setup(ds => ds.Get(typeof(ViewEngine.FindViews.Message).FullName)).Returns<List<ViewEngine.FindViews.Message>>(null); context.TabStore.Setup(ds => ds.Get(typeof(View.Render.Message).FullName)).Returns(new List<View.Render.Message>()); Assert.DoesNotThrow(() => sut.GetData(context)); }
public void HandleNullFindViewMessageCollection(Metadata sut, ITabContext context) { context.TabStore.Setup(ds => ds.Get(typeof(ViewEngine.FindViews.Message).FullName)).Returns <List <ViewEngine.FindViews.Message> >(null); context.TabStore.Setup(ds => ds.Get(typeof(View.Render.Message).FullName)).Returns(new List <View.Render.Message>()); Assert.DoesNotThrow(() => sut.GetData(context)); }
public void HandleNullViewRenderMessageCollection(Views sut, ITabContext context) { context.TabStore.Setup(ds => ds.Get(typeof(IList<ViewEngine.FindViews.Message>).AssemblyQualifiedName)).Returns(new List<ViewEngine.FindViews.Message>()); context.TabStore.Setup(ds => ds.Get(typeof(IList<View.Render.Message>).AssemblyQualifiedName)).Returns<List<View.Render.Message>>(null); Assert.DoesNotThrow(() => sut.GetData(context)); }
public override object GetData(ITabContext context) { var cacheModel = new CacheModel(); cacheModel.Configuration.EffectivePercentagePhysicalMemoryLimit = HttpRuntime.Cache.EffectivePercentagePhysicalMemoryLimit; cacheModel.Configuration.EffectivePrivateBytesLimit = HttpRuntime.Cache.EffectivePrivateBytesLimit; var list = HttpRuntime.Cache.Cast<DictionaryEntry>().ToList(); foreach (var item in list) { try { var cacheEntry = MethodInfoCacheGet.Invoke(HttpRuntime.Cache, new object[] { item.Key, 1 }); var cacheItemModel = new CacheItemModel(); cacheItemModel.Key = item.Key.ToString(); cacheItemModel.Value = Serialization.GetValueSafe(item.Value); cacheItemModel.CreatedOn = GetCacheProperty(ProcessInfoUtcCreated, cacheEntry) as DateTime?; cacheItemModel.ExpiresOn = GetCacheProperty(ProcessInfoUtcExpires, cacheEntry) as DateTime?; cacheItemModel.SlidingExpiration = GetCacheProperty(ProcessInfoSlidingExpiration, cacheEntry) as TimeSpan?; cacheModel.CacheItems.Add(cacheItemModel); } catch (Exception) { return false; } } return cacheModel; }
public override object GetData(ITabContext context) { return(new { MessageQueues = MessageQueue.GetQueueStats() }); }
public override object GetData(ITabContext context) { TabSection plugin = Plugin.Create("No", "Started", "Duration", "Method", "Index", "Document", "Query"); var requestContext = context.GetRequestContext<HttpContextBase>(); List<RequestItem> items = RequestHandler.GetLogList(requestContext); if (items ==null|| !items.Any()) return null; int count = 0; foreach (RequestItem item in items) { plugin.AddRow() .Column(count++) .Column(String.Format("{0:#,0}", item.Time.Subtract(requestContext.Timestamp).TotalMilliseconds)) .Column(item.Duration.HasValue ? String.Format("{0:#,0}", item.Duration.Value.TotalMilliseconds) : null) .Column(item.Method) .Column(item.Index) .Column(item.Document) .Column(item.Query); } return plugin; }
/// <summary> /// Gets the data. /// </summary> /// <param name="context">The context.</param> /// <returns>Web transation datas.</returns> public override object GetData(ITabContext context) { HttpContextBase httpContext = new HttpContextWrapper(HttpContext.Current); TransactionInstance transactionInstance = TransactionInstance.GetInstance(httpContext); return(transactionInstance.Description); }
public override object GetData(ITabContext context) { var plugin = Plugin.Create("No", "Started", "Duration", "Command", "Parameters"); var requestContext = context.GetRequestContext<HttpContextBase>(); List<LogItem> items = LogItemHandler.GetLogList(requestContext); if (items == null) return plugin; var count = 0; foreach (var item in items) { plugin.AddRow() .Column(count++) .Column(String.Format("{0:#,0}", item.Time.Subtract(requestContext.Timestamp).TotalMilliseconds)) .Column(item.Duration.HasValue ? String.Format("{0:#,0}", item.Duration.Value.TotalMilliseconds) : null) .Column(item.Command) .Column(item.Params.Count > 0 ? new[] { new object[] { "Name", "Type", "Value" } }.Concat(item.Params.Select(p => new object[] { p.Name, p.Type, p.Value, })) : null); } return plugin; }
public override object GetData(ITabContext context) { var httpContext = context.GetHttpContext(); var serverModel = new ServerModel(httpContext); return(serverModel); }
public override object GetData(ITabContext context) { var args = new GlimpsePipelineArgs <TDataModel>(); CorePipeline.Run(this.DataPipelineName, args); return(args.TabData); }
public void MatchConstraintMessageToRoute(Routes tab, ITabContext context, System.Web.Routing.IRouteConstraint constraint) { var route = new System.Web.Routing.Route("url", new System.Web.Routing.RouteValueDictionary { { "Test", "Other" } }, new System.Web.Routing.RouteValueDictionary { { "Test", constraint } }, new System.Web.Routing.RouteValueDictionary { { "Data", "Tokens" } }, new System.Web.Routing.PageRouteHandler("~/Path")); System.Web.Routing.RouteTable.Routes.Clear(); System.Web.Routing.RouteTable.Routes.Add(route); var routeMessage = new RouteBase.GetRouteData.Message(route.GetHashCode(), new System.Web.Routing.RouteData(), "routeName") .AsSourceMessage(route.GetType(), null) .AsTimedMessage(new TimerResult { Duration = TimeSpan.FromMilliseconds(19) }); var constraintMessage = new RouteBase.ProcessConstraint.Message(new RouteBase.ProcessConstraint.Arguments(new object[] { (HttpContextBase)null, constraint, "test", (System.Web.Routing.RouteValueDictionary)null, System.Web.Routing.RouteDirection.IncomingRequest }), route.GetHashCode(), true) .AsTimedMessage(new TimerResult { Duration = TimeSpan.FromMilliseconds(25) }) .AsSourceMessage(route.GetType(), null); context.TabStore.Setup(mb => mb.Contains(typeof(IList<RouteBase.ProcessConstraint.Message>).AssemblyQualifiedName)).Returns(true).Verifiable(); context.TabStore.Setup(mb => mb.Contains(typeof(IList<RouteBase.GetRouteData.Message>).AssemblyQualifiedName)).Returns(true).Verifiable(); context.TabStore.Setup(mb => mb.Get(typeof(IList<RouteBase.ProcessConstraint.Message>).AssemblyQualifiedName)).Returns(new List<RouteBase.ProcessConstraint.Message> { constraintMessage }).Verifiable(); context.TabStore.Setup(mb => mb.Get(typeof(IList<RouteBase.GetRouteData.Message>).AssemblyQualifiedName)).Returns(new List<RouteBase.GetRouteData.Message> { routeMessage }).Verifiable(); var model = tab.GetData(context) as List<RouteModel>; var itemModel = model[0]; Assert.NotNull(model); Assert.Equal(1, model.Count); Assert.NotNull(itemModel.Constraints); Assert.True(itemModel.IsMatch); Assert.Equal("Test", ((List<RouteConstraintModel>)itemModel.Constraints)[0].ParameterName); Assert.Equal(true, ((List<RouteConstraintModel>)itemModel.Constraints)[0].IsMatch); Assert.NotNull(itemModel.DataTokens); Assert.Equal("Tokens", itemModel.DataTokens["Data"]); Assert.NotNull(itemModel.RouteData); Assert.Equal("Other", ((List<RouteDataItemModel>)itemModel.RouteData)[0].DefaultValue); }
public override object GetData(ITabContext context) { TabSection plugin = Plugin.Create("No", "Started", "Duration", "Method", "Index", "Document", "Endpoint", "Query"); var requestContext = context.GetRequestContext <HttpContextBase>(); List <RequestItem> items = RequestHandler.GetLogList(requestContext); if (items == null || !items.Any()) { return(null); } int count = 0; foreach (RequestItem item in items) { plugin.AddRow() .Column(count++) .Column(String.Format("{0:#,0}", item.Time.Subtract(requestContext.Timestamp).TotalMilliseconds)) .Column(item.Duration.HasValue ? String.Format("{0:#,0}", item.Duration.Value.TotalMilliseconds) : null) .Column(item.Method) .Column(item.Index) .Column(item.Document) .Column(item.Endpoint) .Column(item.Query); } return(plugin); }
public override object GetData(ITabContext context) { var requestContext = context.GetHttpContext(); var session = requestContext.Session; if (session == null || session.Count == 0) { return(null); } var result = new List <SessionModel>(session.Count); foreach (var sessionKey in session.Keys) { var key = sessionKey.ToString(); var value = session[key]; var type = value != null?value.GetType() : null; result.Add(new SessionModel { Key = key, Type = type, Value = value }); } return(result); }
public object GetData(ITabContext context) { var messages = context.GetMessages <AdoMessage>().ToList(); var aggregator = new MessageAggregator(messages); var queryData = aggregator.Aggregate(); var queryCount = queryData.Commands.Count; var connectionCount = queryData.Connections.Count; var transactionCount = queryData.Transactions.Count; var queryExecutionTime = new TimeSpan(); var connectionOpenTime = new TimeSpan(); foreach (var command in queryData.Commands) { var commandMetadata = command.Value; queryExecutionTime += commandMetadata.Duration; } foreach (var connection in queryData.Connections) { var connectionMetadata = connection.Value; connectionOpenTime += connectionMetadata.Duration.GetValueOrDefault(TimeSpan.Zero); } return(new { queryCount, connectionCount, transactionCount, queryExecutionTime, connectionOpenTime }); }
public override object GetData(ITabContext context) { var plugin = Plugin.Create("Level", "Timestamp", "Message", "Properties"); foreach (var item in context.GetMessages <LogEventItem>()) { var properties = item.LogEvent.Properties .Select(pv => new { Name = pv.Key, Value = GlimpsePropertyFormatter.Simplify(pv.Value) }) .ToList(); if (item.LogEvent.Exception != null) { properties.Add(new { Name = "Exception", Value = (object)item.LogEvent.Exception }); } properties = properties.OrderBy(p => p.Name).ToList(); var row = plugin.AddRow(); row.Column(item.LogEvent.Level.ToString()); row.Column(item.LogEvent.Timestamp.ToString("HH:mm:ss.fff", item.FormatProvider)); row.Column(item.LogEvent.RenderMessage(item.FormatProvider)).Strong(); row.Column(properties); ApplyRowLevelStyle(item.LogEvent.Level, row); } return(plugin); }
public override object GetData(ITabContext context) { var timelineMessages = context.GetMessages <ITimelineMessage>() .Where(m => m.EventName.StartsWith("WAZStorage:")).Cast <WindowsAzureStorageTimelineMessage>(); var model = new StorageModel(); if (timelineMessages != null) { model.Statistics.TotalStorageTx = timelineMessages.Count(); model.Statistics.TotalBlobTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Blob")); model.Statistics.TotalTableTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Table")); model.Statistics.TotalQueueTx = timelineMessages.Count(m => m.EventName.StartsWith("WAZStorage:Queue")); model.Statistics.TotalTrafficToStorage = timelineMessages.Sum(m => m.RequestSize).ToBytesHuman(); model.Statistics.TotalTrafficFromStorage = timelineMessages.Sum(m => m.ResponseSize).ToBytesHuman(); model.Statistics.PricePerTenThousandPageViews = string.Format("${0}", model.Statistics.TotalStorageTx * 1000 * 0.0000001 + timelineMessages.Sum(m => m.ResponseSize) * 10000 * (0.12 / 1024 / 1024 / 1024)); model.Requests = FlattenRequests(timelineMessages); model.Warnings = AnalyzeMessagesForWarnings(timelineMessages); return(model); } return("No storage transactions have been utilized for this request."); }
public override object GetData(ITabContext context) { var getHubsRequest = new GetHubsRequest(); var getHubsResult = _getHubsHandler.Handle(getHubsRequest); var data = FormatHubs(getHubsResult.Hubs); return data; }
public void HandleNullViewRenderMessageCollection(Views sut, ITabContext context) { context.TabStore.Setup(ds => ds.Get(typeof(IList <ViewEngine.FindViews.Message>).AssemblyQualifiedName)).Returns(new List <ViewEngine.FindViews.Message>()); context.TabStore.Setup(ds => ds.Get(typeof(IList <View.Render.Message>).AssemblyQualifiedName)).Returns <List <View.Render.Message> >(null); Assert.DoesNotThrow(() => sut.GetData(context)); }
/// <summary> /// The context should contain the reference to any mongo connections, and the relevant profile document selection we need to extract from those connections. /// </summary> /// <param name="context"></param> /// <returns></returns> public object GetData(ITabContext context) { var cutOff = DateTime.UtcNow - TimeSpan.FromSeconds(15); var results = new List<MongoProfileModel>(); foreach (var server in MongoServer.GetAllServers()) { foreach (var database in server.GetDatabaseNames()) { var db = server.GetDatabase(database); if (db.CollectionExists("system.profile")) { var query = from e in db.GetCollection("system.profile").FindAllAs<SystemProfileInfo>() where e.Namespace != database + ".system.profile" && e.Timestamp > cutOff select new MongoProfileModel(e); // skip one to miss the namespace query above foreach (var d in query.OrderByDescending(x => x.Timestamp).Skip(1).Take(10)) { results.Add(d); } } } } return results; }
/// <summary> /// Gets data for glimpse /// </summary> /// <param name="context">Tab context</param> /// <returns>A dictionary of information to put in the tab</returns> public override object GetData(ITabContext context) { var Return = new Dictionary <string, string[]>(); if (Container == null) { return(Return); } Return.Add("IoC Container", new string[] { Container.Name }); if (FileManager != null) { Return.Add("File systems", FileManager.ToString().Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); } if (ConfigurationManager != null) { Return.Add("Configuration systems", ConfigurationManager.ToString().Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); } if (LoggingManager != null) { Return.Add("Logging systems", LoggingManager.ToString().Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); } if (SerializationManager != null) { Return.Add("Serializers", SerializationManager.ToString().Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)); } return(Return); }
public override object GetData(ITabContext context) { var returnCollection = new Dictionary<string, object>(); var dateSort = ConfigurationManager.AppSettings.Get("Glimpse.TextReader.DateSort"); var fileLimit = 1; var folder = ConfigurationManager.AppSettings.Get("Glimpse.TextReader.Folder"); Int32.TryParse(ConfigurationManager.AppSettings.Get("Glimpse.TextReader.FileLimit"), out fileLimit); DirectoryInfo info = new DirectoryInfo(folder); IOrderedEnumerable<string> filepaths = null; if (dateSort != null) { if(dateSort.ToLower() == "desc") filepaths = Directory.GetFiles(folder).OrderByDescending(d => new FileInfo(d).CreationTime); else filepaths = Directory.GetFiles(folder).OrderBy(d => new FileInfo(d).CreationTime); } if (filepaths == null) return "Glimpse.TextReader : unable to locate path or missing path in config"; foreach (var filePath in filepaths.Take(fileLimit)) { var fileName = Path.GetFileName(filePath); var loglines = File.ReadAllLines(filePath); returnCollection.Add(fileName, loglines); } return returnCollection; }
public override object GetData(ITabContext context) { try { var portalSettings = PortalSettings.Current; int totalRecords = 0; LogInfoArray logs = new LogController().GetLog(portalSettings.PortalId, 15, 0, ref totalRecords); if (logs.Count == 0) return null; var data = new List<object[]> {new object[] {"Created Date", "Log Type", "UserName", "Content"}}; for (int i = 0; i < logs.Count; i++) { var log = logs.GetItem(i); var logProperties = new List<object[]> {new object[] {"Property", "Value"}}; for (int j = 0; j < log.LogProperties.Count; j++) { var logDetail = (LogDetailInfo)log.LogProperties[j]; logProperties.Add(new object[] { logDetail.PropertyName, logDetail.PropertyValue }); } data.Add(new object[] {log.LogCreateDate, log.LogTypeKey, log.LogUserName, logProperties}); } return data; } catch (Exception ex) { Exceptions.LogException(ex); return "There was an error loading the data for this tab"; } }
public override object GetData(ITabContext context) { var plugin = Plugin.Create("Level", "Timestamp", "Message", "Properties"); foreach (var item in context.GetMessages<LogEventItem>()) { var properties = item.LogEvent.Properties .Select(pv => new { Name = pv.Key, Value = GlimpsePropertyFormatter.Simplify(pv.Value) }) .ToList(); if (item.LogEvent.Exception != null) properties.Add(new { Name = "Exception", Value = (object)item.LogEvent.Exception }); properties = properties.OrderBy(p => p.Name).ToList(); var row = plugin.AddRow(); row.Column(item.LogEvent.Level.ToString()); row.Column(item.LogEvent.Timestamp.ToString("HH:mm:ss.fff", item.FormatProvider)); row.Column(item.LogEvent.RenderMessage(item.FormatProvider)).Strong(); row.Column(properties); ApplyRowLevelStyle(item.LogEvent.Level, row); } return plugin; }
public override object GetData(ITabContext context) { var glimpseResult = new List<object[]>(); var filepath = LoadCode("glimpse.csx"); if (!File.Exists(filepath)) { glimpseResult.Add(new[] { "Script result", "No code found" }); return glimpseResult; } var code = File.ReadAllText(filepath); glimpseResult.Add(new object[] {"Executed code", code}); var host = new ScriptCsHost(); host.Root.Executor.Initialize(new[] { "System.Web" }, new[] { new GlimpseContextScriptPack(context), }); host.Root.Executor.AddReferenceAndImportNamespaces(new[] { typeof(ITabContext), typeof(AspNetTab), typeof(ScriptCsTab), typeof(IScriptExecutor) }); var result = host.Root.Executor.ExecuteScript(code, new string[0]); host.Root.Executor.Terminate(); if (result.CompileExceptionInfo != null) glimpseResult.Add(new object[] { "Compilation exception", result.CompileExceptionInfo.SourceException.Message });; if (result.ExecuteExceptionInfo != null) glimpseResult.Add(new object[] { "Execution exception", result.ExecuteExceptionInfo.SourceException.Message }); ; glimpseResult.Insert(0, new[] { "Script result", result.ReturnValue }); return glimpseResult; }
public override object GetData(ITabContext context) { return new { MessageQueues = MessageQueue.GetQueueStats() }; }
public override object GetData(ITabContext context) { var plugin = Plugin.Create("No", "Status", "HttpMethod", "Index", "Document", "Endpoint", "Query", "ResponseData"); var requestContext = context.GetRequestContext <HttpContextBase>(); var items = RequestHandler.GetLogList(requestContext); if (items == null || !items.Any()) { return(null); } var count = 1; foreach (var item in items) { plugin.AddRow() .Column(count++) .Column(item.HttpStatus) .Column(item.HttpMethod) .Column(item.Index) .Column(item.Document) .Column(item.Endpoint) .Column(item.Query) .Column(item.ResponseData); } return(plugin); }
private IEnumerable <RouteConstraintModel> ProcessConstraints(ITabContext context, MvcRoute route, Dictionary <int, Dictionary <int, List <RouteBase.ProcessConstraint.Message> > > constraintMessages) { if (route.Constraints == null || route.Constraints.Count == 0) { return(null); } var counstraintRouteMessages = constraintMessages.GetValueOrDefault(route.GetHashCode()); var result = new List <RouteConstraintModel>(); foreach (var constraint in route.Constraints) { var model = new RouteConstraintModel(); model.ParameterName = constraint.Key; model.Constraint = constraint.Value.ToString(); if (counstraintRouteMessages != null) { var counstraintMessage = SafeFirstOrDefault(counstraintRouteMessages.GetValueOrDefault(constraint.Value.GetHashCode())); model.IsMatch = false; if (counstraintMessage != null) { model.IsMatch = counstraintMessage.IsMatch; } } result.Add(model); } return(result); }
public MainWindowContext(IEnumerable <ITabContext> contexts) { GeneralTab = contexts.First(x => x.Key == TabContextKey.General); FightTab = contexts.First(x => x.Key == TabContextKey.Fight); PathTab = contexts.First(x => x.Key == TabContextKey.Path); ItemTab = contexts.First(x => x.Key == TabContextKey.Item); }
public override object GetData(ITabContext context) { var cacheModel = new CacheModel(); cacheModel.Configuration.EffectivePercentagePhysicalMemoryLimit = HttpRuntime.Cache.EffectivePercentagePhysicalMemoryLimit; cacheModel.Configuration.EffectivePrivateBytesLimit = HttpRuntime.Cache.EffectivePrivateBytesLimit; var list = HttpRuntime.Cache.Cast <DictionaryEntry>().ToList(); foreach (var item in list) { try { var cacheEntry = MethodInfoCacheGet.Invoke(HttpRuntime.Cache, new object[] { item.Key, 1 }); var cacheItemModel = new CacheItemModel(); cacheItemModel.Key = item.Key.ToString(); cacheItemModel.Value = Serialization.GetValueSafe(item.Value); cacheItemModel.CreatedOn = GetCacheProperty(ProcessInfoUtcCreated, cacheEntry) as DateTime?; cacheItemModel.ExpiresOn = GetCacheProperty(ProcessInfoUtcExpires, cacheEntry) as DateTime?; cacheItemModel.SlidingExpiration = GetCacheProperty(ProcessInfoSlidingExpiration, cacheEntry) as TimeSpan?; cacheModel.CacheItems.Add(cacheItemModel); } catch (Exception) { return(false); } } return(cacheModel); }
public override object GetData(ITabContext context) { this.InitialiseStorageProvider(); this.InitialiseSettings(); var performanceData = this.GetPerformanceData(this.storageProvider.Retrieve()); this.storageProvider.Clear(); return performanceData; }
public override object GetData(ITabContext context) { var data = new List <object[]>(); AppendDbDiagnostics(data); return(data); }
public override object GetData(ITabContext context) { if (windowsAzureEnvironment.IsAvailable) { return(windowsAzureEnvironment); } return("The application is not running in Windows Azure Cloud Services or Windows Azure Websites."); }
public object GetData(ITabContext context) { return new { serverName = Environment.MachineName, user = Thread.CurrentPrincipal.Identity.Name }; }
public override object GetData(ITabContext context) { if (windowsAzureEnvironment.IsAvailable) { return windowsAzureEnvironment; } return "The application is not running in Windows Azure Cloud Services or Windows Azure Websites."; }
public object GetData(ITabContext context) { return(context.GetMessages <ITimelineMessage>() .Where(m => m.EventCategory.Name.Equals("Command") || (m.EventCategory.Name.Equals("Controller") && m.EventName.StartsWith("Controller:")) || m.EventCategory.Name.Equals("View")).OrderBy(m => m.Offset)); }
public object GetData(ITabContext context) { return(new { serverName = Environment.MachineName, user = Thread.CurrentPrincipal.Identity.Name }); }
public override object GetData(ITabContext context) { var data = new List<object[]>(); AppendDbDiagnostics(data); return data; }
public override object GetData(ITabContext context) { var getHubsRequest = new GetHubsRequest(); var getHubsResult = _getHubsHandler.Handle(getHubsRequest); var data = FormatHubs(getHubsResult.Hubs); return(data); }
public object GetData(ITabContext context) { return context.GetMessages<ITimelineMessage>() .Where(m => m.EventCategory.Name.Equals("Command") || (m.EventCategory.Name.Equals("Controller") && m.EventName.StartsWith("Controller:")) || m.EventCategory.Name.Equals("View")).OrderBy(m => m.Offset); }
public override object GetData(ITabContext context) { if (ContainerInstance == null) { return(null); } return(GetGlimpseStructureMapTabData(ContainerInstance)); }
public override object GetData(ITabContext context) { if (context.GetMessages <AuthorizerMessage>().Any()) { return(context.GetMessages <AuthorizerMessage>().ToList()); } return("There have been no Authorization events recorded. If you think there should have been, check that the 'Glimpse for Orchard Authorizer' feature is enabled."); }
public override object GetData(ITabContext application) { if(Profiler.Current == null) return null; var profiler = Profiler.Current; return FormatTimings(new[] {profiler.Root}, decimal.ToDouble(profiler.DurationMilliseconds)); }
public void ReturnRouteInstancesEvenWhenRoutesTableEmpty(Routes tab, ITabContext context) { System.Web.Routing.RouteTable.Routes.Clear(); var data = tab.GetData(context) as IList <RouteModel>; Assert.NotNull(data); Assert.Empty(data); }
public override object GetData(ITabContext context) { if (context.GetMessages <SiteSettingsMessage>().Any()) { return(context.GetMessages <SiteSettingsMessage>().ToList()); } return("There is no data available for this tab, check that the 'Glimpse for Orchard Site Settings' feature is enabled."); }
public override object GetData(ITabContext context) { var trace = HttpContext.Current.Trace; var hasRun = context.TabStore.Get("hasRun"); if (hasRun == null) { context.Logger.Debug("ControlTree Tab Initial Run - {0}", HttpContext.Current.Request.RawUrl); context.TabStore.Set("hasRun", "true"); //Remember the previous state, turn tracing on at the begining of the request, //set things up so that when request is finished, lets put things back to the //way they where. Lastly, make sure sate of trace is setup context.Logger.Debug("Setting logger infrastructure - previouslyEnabled = {0}", trace.IsEnabled); var previouslyEnabled = trace.IsEnabled; if (!previouslyEnabled) { trace.IsEnabled = true; } trace.TraceFinished += (sender, args) => { context.Logger.Debug("Resetting logger infrastructure - previouslyEnabled = {0}", previouslyEnabled); if (!previouslyEnabled) { trace.IsEnabled = false; } }; traceContextVerifyStartMethod.Invoke(trace, null); RegisterAdapters(context); return(null); } context.Logger.Debug("ControlTree Tab Final Run - {0}", HttpContext.Current.Request.RawUrl); if (requestDataField != null) { var requestData = requestDataField.GetValue(trace) as DataSet; if (requestData != null) { context.Logger.Debug("Pulling out the `Trace_Control_Tree` from internal logging infrastructure"); var treeData = ProcessData(requestData.Tables["Trace_Control_Tree"], context.Logger, context.GetMessages <PageLifeCycleMessage>()); return(treeData); } } return(null); }
public void ReturnResult(Metadata sut, ITabContext context, View.Render.Message renderMessage) { context.TabStore.Setup(ds => ds.Contains(typeof(IList<View.Render.Message>).AssemblyQualifiedName)).Returns(true); context.TabStore.Setup(ds => ds.Get(typeof(IList<View.Render.Message>).AssemblyQualifiedName)).Returns(new List<View.Render.Message> { renderMessage }); var result = sut.GetData(context) as List<MetadataItemModel>; Assert.NotNull(result); Assert.NotEmpty(result); }
public void ReturnProperNumberOfInstances(Routes tab, ITabContext context) { System.Web.Routing.RouteTable.Routes.Clear(); System.Web.Routing.RouteTable.Routes.Ignore("Something"); var data = tab.GetData(context) as IList<RouteModel>; Assert.NotNull(data); Assert.Equal(System.Web.Routing.RouteTable.Routes.Count, data.Count); }
public void ReturnProperNumberOfInstances(Routes tab, ITabContext context) { System.Web.Routing.RouteTable.Routes.Clear(); System.Web.Routing.RouteTable.Routes.Ignore("Something"); var data = tab.GetData(context) as IList <RouteModel>; Assert.NotNull(data); Assert.Equal(System.Web.Routing.RouteTable.Routes.Count, data.Count); }
public override object GetData(ITabContext context) { var trace = HttpContext.Current.Trace; var hasRun = context.TabStore.Get("hasRun"); if (hasRun == null) { context.Logger.Debug("ControlTree Tab Initial Run - {0}", HttpContext.Current.Request.RawUrl); context.TabStore.Set("hasRun", "true"); //Remember the previous state, turn tracing on at the begining of the request, //set things up so that when request is finished, lets put things back to the //way they where. Lastly, make sure sate of trace is setup context.Logger.Debug("Setting logger infrastructure - previouslyEnabled = {0}", trace.IsEnabled); var previouslyEnabled = trace.IsEnabled; if (!previouslyEnabled) { trace.IsEnabled = true; } trace.TraceFinished += (sender, args) => { context.Logger.Debug("Resetting logger infrastructure - previouslyEnabled = {0}", previouslyEnabled); if (!previouslyEnabled) { trace.IsEnabled = false; } }; traceContextVerifyStartMethod.Invoke(trace, null); RegisterAdapters(context); return null; } context.Logger.Debug("ControlTree Tab Final Run - {0}", HttpContext.Current.Request.RawUrl); if (requestDataField != null) { var requestData = requestDataField.GetValue(trace) as DataSet; if (requestData != null) { context.Logger.Debug("Pulling out the `Trace_Control_Tree` from internal logging infrastructure"); var treeData = ProcessData(requestData.Tables["Trace_Control_Tree"], context.Logger, context.GetMessages<PageLifeCycleMessage>()); return treeData; } } return null; }
public override object GetData(ITabContext context) { var messages = context.GetMessages <GlimpseMessage <ContentManagerMessage> >().ToList(); if (!messages.Any()) { return("There have been no Display Manager events recorded. If you think there should have been, check that the 'Glimpse for Orchard Content Manager' feature is enabled."); } return(messages); }
public override object GetData(ITabContext application) { if (StackExchange.Profiling.MiniProfiler.Current == null) { return null; } var profiler = StackExchange.Profiling.MiniProfiler.Current; return FormatTimings(new[] {profiler.Root}, decimal.ToDouble(profiler.DurationMilliseconds)); }
public void ReturnEmptyWhenNoData(ITabContext context) { context.TabStore.Setup(x => x.Get(typeof(Glimpse.Core.Message.ITimelineMessage).FullName)).Returns((IEnumerable<Glimpse.Core.Message.ITimelineMessage>)null); var timeline = new Timeline(); var result = timeline.GetData(context) as TimelineModel; Assert.NotNull(result); Assert.Equal(TimeSpan.FromMilliseconds(0), result.Duration); Assert.NotNull(result.Events); }
public object GetData(ITabContext context) { var sessions = context.GetMessages<RavenDbSessionMessage>().Select(x => x.Id).ToArray(); var data = new List<object[]>(); data.Add(new object[] { "Key", "Value" }); data.Add(new object[] { "Stores", GetStoreList() }); data.Add(new object[] { "Sessions", GetSessionList(sessions) }); data.Add(new object[] { "Requests", GetRequestList(sessions) }); return data; }
public void ReturnRouteInstancesEvenWhenRoutesTableEmpty(Routes tab, ITabContext context, RoutesInspector routeInspector, IInspectorContext routeInspectorContext) { System.Web.Routing.RouteTable.Routes.Clear(); routeInspectorContext.Setup(x => x.ProxyFactory).Returns(new CastleDynamicProxyFactory(routeInspectorContext.Logger, routeInspectorContext.MessageBroker, () => new ExecutionTimer(new Stopwatch()), () => new RuntimePolicy())); routeInspector.Setup(routeInspectorContext); var data = tab.GetData(context) as IList<RouteModel>; Assert.NotNull(data); Assert.Empty(data); }