Skip to content

Configuration for Fossdash metric reporting

Darshan Kansagara edited this page Aug 26, 2020 · 6 revisions

How to configure Fossdash metric-reporting config

Example of fossdash_metrics.yml

# If you want to add new metric
#   - Include name of query metric (e.g pfile_count ) in QUERIES_NAME
#   - Add same query metric name (pfile_count) and its respective query to fetch data from FossologyDB in QUERY.
#   - Make sure to follow yaml file standards

QUERIES_NAME: [
    "number_of_users", "number_of_groups", "number_of_file_uploads",
    "number_of_projects__theoretically", "number_of_url_uploads",
    "agents_count", "number_of_upload_status", "number_of_projects_per_size",
    "reportgen_count", "pfile_count", "avg_pfile_count", "job_count"]

QUERY:
  number_of_users: "SELECT count(u.*) AS users FROM users u;"
  number_of_groups: "SELECT count(g.*) AS groups FROM groups g;"
  number_of_projects__theoretically: "SELECT count(up.*) as uploads from (select distinct upload_mode, upload_origin from upload) up;"
  number_of_file_uploads: "SELECT count(up1.upload_origin) as file_uploads FROM upload up1 WHERE up1.upload_mode = 104;"
  number_of_url_uploads: "SELECT count(up2.upload_origin) as url_uploads FROM upload up2 WHERE up2.upload_mode = 100;"
  agents_count: "SELECT ag.agent_name,count(jq.*) AS fired_jobs FROM agent ag LEFT OUTER JOIN jobqueue jq ON (jq.jq_type = ag.agent_name) GROUP BY ag.agent_name ORDER BY fired_jobs DESC;"
  number_of_upload_status: "select CASE WHEN a.status=1 THEN 'open' WHEN a.status=2 THEN 'in_progres' WHEN a.status=3 THEN 'closed' WHEN a.status=3 THEN 'rejected' ELSE 'unknown' END status, a.count from (select status_fk status, count(1) as count from upload_clearing group by status_fk) a;"
  number_of_projects_per_size: "select t.size, count(t.size) from (select CASE WHEN s.sx<2000 THEN 'small' WHEN s.sx>=2000 and s.sx<10000 THEN 'normal' ELSE 'big' END size from (select count(ut.ufile_name) sx from uploadtree ut group by upload_fk) s) t group by t.size;"
  reportgen_count: "select count(*) from reportgen;"
  pfile_count: "select count(*) from pfile;"
  avg_pfile_count: "select COALESCE(round(avg(pfile_size)),0) from pfile;"
  job_count: "select count(*) as jobs from job;"

VERSION_INFO:
  display: "YES"    # NO, If don't want to display VERSION and BUILD info

Adding new QUERY metric

  • Include the name of query metric (e.g pfile_count ) in QUERIES_NAME
  • Add the same query metric name (pfile_count) and its respective query to fetch data from FossologyDB into QUERY.
  • Example
    • Add new query name in the QUERIES_NAME list;
      •   QUERIES_NAME: [ ... , "pfile_count" ]
    • Add same query name and its related DB_query to fetch the data from Postgres (fossologyDB) in QUERY
      •   QUERY:
             ... 
             ...
             pfile_count: "select count(*) from pfile;" 

VERSION_INFO config

  • you can enable VERSION_INFO metric into the dashboard by display: "YES"
  • you can disable VERSION_INFO metric into the dashboard by display: "NO"
  • It shows the following information into the dashboard.
    • version = 3.8.0
    • total_commit = 102
    • latest_commit_id = gbcc7e973b
    • branch = fossdash_gsoc2020
    • build_date = 2020/08/25
    • commit_date = 2020/08/25