<commit_before>'use strict';

const statsHelpers = require('../../support/statsHelpers');

module.exports = {
  urls: {},
  categories: {},

  addToAggregate(url, requestsByCategory, toolsByCategory) {
    if (this.urls[url] === undefined) {
      this.urls[url] = {};
      this.categories[url] = {};
    }
    for (let category of Object.keys(requestsByCategory)) {
      statsHelpers.pushStats(
        this.urls[url],
        category,
        requestsByCategory[category]
      );
    }

    for (let category of Object.keys(toolsByCategory)) {
      statsHelpers.pushStats(
        this.categories[url],
        category,
        Object.keys(toolsByCategory[category]).length
      );
    }
  },
  summarize() {
    const summary = {};
    for (let url of Object.keys(this.urls)) {
      summary[url] = {};
      // Collect how many requests that is done per type
      for (let category of Object.keys(this.urls[url])) {
        statsHelpers.setStatsSummary(
          summary[url],
          'category.' + category + '.requests',
          this.urls[url][category]
        );
      }
      // And also collect per category
      for (let category of Object.keys(this.categories[url])) {
        statsHelpers.setStatsSummary(
          summary[url],
          'category.' + category + '.tools',
          this.categories[url][category]
        );
      }
    }
    return summary;<commit_msg>thirdparty: send one 0 request so its easier to setup dashboards etc<commit_after>'use strict';

const statsHelpers = require('../../support/statsHelpers');

module.exports = {
  urls: {},
  categories: {},

  addToAggregate(url, requestsByCategory, toolsByCategory) {
    if (this.urls[url] === undefined) {
      this.urls[url] = {};
      this.categories[url] = {};
    }
    for (let category of Object.keys(requestsByCategory)) {
      statsHelpers.pushStats(
        this.urls[url],
        category,
        requestsByCategory[category]
      );
    }

    for (let category of Object.keys(toolsByCategory)) {
      statsHelpers.pushStats(
        this.categories[url],
        category,
        Object.keys(toolsByCategory[category]).length
      );
    }
  },
  summarize() {
    const summary = {};
    for (let url of Object.keys(this.urls)) {
      summary[url] = {
        category: {
          survelliance: { requests: { median: 0 }, tools: { median: 0 } }
        }
      };
      // Collect how many requests that is done per type
      for (let category of Object.keys(this.urls[url])) {
        statsHelpers.setStatsSummary(
          summary[url],
          'category.' + category + '.requests',
          this.urls[url][category]
        );
      }
      // And also collect per category
      for (let category of Object.keys(this.categories[url])) {
        statsHelpers.setStatsSummary(
          summary[url],
          'category.' + category + '.tools',
          this.categories[url][category]
        );
      }
    }
    return summary;
{'fraction_non_alphanumeric': 0.1329284750337382, 'fraction_numerical': 0.0010121457489878543, 'mean_word_length': 2.2333696837513632, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4722241', 'n_tokens_mistral': 835, 'n_tokens_neox': 854, 'n_words': 180}