private XElement GetQueueDiagnosticInfo(MRSDiagnosticArgument arguments) { DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(this.MdbGuid, null, null, FindServerFlags.AllowMissing); string argument = arguments.GetArgument <string>("queues"); if (!string.IsNullOrEmpty(argument) && (databaseInformation.IsMissing || !CommonUtils.IsValueInWildcardedList(databaseInformation.DatabaseName, argument))) { return(null); } MRSQueueDiagnosticInfoXML mrsqueueDiagnosticInfoXML = new MRSQueueDiagnosticInfoXML { MdbGuid = this.MdbGuid, MdbName = databaseInformation.DatabaseName, LastJobPickup = this.LastJobPickup, LastInteractiveJobPickup = this.LastInteractiveJobPickup, QueuedJobsCount = this.QueuedJobsCount, InProgressJobsCount = this.InProgressJobsCount, LastScanFailure = this.LastScanFailure, MdbDiscoveryTimestamp = this.MdbDiscoveryTimestamp, LastScanTimestamp = this.LastScanTimestamp, LastScanDurationMs = (int)this.LastScanDuration.TotalMilliseconds, NextRecommendedScan = this.NextRecommendedScan, LastActiveJobFinishTime = this.LastActiveJobFinishTime, LastActiveJobFinished = this.LastActiveJobFinished }; if (arguments.HasArgument("pickupresults")) { mrsqueueDiagnosticInfoXML.LastScanResults = this.LastScanResults; } return(mrsqueueDiagnosticInfoXML.ToDiagnosticInfo(null)); }
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 XElement GetDiagnosticInfo(MRSDiagnosticArgument arguments) { string argument = arguments.GetArgument <string>("resources"); if (!string.IsNullOrEmpty(argument) && !CommonUtils.IsValueInWildcardedList(this.ResourceName, argument) && !CommonUtils.IsValueInWildcardedList(this.ResourceType, argument)) { return(null); } if (arguments.HasArgument("unhealthy") && !this.IsUnhealthy) { return(null); } return(this.GetDiagnosticInfoInternal(arguments)); }
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); }