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

feat: add warmup requests #11

Merged
merged 4 commits into from
Oct 7, 2024
Merged

feat: add warmup requests #11

merged 4 commits into from
Oct 7, 2024

Conversation

pietro-tota
Copy link
Contributor

@pietro-tota pietro-tota commented Oct 7, 2024

List of Changes

Add logic to perform controller warmup:
warmup function will execute POST and GET api call to warmup controllers.
For userId have been used a special null UUID that is an UUID set to 0

Motivation and Context

Those modifications are needed in order to perform Controller warmups before making service ready

How Has This Been Tested?

Local tests + test in DEV env (service deploy checking warmup requests are performed at service startup)

Screenshots (if appropriate):

{"@timestamp":"2024-10-07T13:41:32.141Z","log.level": "INFO","message":"Found controllers: [1]","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"main","log.logger":"it.pagopa.ecommerce.users.warmup.ControllersWarmup"}
{"@timestamp":"2024-10-07T13:41:34.055Z","log.level": "INFO","message":"Invoking function: [fun it.pagopa.ecommerce.users.controllers.v1.LastUsageController.saveAndGetUserLastPaymentMethodUsedWarmupFunction(): kotlin.Unit]","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"main","log.logger":"it.pagopa.ecommerce.users.warmup.ControllersWarmup"}
{"@timestamp":"2024-10-07T13:41:43.843Z","log.level": "INFO","message":"Saving last used method for userId: [00000000-0000-0000-0000-000000000000]. Last method used data: [class WalletLastUsageData {\n    walletId: 00000000-0000-0000-0000-000000000000\n    date: 2024-10-07T13:41:34.940471541Z\n    type: wallet\n}]","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"reactor-http-epoll-4","log.logger":"it.pagopa.ecommerce.users.services.UserStatisticsService","trace_id":"16af23acb23c2d4dbef58f800260c9b3","trace_flags":"01","span_id":"9197087a6f383777"}
{"@timestamp":"2024-10-07T13:41:49.247Z","log.level": "INFO","message":"Finding last method used for userId: [00000000-0000-0000-0000-000000000000]","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"reactor-http-epoll-3","log.logger":"it.pagopa.ecommerce.users.services.UserStatisticsService","trace_id":"98e2192e8d0896b080e2c354ee49fbe4","trace_flags":"01","span_id":"004f2f2aff3578e7"}
{"@timestamp":"2024-10-07T13:41:50.358Z","log.level": "INFO","message":"Last used data found for userId: [00000000-0000-0000-0000-000000000000] -> class WalletLastUsageData {\n    walletId: 00000000-0000-0000-0000-000000000000\n    date: 2024-10-07T13:41:34.940471541Z\n    type: null\n}","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"nioEventLoopGroup-3-2","log.logger":"it.pagopa.ecommerce.users.services.UserStatisticsService","trace_id":"98e2192e8d0896b080e2c354ee49fbe4","trace_flags":"01","span_id":"004f2f2aff3578e7"}
{"@timestamp":"2024-10-07T13:41:50.446Z","log.level": "INFO","message":"Warmup function: [fun it.pagopa.ecommerce.users.controllers.v1.LastUsageController.saveAndGetUserLastPaymentMethodUsedWarmupFunction(): kotlin.Unit] -> elapsed time: [16396]. Is ok: [true] ","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"main","log.logger":"it.pagopa.ecommerce.users.warmup.ControllersWarmup"}
{"@timestamp":"2024-10-07T13:41:50.446Z","log.level": "INFO","message":"Controller: [class it.pagopa.ecommerce.users.controllers.v1.LastUsageController] warm-up executed functions: [1], elapsed time: [18304] ms","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"main","log.logger":"it.pagopa.ecommerce.users.warmup.ControllersWarmup"}
{"@timestamp":"2024-10-07T13:41:50.450Z","log.level": "INFO","message":"Started UserApplicationKt in 97.708 seconds (process running for 130.488)","ecs.version": "1.2.0","service.name":"undefined","service.version":"0.1.2","service.environment":"undefined","event.dataset":"undefined","process.thread.name":"main","log.logger":"it.pagopa.ecommerce.users.UserApplicationKt"}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

Copy link

sonarqubecloud bot commented Oct 7, 2024

@pietro-tota pietro-tota merged commit 081fc2f into main Oct 7, 2024
11 checks passed
@pietro-tota pietro-tota deleted the CHK-3302-warmup branch October 7, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants