Skip to content
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

Add switch to turn collectors on/off #590

Merged
merged 1 commit into from
Jun 19, 2024
Merged

Add switch to turn collectors on/off #590

merged 1 commit into from
Jun 19, 2024

Conversation

dmonzonis
Copy link
Contributor

This commit implements a way to turn off each collector using an environment variable. Turning it off means it won't be caught by celery, and therefore it won't be run automatically, although the collectors can still be run manually from a shell even if they have been turned off.

There is an environment variable for each of the collector groups: Bugzilla, Jira, Errata Tool, NVD and OSV. This means they can each be turned on/off individually.

The collectors are turned on by default.

Closes OSIDB-2884.

@dmonzonis dmonzonis requested a review from a team June 18, 2024 11:03
Copy link
Contributor

@JakubFrejlach JakubFrejlach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small consideration, otherwise LGTM!

Comment on lines 154 to 161
BZ_COLLECTOR_ENABLED: ${BZ_COLLECTOR_ENABLED}
ERRATA_COLLECTOR_ENABLED: ${ERRATA_COLLECTOR_ENABLED}
JIRA_COLLECTOR_ENABLED: ${JIRA_COLLECTOR_ENABLED}
NVD_COLLECTOR_ENABLED: ${NVD_COLLECTOR_ENABLED}
OSV_COLLECTOR_ENABLED: ${OSV_COLLECTOR_ENABLED}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consideration: Do we want to add these here and to the ops repo env variables reference files?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe even into docker-compose.test.yml to disable collectors on localhost?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jobselko AFAIK docker-compose.test.yml only defines the test pods, and the celery pods are defined in docker-compose.yml so adding the env vars there should be enough to be able to enable/disable them in localhost

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also thinking about the OPS repo. As most of the case we want the collectors on and they are on by default we do not have to add them there. The only case I would be for adding is to disable the UAT flaw collector. When it is enable but the BBSync is disabled it results in weird situations when something may be created internally in the DB and then synced from Bugzilla once more (eg. Assembler collector duplicates).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osoukup I made a PR to add these variables in the ops repo

Copy link
Contributor

@osoukup osoukup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a higher granularity - on collector level, not module level. Otherwise the mechanism looks great, this is exactly what we need.

collectors/bzimport/constants.py Outdated Show resolved Hide resolved
collectors/jiraffe/tasks.py Outdated Show resolved Hide resolved
Comment on lines 154 to 161
BZ_COLLECTOR_ENABLED: ${BZ_COLLECTOR_ENABLED}
ERRATA_COLLECTOR_ENABLED: ${ERRATA_COLLECTOR_ENABLED}
JIRA_COLLECTOR_ENABLED: ${JIRA_COLLECTOR_ENABLED}
NVD_COLLECTOR_ENABLED: ${NVD_COLLECTOR_ENABLED}
OSV_COLLECTOR_ENABLED: ${OSV_COLLECTOR_ENABLED}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also thinking about the OPS repo. As most of the case we want the collectors on and they are on by default we do not have to add them there. The only case I would be for adding is to disable the UAT flaw collector. When it is enable but the BBSync is disabled it results in weird situations when something may be created internally in the DB and then synced from Bugzilla once more (eg. Assembler collector duplicates).

This commit implements a way to turn off each collector using an
environment variable. Turning it off means it won't be caught by celery,
and therefore it won't be run automatically, although the collectors can
still be run manually from a shell even if they have been turned off.

There is an environment variable for each of the collector groups:
Bugzilla, Jira, Errata Tool, NVD and OSV. This means they can each be
turned on/off individually.

The collectors are turned on by default.

Closes OSIDB-2884.
Copy link
Contributor

@osoukup osoukup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmonzonis dmonzonis added this pull request to the merge queue Jun 19, 2024
Merged via the queue into master with commit 9babbc2 Jun 19, 2024
11 checks passed
@dmonzonis dmonzonis deleted the collector-switch branch June 19, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants