-
Notifications
You must be signed in to change notification settings - Fork 80
feat(scorecard): add database and schedulers #1544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
2d44cf7 to
7449254
Compare
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Unexpected ChangesetsThe following changeset(s) reference packages that have not been changed in this PR:
Note that only changes that affect the published package require changesets, for example changes to tests and storybook stories do not require changesets. Changed Packages
|
7449254 to
97b6ba1
Compare
07a5a55 to
5e87ead
Compare
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Dominika Zemanovicova <dzemanov@redhat.com>
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
5e87ead to
2883b1d
Compare
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
2883b1d to
2964f31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would rename to Scheduler since you already have scheduler.test.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose renaming the tests from scheduler.test.ts to index.test.ts for better code consistency. The reason is that if we rename the file as you propose, the imports will look strange. For example: import { Scheduler } from './scheduler/scheduler'. I think we can avoid this awkward import
| * limitations under the License. | ||
| */ | ||
|
|
||
| export const CLEANUP_EXPIRED_METRICS_ID = 'cleanup-expired-metrics' as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would maybe prefix it with scorecard: just to be sure it doesn't intersect anything.
| private readonly scheduler: SchedulerService, | ||
| private readonly logger: LoggerService, | ||
| private readonly database: DatabaseMetricValues, | ||
| private readonly config: Config, | ||
| private readonly catalog: CatalogService, | ||
| private readonly auth: AuthService, | ||
| private readonly provider: MetricProvider, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This to me looks like a lot of params. Just a recommendation, we could group under options or similiar name all except provider.
| '@red-hat-developer-hub/backstage-plugin-scorecard': minor | ||
| --- | ||
|
|
||
| Adds database persistence and scheduled metric collection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add breaking here since we are now requiring getCatalogFilter
**BREAKING**: ...
- Add information about what is breaking - getCatalogFilter
| `Deleted ${deletedCount} expired metrics older than ${dataRetentionDays} days`, | ||
| ); | ||
| } catch (error) { | ||
| logger.error(`Failed to cleanup expired metrics:`, error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this line here, as it's already on line 61? Or is there another spot where this function is called from that could expect to receive the exception thrown on the next line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your comment, this logger is not necessary I will remove it
1747733 to
a127942
Compare
Signed-off-by: Ihor Mykhno <imykhno@redhat.com>
a127942 to
12fae92
Compare
|



Hey, I just made a Pull Request!
Adds database.
Adds schedulers.
Fixes
https://issues.redhat.com/browse/RHIDP-8717
How to test
Creates db directory under scorecard/packages
Or:
For testing purposes, you can update schedule to fetch metrics more often:
You should see in logs:
✔️ Checklist