Exemple #1
0
        public string RecordAddressResolutionStart(Uri targetEndpoint)
        {
            string identifier = Guid.NewGuid().ToString();
            AddressResolutionStatistics resolutionStats = new AddressResolutionStatistics(
                startTime: DateTime.UtcNow,
                endTime: DateTime.MaxValue,
                targetEndpoint: targetEndpoint == null ? "<NULL>" : targetEndpoint.ToString());

            lock (this.lockObject)
            {
                this.EndpointToAddressResolutionStatistics.Add(identifier, resolutionStats);
                this.DiagnosticsContext.AddDiagnosticsInternal(resolutionStats);
            }

            return(identifier);
        }
Exemple #2
0
        private static void ValidateAddressResolutionStatistics(AddressResolutionStatistics stats)
        {
            Assert.IsTrue(stats.EndTime.HasValue);
            Assert.AreNotEqual(stats.StartTime, stats.EndTime.Value);
            Assert.IsTrue(stats.StartTime < stats.EndTime);
            Assert.IsFalse(string.IsNullOrWhiteSpace(stats.TargetEndpoint));

            string info = stats.ToString();

            Assert.IsNotNull(info);
            JObject jObject = JObject.Parse(info.ToString());

            Assert.IsNotNull(jObject["StartTimeUtc"].ToString());
            Assert.IsNotNull(jObject["EndTimeUtc"].ToString());
            Assert.IsNotNull(jObject["TargetEndpoint"].ToString());
        }
Exemple #3
0
        public string RecordAddressResolutionStart(Uri targetEndpoint)
        {
            string identifier = Guid.NewGuid().ToString();
            AddressResolutionStatistics resolutionStats = new AddressResolutionStatistics
            {
                StartTime      = DateTime.UtcNow,
                EndTime        = DateTime.MaxValue,
                TargetEndpoint = targetEndpoint == null ? "<NULL>" : targetEndpoint.ToString()
            };

            lock (this.lockObject)
            {
                this.addressResolutionStatistics.Add(identifier, resolutionStats);
            }

            return(identifier);
        }
 internal abstract void AddDiagnosticsInternal(AddressResolutionStatistics addressResolutionStatistics);
 internal override void AddDiagnosticsInternal(AddressResolutionStatistics addressResolutionStatistics)
 {
 }
 public abstract TResult Visit(AddressResolutionStatistics addressResolutionStatistics);
 internal override void AddDiagnosticsInternal(AddressResolutionStatistics addressResolutionStatistics)
 {
     this.ContextList.Add(addressResolutionStatistics);
 }
 public override void Visit(AddressResolutionStatistics addressResolutionStatistics)
 {
 }
 // AddressResolution does not happen on every request.
 public override void Visit(AddressResolutionStatistics addressResolutionStatistics)
 {
     Assert.IsTrue(this.isContextVisited);
     DiagnosticValidator.ValidateAddressResolutionStatistics(addressResolutionStatistics);
 }
 public override void Visit(AddressResolutionStatistics addressResolutionStatistics)
 {
     throw new ArgumentException($"Query should not have {nameof(addressResolutionStatistics)}");
 }
 public abstract void Visit(AddressResolutionStatistics addressResolutionStatistics);