public static void ValidateQueryDiagnostics(CosmosDiagnosticsContext diagnosticsContext, bool isFirstPage)
        {
            _ = JObject.Parse(diagnosticsContext.ToString());
            QueryDiagnosticValidatorHelper validator = new QueryDiagnosticValidatorHelper();

            validator.Visit(diagnosticsContext);
            validator.Validate(isFirstPage);
        }
        public static void ValidateChangeFeedOperationDiagnostics(CosmosDiagnosticsContext diagnosticsContext)
        {
            _ = JObject.Parse(diagnosticsContext.ToString());
            ChangeFeedDiagnosticValidatorHelper validator = new ChangeFeedDiagnosticValidatorHelper();

            validator.Visit(diagnosticsContext);
            validator.Validate();
        }
        public static void ValidatePointOperationDiagnostics(CosmosDiagnosticsContext diagnosticsContext)
        {
            _ = JObject.Parse(diagnosticsContext.ToString());
            PointDiagnosticValidatorHelper validator = new PointDiagnosticValidatorHelper();

            validator.Visit(diagnosticsContext);
            validator.Validate();
        }
Exemplo n.º 4
0
        public static void ValidateQueryGatewayPlanDiagnostics(CosmosDiagnosticsContext diagnosticsContext, bool isFirstPage)
        {
            string  diagnostics = diagnosticsContext.ToString();
            JObject jObject     = JObject.Parse(diagnostics);
            QueryGatewayPlanDiagnosticValidatorHelper validator = new QueryGatewayPlanDiagnosticValidatorHelper();

            validator.Visit(diagnosticsContext);
            validator.Validate(isFirstPage);
        }
        internal static void ValidateCosmosDiagnosticsContext(
            CosmosDiagnosticsContext cosmosDiagnosticsContext)
        {
            Assert.IsTrue((cosmosDiagnosticsContext.StartUtc - DateTime.UtcNow) < TimeSpan.FromHours(12), $"Start Time is not valid {cosmosDiagnosticsContext.StartUtc}");
            Assert.AreNotEqual(cosmosDiagnosticsContext.UserAgent.ToString(), new UserAgentContainer().UserAgent.ToString(), "User agent not set");
            Assert.IsTrue(cosmosDiagnosticsContext.TotalRequestCount > 0, "No request found");
            Assert.IsFalse(cosmosDiagnosticsContext.IsComplete(), "OverallClientRequestTime should be stopped");
            Assert.IsTrue(cosmosDiagnosticsContext.GetClientElapsedTime() > TimeSpan.Zero, "OverallClientRequestTime should have time.");

            string info = cosmosDiagnosticsContext.ToString();

            Assert.IsNotNull(info);
            JObject jObject = JObject.Parse(info.ToString());
            JToken  summary = jObject["Summary"];

            Assert.IsNotNull(summary["UserAgent"].ToString());
            Assert.AreNotEqual(summary["UserAgent"].ToString(), new UserAgentContainer().UserAgent);
            Assert.IsNotNull(summary["StartUtc"].ToString());
            Assert.IsNotNull(summary["TotalElapsedTime"].ToString());
        }
Exemplo n.º 6
0
        internal static void ValidateCosmosDiagnosticsContext(
            CosmosDiagnosticsContext cosmosDiagnosticsContext)
        {
            Assert.IsTrue((cosmosDiagnosticsContext.StartUtc - DateTime.UtcNow) < TimeSpan.FromHours(12), $"Start Time is not valid {cosmosDiagnosticsContext.StartUtc}");
            Assert.IsTrue(cosmosDiagnosticsContext.UserAgent.ToString().Contains("cosmos-netstandard-sdk"));
            Assert.IsTrue(cosmosDiagnosticsContext.GetTotalRequestCount() > 0, "No request found");
            Assert.IsTrue(cosmosDiagnosticsContext.IsComplete(), "OverallClientRequestTime should be stopped");
            Assert.IsTrue(cosmosDiagnosticsContext.GetRunningElapsedTime() > TimeSpan.Zero, "OverallClientRequestTime should have time.");

            string info = cosmosDiagnosticsContext.ToString();

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

            Assert.IsNotNull(jObject["DiagnosticVersion"].ToString());
            JToken summary = jObject["Summary"];

            Assert.IsNotNull(summary["UserAgent"].ToString());
            Assert.IsTrue(summary["UserAgent"].ToString().Contains("cosmos-netstandard-sdk"));
            Assert.IsNotNull(summary["StartUtc"].ToString());
            Assert.IsNotNull(summary["TotalElapsedTimeInMs"].ToString());
        }