Ejemplo n.º 1
0
 public MetricAttribute(string name, MetricState state = MetricState.Undefined, MetricSampled sampled = MetricSampled.Undefined, MetricResult result = MetricResult.Undefined)
 {
     Name    = name;
     State   = state;
     Sampled = sampled;
     Result  = result;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new metrics session, and begins accepting data.
        /// </summary>
        /// <param name="filePath">The file path for writing the XML data.</param>
        public static string StartMetrics(string userKey, string version)
        {
            if (currentState == MetricState.RUNNING)
            {
                //throw new InvalidOperationException("The metrics system is already running!");
                Console.WriteLine("CMetrics WARNING: Previous Session was still running. Stopping...");
                StopMetrics();
            }

            //Set our run state to running.
            currentState = MetricState.RUNNING;

            //Set up our auth key and file paths for API queries.
            Metrics.userKey = userKey;

            //Set our version
            Metrics.version = version;

            //Generate a new Session ID
            sessionID = Guid.NewGuid().ToString("N");

            //Initialize our session.
            PostSessionInfo(true);

            return(sessionID);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This should be called after you have finished collecting metrics data.
        /// </summary>
        public static bool StopMetrics()
        {
            if (currentState == MetricState.RUNNING)
            {
                //Post closing session data
                PostSessionInfo(false);

                currentState = MetricState.STOPPED;
                return(true);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public MetricProcessor(string name, JsonMetric jsonMetric)
            : base(name)
        {
            Name = name;
            Metric = jsonMetric;

            CurrentState = LoadState();

            _updateCallbacks = new ConcurrentDictionary<string, Action<MetricProcessor>>();
            _errorCallbacks = new ConcurrentDictionary<string, Action<string>>();

            Task.Run(() => { EventLoop(); });
        }
 public GoalPlanningSchoolMetric()
 {
     MetricState = new MetricState();
     GoalMetricIds = new List<int>();
 }
Ejemplo n.º 6
0
 public SchoolMetricModel()
 {
     MetricState = new MetricState();
 }
Ejemplo n.º 7
0
 public SchoolPriorYearMetricModel()
 {
     MetricState = new MetricState();
 }
Ejemplo n.º 8
0
        static byte[] Serialize(MetricState o)
        {
            if (o == null) {
                return null;
            }

            BinaryFormatter binaryFormatter = new BinaryFormatter();
            using (MemoryStream memoryStream = new MemoryStream()) {
                binaryFormatter.Serialize(memoryStream, o);
                byte[] objectDataAsStream = memoryStream.ToArray();
                return objectDataAsStream;
            }
        }