public IEnumerable <Vector[]> AllCountVectors(int stepSize)
 {
     while (this.Next(stepSize))
     {
         yield return(Histograms.Map(h => h.ChangedCountVector()));
     }
 }
        public MetricsContextValueSource Filter(IFilterMetrics filter)
        {
            if (!filter.IsContextMatch(Context))
            {
                return(Empty);
            }

            return(new MetricsContextValueSource(
                       Context,
                       Gauges.Where(filter.IsGaugeMatch),
                       Counters.Where(filter.IsCounterMatch),
                       Meters.Where(filter.IsMeterMatch),
                       Histograms.Where(filter.IsHistogramMatch),
                       Timers.Where(filter.IsTimerMatch),
                       ApdexScores.Where(filter.IsApdexMatch)));
        }
Example #3
0
        public void ShouldCreateEmptyHistogram()
        {
            ISyncHistogram histogram = Histograms.Uniform();

            Assert.That(histogram.Count, Is.EqualTo(0));
            Assert.That(histogram.Max, Is.InRange(0, 0.0001));
            Assert.That(histogram.Min, Is.InRange(0, 0.0001));
            Assert.That(histogram.Mean, Is.InRange(0, 0.0001));
            Assert.That(histogram.StandardDeviation, Is.InRange(0, 0.0001));

            Snapshot snapshot = histogram.Snapshot;

            Assert.That(snapshot.Median, Is.InRange(0, 0.0001));
            Assert.That(snapshot.Percentile75, Is.InRange(0, 0.0001));
            Assert.That(snapshot.Percentile99, Is.InRange(0, 0.0001));
            Assert.That(snapshot.Size, Is.EqualTo(0));
        }
Example #4
0
        public void ShouldCreateHistogramWith1000Elements()
        {
            ISyncHistogram histogram = Histograms.Uniform();

            for (int i = 1; i <= 1000; i++)
            {
                histogram.Update(i);
            }

            Assert.That(histogram.Count, Is.EqualTo(1000));
            Assert.That(histogram.Max, Is.InRange(999.9999, 1000.0001));
            Assert.That(histogram.Min, Is.InRange(0.9999, 1.0001));
            Assert.That(histogram.Mean, Is.InRange(500.4999, 500.50001));
            Assert.That(histogram.StandardDeviation, Is.InRange(288.8193, 288.8195));

            Snapshot snapshot = histogram.Snapshot;

            Assert.That(snapshot.Median, Is.InRange(500.4999, 500.50001));
            Assert.That(snapshot.Percentile75, Is.InRange(750.7499, 750.7501));
            Assert.That(snapshot.Percentile99, Is.InRange(990.9899, 990.9901));
            Assert.That(snapshot.Size, Is.EqualTo(1000));
        }
Example #5
0
 public Histogram GetOrAddHistogram(string name, string description, HistogramConfiguration config = null)
 {
     return(Histograms.GetOrAdd(name, Prometheus.Metrics.CreateHistogram(name, description, config)));
 }
Example #6
0
        static void Main(string[] args)
        {
            // Configure API key authorization: app_id
            Configuration.Default.ApiKey.Add("X-AYLIEN-NewsAPI-Application-ID", "{{current_app_id}}");

            // Configure API key authorization: app_key
            Configuration.Default.ApiKey.Add("X-AYLIEN-NewsAPI-Application-Key", "{{current_app_key}}");

            var apiInstance = new DefaultApi();

            var id = new List <long?>()
            {
                54121
            };
            var notId = new List <long?>()
            {
                21451
            };
            var title    = "startup AND (raise OR raised OR raising OR raises)";
            var body     = "startup";
            var text     = "startup company";
            var language = new List <string>()
            {
                "en", "it"
            };
            var notLanguage = new List <string>()
            {
                "es", "pt"
            };
            var publishedAtStart    = "NOW-10DAYS";
            var publishedAtEnd      = "NOW";
            var categoriesTaxonomy  = "iab-qag";
            var categoriesConfident = true;
            var categoriesId        = new List <string>()
            {
                "IAB15"
            };
            var notCategoriesId = new List <string>()
            {
                "IAB2-3"
            };
            var categoriesLevel = new List <int?>()
            {
                1
            };
            var notCategoriesLevel = new List <int?>()
            {
                2
            };
            var entitiesTitleText = new List <string>()
            {
                "GNU/Linux", "Microsoft"
            };
            var notEntitiesTitleText = new List <string>()
            {
                "Windows"
            };
            var entitiesTitleType = new List <string>()
            {
                "Organization", "Software"
            };
            var notEntitiesTitleType = new List <string>()
            {
                "Person", "Agent"
            };
            var entitiesTitleLinksDbpedia = new List <string>()
            {
                "http://dbpedia.org/resource/Donald_Trump"
            };
            var notEntitiesTitleLinksDbpedia = new List <string>()
            {
                "http://dbpedia.org/resource/Linux"
            };
            var entitiesBodyText = new List <string>()
            {
                "GNU/Linux", "Apple"
            };
            var notEntitiesBodyText = new List <string>()
            {
                "Windows"
            };
            var entitiesBodyType = new List <string>()
            {
                "Person", "Agent"
            };
            var notEntitiesBodyType = new List <string>()
            {
                "Organization", "Software"
            };
            var entitiesBodyLinksDbpedia = new List <string>()
            {
                "http://dbpedia.org/resource/Windows"
            };
            var notEntitiesBodyLinksDbpedia = new List <string>()
            {
                "http://dbpedia.org/resource/Linux"
            };
            var sentimentTitlePolarity      = "positive";
            var notSentimentTitlePolarity   = "negative";
            var sentimentBodyPolarity       = "neutral";
            var notSentimentBodyPolarity    = "negative";
            var mediaImagesCountMin         = 2;
            var mediaImagesCountMax         = 10;
            var mediaImagesWidthMin         = 640;
            var mediaImagesWidthMax         = 1024;
            var mediaImagesHeightMin        = 480;
            var mediaImagesHeightMax        = 800;
            var mediaImagesContentLengthMin = 25411;
            var mediaImagesContentLengthMax = 369541;
            var mediaImagesFormat           = new List <string>()
            {
                "JPEG", "BMP", "GIF"
            };
            var notMediaImagesFormat = new List <string>()
            {
                "PNG", "TIFF"
            };
            var mediaVideosCountMin = 1;
            var mediaVideosCountMax = 4;
            var authorId            = new List <int?>()
            {
                2154
            };
            var notAuthorId = new List <int?>()
            {
                5412
            };
            var authorName    = "John Doe";
            var notAuthorName = "Mike Wally";
            var sourceId      = new List <int?>()
            {
                1467
            };
            var notSourceId = new List <int?>()
            {
                1524
            };
            var sourceName = new List <string>()
            {
                "BBC"
            };
            var notSourceName = new List <string>()
            {
                "Fox News"
            };
            var sourceDomain = new List <string>()
            {
                "bbc.co.uk"
            };
            var notSourceDomain = new List <string>()
            {
                "foxnews.com"
            };
            var sourceLocationsCountry = new List <string>()
            {
                "US", "IE"
            };
            var notSourceLocationsCountry = new List <string>()
            {
                "NG"
            };
            var sourceLocationsState = new List <string>()
            {
                "California"
            };
            var notSourceLocationsState = new List <string>()
            {
                "Arizona"
            };
            var sourceLocationsCity = new List <string>()
            {
                "Los Angeles"
            };
            var notSourceLocationsCity = new List <string>()
            {
                "New York City"
            };
            var sourceScopesCountry = new List <string>()
            {
                "NG", "IE"
            };
            var notSourceScopesCountry = new List <string>()
            {
                "US", "IR"
            };
            var sourceScopesState = new List <string>()
            {
                "Co Dublin"
            };
            var notSourceScopesState = new List <string>()
            {
                "Co Wicklow"
            };
            var sourceScopesCity = new List <string>()
            {
                "Dublin City"
            };
            var notSourceScopesCity = new List <string>()
            {
                "Cork"
            };
            var sourceScopesLevel = new List <string>()
            {
                "local"
            };
            var notSourceScopesLevel = new List <string>()
            {
                "national"
            };
            var sourceLinksInCountMin      = 5000;
            var sourceLinksInCountMax      = 10000;
            var sourceRankingsAlexaRankMin = 1;
            var sourceRankingsAlexaRankMax = 2000;
            var sourceRankingsAlexaCountry = new List <string>()
            {
                "IE"
            };
            var socialSharesCountFacebookMin   = 3521;
            var socialSharesCountFacebookMax   = 5841;
            var socialSharesCountGooglePlusMin = 251;
            var socialSharesCountGooglePlusMax = 6521;
            var socialSharesCountLinkedinMin   = 4125;
            var socialSharesCountLinkedinMax   = 15214;
            var socialSharesCountRedditMin     = 1584;
            var socialSharesCountRedditMax     = 95412;
            var intervalStart = 2500;
            var intervalEnd   = 200000;
            var intervalWidth = 2500;
            var field         = "social_shares_count";

            try
            {
                // List histograms
                Histograms result = apiInstance.ListHistograms(
                    id: id,
                    notId: notId,
                    title: title,
                    body: body,
                    text: text,
                    language: language,
                    notLanguage: notLanguage,
                    publishedAtStart: publishedAtStart,
                    publishedAtEnd: publishedAtEnd,
                    categoriesTaxonomy: categoriesTaxonomy,
                    categoriesConfident: categoriesConfident,
                    categoriesId: categoriesId,
                    notCategoriesId: notCategoriesId,
                    categoriesLevel: categoriesLevel,
                    notCategoriesLevel: notCategoriesLevel,
                    entitiesTitleText: entitiesTitleText,
                    notEntitiesTitleText: notEntitiesTitleText,
                    entitiesTitleType: entitiesTitleType,
                    notEntitiesTitleType: notEntitiesTitleType,
                    entitiesTitleLinksDbpedia: entitiesTitleLinksDbpedia,
                    notEntitiesTitleLinksDbpedia: notEntitiesTitleLinksDbpedia,
                    entitiesBodyText: entitiesBodyText,
                    notEntitiesBodyText: notEntitiesBodyText,
                    entitiesBodyType: entitiesBodyType,
                    notEntitiesBodyType: notEntitiesBodyType,
                    entitiesBodyLinksDbpedia: entitiesBodyLinksDbpedia,
                    notEntitiesBodyLinksDbpedia: notEntitiesBodyLinksDbpedia,
                    sentimentTitlePolarity: sentimentTitlePolarity,
                    notSentimentTitlePolarity: notSentimentTitlePolarity,
                    sentimentBodyPolarity: sentimentBodyPolarity,
                    notSentimentBodyPolarity: notSentimentBodyPolarity,
                    mediaImagesCountMin: mediaImagesCountMin,
                    mediaImagesCountMax: mediaImagesCountMax,
                    mediaImagesWidthMin: mediaImagesWidthMin,
                    mediaImagesWidthMax: mediaImagesWidthMax,
                    mediaImagesHeightMin: mediaImagesHeightMin,
                    mediaImagesHeightMax: mediaImagesHeightMax,
                    mediaImagesContentLengthMin: mediaImagesContentLengthMin,
                    mediaImagesContentLengthMax: mediaImagesContentLengthMax,
                    mediaImagesFormat: mediaImagesFormat,
                    notMediaImagesFormat: notMediaImagesFormat,
                    mediaVideosCountMin: mediaVideosCountMin,
                    mediaVideosCountMax: mediaVideosCountMax,
                    authorId: authorId,
                    notAuthorId: notAuthorId,
                    authorName: authorName,
                    notAuthorName: notAuthorName,
                    sourceId: sourceId,
                    notSourceId: notSourceId,
                    sourceName: sourceName,
                    notSourceName: notSourceName,
                    sourceDomain: sourceDomain,
                    notSourceDomain: notSourceDomain,
                    sourceLocationsCountry: sourceLocationsCountry,
                    notSourceLocationsCountry: notSourceLocationsCountry,
                    sourceLocationsState: sourceLocationsState,
                    notSourceLocationsState: notSourceLocationsState,
                    sourceLocationsCity: sourceLocationsCity,
                    notSourceLocationsCity: notSourceLocationsCity,
                    sourceScopesCountry: sourceScopesCountry,
                    notSourceScopesCountry: notSourceScopesCountry,
                    sourceScopesState: sourceScopesState,
                    notSourceScopesState: notSourceScopesState,
                    sourceScopesCity: sourceScopesCity,
                    notSourceScopesCity: notSourceScopesCity,
                    sourceScopesLevel: sourceScopesLevel,
                    notSourceScopesLevel: notSourceScopesLevel,
                    sourceLinksInCountMin: sourceLinksInCountMin,
                    sourceLinksInCountMax: sourceLinksInCountMax,
                    sourceRankingsAlexaRankMin: sourceRankingsAlexaRankMin,
                    sourceRankingsAlexaRankMax: sourceRankingsAlexaRankMax,
                    sourceRankingsAlexaCountry: sourceRankingsAlexaCountry,
                    socialSharesCountFacebookMin: socialSharesCountFacebookMin,
                    socialSharesCountFacebookMax: socialSharesCountFacebookMax,
                    socialSharesCountGooglePlusMin: socialSharesCountGooglePlusMin,
                    socialSharesCountGooglePlusMax: socialSharesCountGooglePlusMax,
                    socialSharesCountLinkedinMin: socialSharesCountLinkedinMin,
                    socialSharesCountLinkedinMax: socialSharesCountLinkedinMax,
                    socialSharesCountRedditMin: socialSharesCountRedditMin,
                    socialSharesCountRedditMax: socialSharesCountRedditMax,
                    intervalStart: intervalStart,
                    intervalEnd: intervalEnd,
                    intervalWidth: intervalWidth,
                    field: field
                    );
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling DefaultApi.ListHistograms: " + e.Message);
            }
        }
 /// <summary>
 ///		Inicializa los valores
 /// </summary>
 public override void Reset()
 {
     Histograms.Reset();
 }