Пример #1
0
        private void CalculateTransformation(Messages.TransformSeries msg)
        {
            // Get the transform from the series
            var transform = msg.Transforms.Dequeue();

            // Calculate the rolling average and use it as the base noise level
            string saveName = (transform.Parameters.ContainsKey(SAVE_NAME)) ? transform.Parameters[SAVE_NAME] :
                              SAVE_NAME_DEFAULT_VALUE;

            // Construct the UPSERT msg so the values can be saved in the correct MetricStore
            var um = new MetricStoreActor.UpsertMetric(saveName, msg.Measurements.Values);

            // Find the correct MetricStore actor and send it the UPSERT msg
            var actorName = "/user/*/MetricStore:" + msg.VmName + ":" + msg.VmDate;
            var actor     = Context.ActorSelection(actorName);

            actor.Tell(um);

            // Route the Metric unchanged to the next transform
            var series = new Messages.TransformSeries(msg.Measurements, msg.Transforms, msg.GroupID, msg.ConnectionId, msg.VmName, msg.VmDate);

            RouteTransform(series);
        }
Пример #2
0
        private void SendMetrics()
        {
            foreach (KeyValuePair <string, SortedDictionary <long, float> > entry in metrics)
            {
                // do something with entry.Value or entry.Key
                var um = new MetricStoreActor.UpsertMetric(entry.Key, entry.Value);
                metricStoreActor.Tell(um);
            }


            // Tell all the metric accumulators dispatchers that this actor is finishing
            //            / user / STARTUP_ACTOR / MetricAccumulatorDispatcher /

//            var selection = Context.ActorSelection("/*/MetricAccumulatorDispatcher*");
            var selection = Context.ActorSelection("/user/*/MetricAccumulatorDispatcher");

            selection.Tell(new Messages.Stopping());

            // Tell the associated MetricStoreActor that this actor is finishing
            metricStoreActor.Tell(new Messages.Stopping());

            Context.Stop(Context.Self);
        }