def generateHistogramQuery_OS_segments_legacy()

in lib/telemetry.py [0:0]


  def generateHistogramQuery_OS_segments_legacy(self, histogram):
    t = get_template("experiment/legacy/histogram_os_segments.sql")

    isp_blacklist = []
    if 'isp_blacklist' in self.config:
      with open(self.config['isp_blacklist'], 'r') as file:
        isp_blacklist = [line.strip() for line in file]

    context = {
        "include_non_enrolled_branch": self.config['include_non_enrolled_branch'],
        "slug": self.config['slug'],
        "channel": self.config['channel'],
        "startDate": self.config['startDate'],
        "endDate": self.config['endDate'],
        "histogram": histogram,
        "available_on_desktop": self.config['histograms'][histogram]['available_on_desktop'],
        "available_on_android": self.config['histograms'][histogram]['available_on_android'],
        "blacklist": isp_blacklist
    }
    query = t.render(context)
    # Remove empty lines before returning
    query = "".join([s for s in query.strip().splitlines(True) if s.strip()])
    self.queries.append({
      "name": f"Histogram: {histogram}",
      "query": query
    })
    return query