Project

General

Profile

Feature #31147

Extend StatusCalculator to make use of 64 bits

Added by Lukas Zapletal 6 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Category:
Reporting
Target version:
-
Difficulty:
easy
Triaged:
Yes
Bugzilla link:

Description

ConfigReportStatusCalculator class is too tightly coupled with ConfigReport (using MAX and other constants). This needs to be decoupled there is no reason to have it like that, this will also enable using this class in the modernized report engine.

Also we currently do not indicate that the maximum number has been reached (e.g. 63 currently for puppet). There should be a helper method that returns numbers as strings returning "63+" in case the ceiling is reached. This should be used in templates to render those number correctly so users can actually recognize this hidden fact.

Next up, status is a "BIG INT" in our database schema which is 64 bits however currently the class does not make use of all bits for some reason: 36 bits are used for some strange reason in Puppet case. This will allow larger numbers. Migration must be done to convert current reports into the wider format.

Finally, there is an existing index named index_reports_on_status on the status column, but this is useless - this will never be used since scoped_search use bitwise shift and and operators: https://github.com/wvanbergen/scoped_search/blob/6fe6b86c223d7ba8eb14207bae8f4c28f676d9d0/lib/scoped_search/query_builder.rb#L343

In order to use an index, it would have to be a dynamic index on (status >> 8) but this can't be done since it is unknown how many bits are used in each plugin. The index should be simply dropped as unused.


Related issues

Related to Foreman - Feature #31145: Create ReportTranscript model, import API and Puppet importer and view APINew

Associated revisions

Revision ef4f8259 (diff)
Added by Lukas Zapletal 5 months ago

Fixes #31147 - extend StatusCalculator to use 64 bits

Revision 90ea9bb0 (diff)
Added by Simon Peeters about 1 month ago

Refs #31147 - Correct coloring of zero metrics in report overviews

pr #8118 changed to the use of strings for these metrics.
This made the comparison with the integer of 0 fail, resulting in all
metrics being colord even if they were 0

That same pr also failed to apply this change to the reports widget,
which is updated here to have the same behaviour as the
config_reports/_list view

History

#1 Updated by Lukas Zapletal 6 months ago

  • Related to Feature #31145: Create ReportTranscript model, import API and Puppet importer and view API added

#2 Updated by Lukas Zapletal 6 months ago

  • Description updated (diff)

#3 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8118 added

#4 Updated by The Foreman Bot 5 months ago

  • Fixed in Releases 2.4.0 added

#5 Updated by Lukas Zapletal 5 months ago

  • Status changed from Ready For Testing to Closed

#6 Updated by The Foreman Bot about 1 month ago

  • Pull request https://github.com/theforeman/foreman/pull/8406 added

Also available in: Atom PDF