Ejemplo n.º 1
0
        public StatisticContainer GetChannelsStatistic()
        {
            StatisticContainer statc = new StatisticContainer();
            foreach (BrokerStat sm in MessageChannels.GetStatistics())
            {
                if (sm == null)
                    continue;
                StatRange range = sm.GetFlushedMinRange();

                statc.FlushedMinRanges.Add(new MetaStatRange() { Name = sm.Name, range = range });
            }
            return statc;
        }
Ejemplo n.º 2
0
        // Containers go here

        public BitmovinApi(string apiKey, string apiUrl = "https://api.bitmovin.com/v1/")
        {
            ApiKey      = apiKey;
            _apiUrl     = apiUrl;
            _restClient = new RestClient(apiKey, apiUrl);

            this.Input     = new InputContainer(_restClient);
            this.Output    = new OutputContainer(_restClient);
            this.Codec     = new CodecContainer(_restClient);
            this.Encoding  = new EncodingContainer(_restClient);
            this.Manifest  = new ManifestContainer(_restClient);
            this.Statistic = new StatisticContainer(_restClient);
        }
Ejemplo n.º 3
0
        public object Get(StatisticRequest r)
        {
            StatisticResponseHeartbit h = new StatisticResponseHeartbit();

            h.Channels = new List <ItemCounter>();

            StatisticContainer statCont = QueueService.ModProducer.broker.GetChannelsStatistic();

            foreach (MetaStatRange mrange in statCont.FlushedMinRanges)
            {
                StatRange range = mrange.range;
                h.Channels.Add(new ItemCounter()
                {
                    Name  = mrange.Name,
                    Count = r.GetThroughput ? (int)range.PerMinute : (int)range.Counter,
                    Left  = range.Left.ToString()
                });
            }

            return(h);
        }
Ejemplo n.º 4
0
        public IHttpActionResult GetFirst6PokemonsOrderByAtackDesc()
        {
            var pokemons = db.Pokemons.OrderBy(p => p.attack).Take(6).ToList();

            var statistic = new Statistic();

            foreach (var pokemon in pokemons)
            {
                statistic.attack          += pokemon.attack;
                statistic.special_attack  += pokemon.special_attack;
                statistic.defense         += pokemon.defense;
                statistic.special_defense += pokemon.special_defense;
                statistic.speed           += pokemon.speed;
                statistic.hp += pokemon.hp;
            }

            var statisticContainer = new StatisticContainer {
                pokemons = pokemons, statistic = statistic
            };

            return(Ok(statisticContainer));
        }