Ejemplo n.º 1
0
        public void Calculate_Table_Metrics()
        {
            if (_telemetry == null)
            {
                return;
            }

            string scope = "Database";
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            using (DatabaseProvider provider = DatabaseProvider.Create("CountStats.sql", Program.Context.ConnectionString))
            {
                var reader = provider.ExecuteReader();
                parameters.Add("Database", provider.Database);
                while (reader.Read())
                {
                    for (int col = 1; col < reader.FieldCount; col++) //the first field is table name
                    {
                        parameters["Table"]  = reader.GetString(0);
                        parameters["Metric"] = reader.GetName(col);
                        TrackMetric(scope, reader.GetString(0), reader.GetName(col), reader.GetInt64(col), parameters);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void GetStatsInDatabase(string connectionString)
        {
            if (_telemetry == null)
            {
                return;
            }

            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string scope = "Database";

            using (DatabaseProvider provider = DatabaseProvider.Create("CountFileStats.sql", connectionString))
            {
                var reader = provider.ExecuteReader();
                parameters.Add("Database", provider.Database);
                while (reader.Read())
                {
                    for (int col = 1; col < reader.FieldCount; col++) //the first field is table name
                    {
                        parameters["Database"] = reader.GetString(0);
                        parameters["Metric"]   = reader.GetName(col);
                        TrackMetric(scope, reader.GetString(0), reader.GetName(col), reader.GetInt32(col), parameters);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void Count_Active_Test_Plans()
        {
            if (_telemetry == null)
            {
                return;
            }

            string scope = "Database";
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            using (DatabaseProvider provider = DatabaseProvider.Create("CountActiveTestPlans.sql", Program.Context.ConnectionString))
            {
                int activeTestPlans = (int)provider.ExecuteScalar();
                parameters.Add("Database", provider.Database);
                TrackMetric(scope, FormatMetricName(scope, "Active_Test_Plans"), activeTestPlans, parameters);
            }
        }