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

SWATCH-1730: Refactor swatch-tally-hourly Job to use curl and internal endpoint #2545

Merged
merged 1 commit into from Sep 26, 2023

Conversation

Sgitario
Copy link
Contributor

@Sgitario Sgitario commented Sep 21, 2023

Jira issue: SWATCH-1730

Description

For all cronjobs defined in clowdapps, we should migrate to using k8s cronjobs w/ curl against internal endpoints.

Testing

Confirm that the endpoint is executed hourly.
Alternatively, you can deploy the application and overwrite the CAPTURE_HOURLY_SNAPSHOT_SCHEDULE environment property with CAPTURE_HOURLY_SNAPSHOT_SCHEDULE=*/5 * * * * (every 5 min).
Another option is to directly alter the CronJob resource that is generated when installing the Clowd app. The CronJob to modify is named "swatch-tally-hourly".

Then, in the logs of the job created, you should see:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0{"status":"Success"}100 20 100 20 0 0 56 0 --:--:-- --:--:-- --:--:-- 56

And in the logs of the swatch tally service:

2023-09-21 09:35:02,283 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.security.LogPrincipalFilter] self- Internal API: /api/rhsm-subscriptions/v1/internal/rpc/tally/snapshots requested by user: self
2023-09-21 09:35:02,386 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.tally.admin.InternalTallyResource] self- Hourly tally for all accounts triggered over API by self
2023-09-21 09:35:02,510 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.tally.job.CaptureSnapshotsTaskManager] self- Queuing all org hourly snapshot in batches of size one
2023-09-21 09:35:02,522 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.tally.job.CaptureSnapshotsTaskManager] self- Done queuing hourly snapshot production for 0 accounts.

So, the call was made and we confirmed that the service processed it.

@Sgitario Sgitario added the QE Pull request should be approved by QE before merge label Sep 21, 2023
@kflahert kflahert self-assigned this Sep 21, 2023
@ssidhaye
Copy link

/retest

Copy link

@ssidhaye ssidhaye left a comment

Choose a reason for hiding this comment

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

After modifying the cron schedule to run every 5 minutes.
Following tally-service log messages are seen:

2023-09-26 09:00:04,135 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.security.LogPrincipalFilter] self- Internal API: /api/rhsm-subscriptions/v1/internal/rpc/tally/snapshots requested by user: self
2023-09-26 09:00:04,286 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.tally.admin.InternalTallyResource] self- Hourly tally for all accounts triggered over API by self
2023-09-26 09:00:04,476 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.tally.job.CaptureSnapshotsTaskManager] self- Queuing all org hourly snapshot in batches of size one
2023-09-26 09:00:04,492 [thread=http-nio-8000-exec-1] [INFO ] [org.candlepin.subscriptions.tally.job.CaptureSnapshotsTaskManager] self- Done queuing hourly snapshot production for 0 accounts.```

@Sgitario
Copy link
Contributor Author

/retest

@Sgitario Sgitario merged commit f191329 into RedHatInsights:main Sep 26, 2023
10 of 11 checks passed
@Sgitario Sgitario deleted the SWATCH-1730 branch September 26, 2023 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
QE Pull request should be approved by QE before merge
Projects
None yet
3 participants