Пример #1
0
        private List <MetricValue> readMetricValuesIntoEntity(SIMEntityBase entity, JobTarget jobTarget, string metricName, AppDRESTMetric appDRESTMetric, int timerangeDuration)
        {
            List <MetricValue> metricValues = new List <MetricValue>(appDRESTMetric.metricValues.Count);

            foreach (AppDRESTMetricValue appDRESTMetricValue in appDRESTMetric.metricValues)
            {
                // Populate metrics into the list for output into CSV
                MetricValue metricValue = new MetricValue();

                metricValue.Controller      = jobTarget.Controller;
                metricValue.ApplicationID   = jobTarget.ApplicationID;
                metricValue.ApplicationName = jobTarget.Application;

                if (entity != null)
                {
                    if (entity is SIMMachine)
                    {
                        SIMMachine machine = (SIMMachine)entity;

                        metricValue.EntityID   = machine.MachineID;
                        metricValue.EntityName = machine.MachineName;
                        metricValue.EntityType = machine.MachineType;
                    }
                    else if (entity is SIMMachineNetwork)
                    {
                        SIMMachineNetwork machineNetwork = (SIMMachineNetwork)entity;

                        metricValue.EntityID   = machineNetwork.MachineID;
                        metricValue.EntityName = machineNetwork.NetworkName;
                        metricValue.EntityType = machineNetwork.Speed.ToString();
                    }
                }

                metricValue.EventTimeStampUtc = UnixTimeHelper.ConvertFromUnixTimestamp(appDRESTMetricValue.startTimeInMillis);
                metricValue.EventTimeStamp    = metricValue.EventTimeStampUtc.ToLocalTime();
                metricValue.EventTime         = metricValue.EventTimeStamp;

                metricValue.MetricName = metricName;
                metricValue.MetricID   = appDRESTMetric.metricId;
                switch (appDRESTMetric.frequency)
                {
                case "SIXTY_MIN":
                {
                    metricValue.MetricResolution = 60;
                    break;
                }

                case "TEN_MIN":
                {
                    metricValue.MetricResolution = 10;
                    break;
                }

                case "ONE_MIN":
                {
                    metricValue.MetricResolution = 1;
                    break;
                }

                default:
                {
                    metricValue.MetricResolution = 1;
                    break;
                }
                }

                metricValue.Count       = appDRESTMetricValue.count;
                metricValue.Min         = appDRESTMetricValue.min;
                metricValue.Max         = appDRESTMetricValue.max;
                metricValue.Occurrences = appDRESTMetricValue.occurrences;
                metricValue.Sum         = appDRESTMetricValue.sum;
                metricValue.Value       = appDRESTMetricValue.value;

                metricValues.Add(metricValue);
            }

            return(metricValues);
        }
Пример #2
0
        private List <MetricValue> readMetricValuesIntoEntity(DBEntityBase entity, JobTarget jobTarget, string metricName, AppDRESTMetric appDRESTMetric, int timerangeDuration)
        {
            List <MetricValue> metricValues = new List <MetricValue>(appDRESTMetric.metricValues.Count);

            foreach (AppDRESTMetricValue appDRESTMetricValue in appDRESTMetric.metricValues)
            {
                // Populate metrics into the list for output into CSV
                MetricValue metricValue = new MetricValue();

                metricValue.Controller      = jobTarget.Controller;
                metricValue.ApplicationID   = jobTarget.ApplicationID;
                metricValue.ApplicationName = jobTarget.Application;

                if (entity != null)
                {
                    if (entity is DBDatabase)
                    {
                        DBDatabase database = (DBDatabase)entity;

                        metricValue.EntityID   = database.DatabaseID;
                        metricValue.EntityName = String.Format("{0}\\{1}", database.CollectorName, database.DatabaseName);
                        metricValue.EntityType = database.CollectorType;
                    }
                    else if (entity is DBCollector)
                    {
                        DBCollector databaseCollector = (DBCollector)entity;

                        metricValue.EntityID   = databaseCollector.CollectorID;
                        metricValue.EntityName = databaseCollector.CollectorName;
                        metricValue.EntityType = databaseCollector.CollectorType;
                    }
                }

                metricValue.EventTimeStampUtc = UnixTimeHelper.ConvertFromUnixTimestamp(appDRESTMetricValue.startTimeInMillis);
                metricValue.EventTimeStamp    = metricValue.EventTimeStampUtc.ToLocalTime();
                metricValue.EventTime         = metricValue.EventTimeStamp;

                metricValue.MetricName = metricName;
                metricValue.MetricID   = appDRESTMetric.metricId;
                switch (appDRESTMetric.frequency)
                {
                case "SIXTY_MIN":
                {
                    metricValue.MetricResolution = 60;
                    break;
                }

                case "TEN_MIN":
                {
                    metricValue.MetricResolution = 10;
                    break;
                }

                case "ONE_MIN":
                {
                    metricValue.MetricResolution = 1;
                    break;
                }

                default:
                {
                    metricValue.MetricResolution = 1;
                    break;
                }
                }

                metricValue.Count       = appDRESTMetricValue.count;
                metricValue.Min         = appDRESTMetricValue.min;
                metricValue.Max         = appDRESTMetricValue.max;
                metricValue.Occurrences = appDRESTMetricValue.occurrences;
                metricValue.Sum         = appDRESTMetricValue.sum;
                metricValue.Value       = appDRESTMetricValue.value;

                metricValues.Add(metricValue);
            }

            return(metricValues);
        }
Пример #3
0
        private List <MetricValue> readMetricValuesIntoEntity(BIQEntityBase entity, JobTarget jobTarget, string metricName, AppDRESTMetric appDRESTMetric, int timerangeDuration)
        {
            List <MetricValue> metricValues = new List <MetricValue>(appDRESTMetric.metricValues.Count);

            foreach (AppDRESTMetricValue appDRESTMetricValue in appDRESTMetric.metricValues)
            {
                // Populate metrics into the list for output into CSV
                MetricValue metricValue = new MetricValue();

                metricValue.Controller      = jobTarget.Controller;
                metricValue.ApplicationID   = jobTarget.ApplicationID;
                metricValue.ApplicationName = jobTarget.Application;

                if (entity != null)
                {
                    if (entity is BIQMetric)
                    {
                        BIQMetric metric = (BIQMetric)entity;

                        try { metricValue.EntityID = Convert.ToInt64(metric.MetricID); } catch { }
                        metricValue.EntityName = metric.MetricName;
                        metricValue.EntityType = metric.DataSource;
                    }
                    else if (entity is BIQBusinessJourney)
                    {
                        BIQBusinessJourney businessJourney = (BIQBusinessJourney)entity;

                        // The JourneyID is a hash of some sorts. Let's turn it into unique value
                        metricValue.EntityID   = businessJourney.JourneyID.GetHashCode();
                        metricValue.EntityName = businessJourney.JourneyName;
                        metricValue.EntityType = businessJourney.KeyField;
                    }
                }

                metricValue.EventTimeStampUtc = UnixTimeHelper.ConvertFromUnixTimestamp(appDRESTMetricValue.startTimeInMillis);
                metricValue.EventTimeStamp    = metricValue.EventTimeStampUtc.ToLocalTime();
                metricValue.EventTime         = metricValue.EventTimeStamp;

                metricValue.MetricName = metricName;
                metricValue.MetricID   = appDRESTMetric.metricId;
                switch (appDRESTMetric.frequency)
                {
                case "SIXTY_MIN":
                {
                    metricValue.MetricResolution = 60;
                    break;
                }

                case "TEN_MIN":
                {
                    metricValue.MetricResolution = 10;
                    break;
                }

                case "ONE_MIN":
                {
                    metricValue.MetricResolution = 1;
                    break;
                }

                default:
                {
                    metricValue.MetricResolution = 1;
                    break;
                }
                }

                metricValue.Count       = appDRESTMetricValue.count;
                metricValue.Min         = appDRESTMetricValue.min;
                metricValue.Max         = appDRESTMetricValue.max;
                metricValue.Occurrences = appDRESTMetricValue.occurrences;
                metricValue.Sum         = appDRESTMetricValue.sum;
                metricValue.Value       = appDRESTMetricValue.value;

                metricValues.Add(metricValue);
            }

            return(metricValues);
        }