public static XElement GetJobsDiagnosticInfo(MRSDiagnosticArgument arguments) { int num = arguments.GetArgumentOrDefault <int>("maxsize", int.MaxValue); Guid empty = Guid.Empty; string text = null; string argument = arguments.GetArgument <string>("job"); if (!string.IsNullOrEmpty(argument) && !Guid.TryParse(argument, out empty)) { text = argument; } MRSRequestType?argumentOrDefault = arguments.GetArgumentOrDefault <MRSRequestType?>("requesttype", null); XElement xelement = new XElement("Jobs"); lock (MailboxSyncerJobs.syncRoot) { using (Dictionary <Guid, BaseJob> .ValueCollection.Enumerator enumerator = MailboxSyncerJobs.activeJobs.Values.GetEnumerator()) { while (enumerator.MoveNext()) { BaseJob baseJob = enumerator.Current; if (num == 0) { break; } if ((empty == Guid.Empty || empty == baseJob.RequestJobGuid) && (argumentOrDefault == null || argumentOrDefault == baseJob.CachedRequestJob.RequestType) && (string.IsNullOrEmpty(text) || CommonUtils.IsValueInWildcardedList(baseJob.RequestJobStoringMDB.ToString(), text))) { xelement.Add(arguments.RunDiagnosticOperation(() => baseJob.GetJobDiagnosticInfo(arguments))); num--; } } } } return(xelement); }
public static XElement GetResourcesDiagnosticInfo(MRSDiagnosticArgument arguments) { XElement root = new XElement("Resources"); lock (ReservationManager.Locker) { MRSResource.Cache.ForEach(delegate(MRSResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); LocalServerReadResource.Cache.ForEach(delegate(LocalServerReadResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); LocalServerWriteResource.Cache.ForEach(delegate(LocalServerWriteResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); DatabaseReadResource.Cache.ForEach(delegate(DatabaseReadResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); DatabaseWriteResource.Cache.ForEach(delegate(DatabaseWriteResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); MailboxMoveSourceResource.Cache.ForEach(delegate(MailboxMoveSourceResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); MailboxMoveTargetResource.Cache.ForEach(delegate(MailboxMoveTargetResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); MailboxMergeSourceResource.Cache.ForEach(delegate(MailboxMergeSourceResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); MailboxMergeTargetResource.Cache.ForEach(delegate(MailboxMergeTargetResource m) { root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments))); }); } return(root); }
public static XElement GetReservationsDiagnosticInfo(MRSDiagnosticArgument arguments) { XElement xelement = new XElement("Reservations"); lock (ReservationManager.Locker) { using (List <ReservationBase> .Enumerator enumerator = ReservationManager.reservations.Values.GetEnumerator()) { while (enumerator.MoveNext()) { ReservationBase reservation = enumerator.Current; xelement.Add(arguments.RunDiagnosticOperation(() => reservation.GetDiagnosticInfo(arguments))); } } } return(xelement); }
public static XElement GetDiagnosticInfo(MRSDiagnosticArgument arguments) { XElement xelement = new XElement("Queues"); lock (MRSQueue.locker) { using (List <MRSQueue> .Enumerator enumerator = MRSQueue.queues.Values.GetEnumerator()) { while (enumerator.MoveNext()) { MRSQueue queue = enumerator.Current; xelement.Add(arguments.RunDiagnosticOperation(() => queue.GetQueueDiagnosticInfo(arguments))); } } } return(xelement); }
XElement IDiagnosable.GetDiagnosticInfo(DiagnosableParameters parameters) { XElement xelement = new XElement(MRSService.DiagnosticsComponentName); MRSDiagnosticArgument arguments; try { arguments = new MRSDiagnosticArgument(parameters.Argument); } catch (DiagnosticArgumentException ex) { xelement.Add(new XElement("Error", "Encountered exception: " + ex.Message)); return(xelement); } xelement.Add(new object[] { new XElement("ServiceStartTime", MRSService.serviceStartTime), new XElement("LastScanDuration", MRSService.lastFullScanDuration), new XElement("LastScanTime", MRSService.lastFullScanTime.ToString()), new XElement("DurationSinceLastScan", (long)(DateTime.UtcNow - MRSService.lastFullScanTime).TotalMilliseconds), new XElement("NextFullScanTime", MRSService.NextFullScanTime.ToString()), new XElement("NextLightJobsFullScanTime", MRSService.nextLightJobsFullScanTime.ToString()) }); if (arguments.ArgumentCount == 0) { xelement.Add(new XElement("Help", "Supported arguments: " + arguments.GetSupportedArguments())); } if (arguments.HasArgument("binaryversions")) { string assemblyNamePattern = arguments.GetArgument <string>("binaryversions"); xelement.Add(arguments.RunDiagnosticOperation(() => CommonUtils.GetBinaryVersions(assemblyNamePattern))); } if (arguments.HasArgument("job")) { xelement.Add(arguments.RunDiagnosticOperation(() => MailboxSyncerJobs.GetJobsDiagnosticInfo(arguments))); } if (arguments.HasArgument("reservations")) { xelement.Add(arguments.RunDiagnosticOperation(() => ReservationManager.GetReservationsDiagnosticInfo(arguments))); } if (arguments.HasArgument("resources")) { xelement.Add(arguments.RunDiagnosticOperation(() => ReservationManager.GetResourcesDiagnosticInfo(arguments))); } if (arguments.HasArgument("queues")) { xelement.Add(arguments.RunDiagnosticOperation(() => MRSQueue.GetDiagnosticInfo(arguments))); } if (arguments.HasArgument("workloads")) { XElement xelement2 = new XElement("Workloads"); foreach (object obj in Enum.GetValues(typeof(RequestWorkloadType))) { RequestWorkloadType requestWorkloadType = (RequestWorkloadType)obj; if (requestWorkloadType != RequestWorkloadType.None) { GenericSettingsContext genericSettingsContext = new GenericSettingsContext("RequestWorkloadType", requestWorkloadType.ToString(), null); using (genericSettingsContext.Activate()) { bool config = ConfigBase <MRSConfigSchema> .GetConfig <bool>("IsJobPickupEnabled"); xelement2.Add(new XElement("Workload", new object[] { new XAttribute("Name", requestWorkloadType.ToString()), new XAttribute("IsJobPickupEnabled", config) })); } } } xelement.Add(xelement2); } return(xelement); }