Пример #1
0
        /// <summary>
        /// It is called whenever context message is received
        /// </summary>
        /// <param name="contextMessage">Serialized EvaluatorMetrics</param>
        public void OnNext(IContextMessage contextMessage)
        {
            var msgReceived = ByteUtilities.ByteArraysToString(contextMessage.Message);
            var counters    = new EvaluatorMetrics(msgReceived).GetMetricsCounters();

            Logger.Log(Level.Info, "Received {0} counters with context message: {1}.", counters.GetCounters().Count(), msgReceived);

            foreach (var counter in counters.GetCounters())
            {
                ICounter c;
                if (_counters.TryGetValue(counter.Name, out c))
                {
                    //// TODO: [REEF-1748] The following cases need to be considered in determine how to update the counter:
                    //// if evaluator contains the aggregated values, the value will override existing value
                    //// if evaluator only keep delta, the value should be added at here. But the value in the evaluator should be reset after message is sent
                    //// For the counters from multiple evaluators with the same counter name, the value should be aggregated here
                    //// We also need to consider failure cases.
                    _counters[counter.Name] = counter;
                }
                else
                {
                    _counters.Add(counter.Name, counter);
                }

                Logger.Log(Level.Verbose, "Counter name: {0}, value: {1}, description: {2}, time: {3}.", counter.Name, counter.Value, counter.Description, new DateTime(counter.Timestamp));
            }
        }
Пример #2
0
        /// <summary>
        /// It is called whenever context message is received
        /// </summary>
        /// <param name="contextMessage">Serialized EvaluatorMetrics</param>
        public void OnNext(IContextMessage contextMessage)
        {
            var msgReceived = ByteUtilities.ByteArraysToString(contextMessage.Message);
            var counters    = new EvaluatorMetrics(msgReceived).GetMetricsCounters();

            Logger.Log(Level.Info, "Received {0} counters with context message: {1}.", counters.GetCounters().Count(), msgReceived);

            _countersData.Update(counters);

            if (_countersData.TriggerSink(_counterSinkThreshold))
            {
                Sink(_countersData.GetCounterData());
                _countersData.Reset();
            }
        }
Пример #3
0
        /// <summary>
        /// Called whenever context message is received
        /// </summary>
        /// <param name="contextMessage">Serialized EvaluatorMetrics</param>
        public void OnNext(IContextMessage contextMessage)
        {
            var msgReceived = ByteUtilities.ByteArraysToString(contextMessage.Message);
            var evalMetrics = new EvaluatorMetrics(msgReceived);
            var metricsData = evalMetrics.GetMetricsData();

            Logger.Log(Level.Info, "Received {0} metrics with context message of length {1}",
                       metricsData.GetMetricTrackers().Count(), msgReceived.Length);

            _metricsData.Update(metricsData);

            if (_metricsData.TriggerSink(_metricSinkThreshold))
            {
                Sink(_metricsData.FlushMetricRecords());
            }
        }