Commit Graph

312 Commits

Author SHA1 Message Date
weicao
81628407df fixed: code standard and env file 2025-09-19 16:03:29 +08:00
weicao
62533859ba fixed: code standard and env file 2025-09-19 15:58:23 +08:00
weicao
b7858c193e fixed some code standard 2025-09-19 15:32:00 +08:00
YuehuCao
065c082aa7 feat(guide): guide to use tenant middleware 2025-09-19 12:15:05 +08:00
YuehuCao
9dc8811886 refactor(database): move the initialization of database into tenant middleware 2025-09-19 12:14:16 +08:00
YuehuCao
e726d7e7d5 feat(name): use new name 2025-09-19 12:13:12 +08:00
YuehuCao
115b54ad58 refactor(name): rename the tenant DB connection middleware 2025-09-19 12:11:51 +08:00
weicao
f902edd49d fixed: <= to < 2025-09-19 10:38:18 +08:00
weicao
98405934ce feat(change code structure) 2025-09-19 10:29:10 +08:00
weicao
97240e598a Merge remote-tracking branch 'origin/dev' into feature/wc 2025-09-19 10:20:06 +08:00
icecheng
ddbf509713 Merge branch 'feature/icecheng/metrics' into feature/wc
# Conflicts:
#	apps/metrics/common/config/app_settings.py
#	apps/metrics/webapi/main.py
#	apps/metrics/webapi/routes/metrics/__init__.py
#	apps/metrics/webapi/routes/metrics/registration_metrics.py
2025-09-18 17:46:12 +08:00
weicao
3a05ec5001 metrics: restructure starrocks routes, move database client, align APIs, Docker updates 2025-09-18 17:19:27 +08:00
icecheng
38ff0ae32a feat: update Dockerfile 2025-09-18 16:55:42 +08:00
YuehuCao
60fedf5215 merge the dev branch 2025-09-18 15:56:42 +08:00
YuehuCao
1ba9a614a0 feat(config): add configs regarding the tenant middleware 2025-09-18 15:54:57 +08:00
YuehuCao
a2fc3c8a7e feat(tenant-middleware): add tenant middleware to switch tenant's database 2025-09-18 15:53:03 +08:00
071694cefe Merge pull request 'tania_middleware' (#46) from tania_middleware into dev
Reviewed-on: freeleaps/freeleaps-service-hub#46
2025-09-18 01:41:31 +00:00
YuehuCao
f27080452c feat(log): log the failure na d sucess of interface 2025-09-17 17:57:37 +08:00
YuehuCao
9473c19141 fix(path): fix the skip path 2025-09-17 17:56:24 +08:00
YuehuCao
9939a3f430 fix(exclude): ban the exclusive mode 2025-09-17 13:32:28 +08:00
icecheng
1baf9065dc feat: add design.md 2025-09-16 17:38:57 +08:00
icecheng
c963350fc9 feat: add promql for latency and reliability 2025-09-16 17:20:37 +08:00
icecheng
d008c1a8bc feat: add support for Prometheus-related metrics 2025-09-16 17:07:24 +08:00
YuehuCao
03bd84ba9a feat(permission): use new defined permission 2025-09-16 16:30:43 +08:00
YuehuCao
a3f8d7b8cf feat(role&permission): migrate the roles and permissions from freeleaps to authentication 2025-09-16 16:28:15 +08:00
icecheng
7027e8c3f7 refactor: refactor the metric project structure 2025-09-16 15:17:23 +08:00
weicao
35fbda6954 Refactor metrics service: rename files for better readability
- Rename starrocks_client.py -> database_client.py
- Rename daily_registered_users.py -> user_registration_models.py
- Rename daily_registration_service.py -> registration_analytics_service.py
- Rename daily_registration.py -> registration_metrics.py
- Rename site_settings.py -> app_settings.py
- Rename application.py -> app_factory.py
- Update all import statements and references
- Update README.md with new file structure
2025-09-15 16:31:20 +08:00
weicao
b490ced2f0 Clean up metrics service: remove unnecessary files, update Dockerfile, and add README 2025-09-15 15:22:52 +08:00
YuehuCao
3a6e0e1ca1 feat(config): add auth endpoint to dockerfile 2025-09-12 17:02:17 +08:00
YuehuCao
6ecee2837e feat(name): rename 2025-09-12 16:10:31 +08:00
YuehuCao
6630d20c13 feat(rename): rename the api_key 2025-09-12 16:05:19 +08:00
YuehuCao
c5cfb5a424 feat(log): use str to ensure that class can be identified 2025-09-11 22:28:55 +08:00
YuehuCao
282d1bcd93 feat(integrate api): integrate external auth introspect api 2025-09-11 22:28:03 +08:00
YuehuCao
da75ba746c feat(register): register the middleware 2025-09-11 22:27:05 +08:00
YuehuCao
6256b3377d feat(middleware): add the middleware for auth service 2025-09-11 22:26:11 +08:00
YuehuCao
bf1e476c0b feat(config): add the AUTH_SERVICE_ENDPOINT 2025-09-11 22:24:56 +08:00
YuehuCao
1c70143f2d feat(doc): add new doc and register into mongodb 2025-09-11 22:23:46 +08:00
YuehuCao
cea505cbdd feat(config): add the AUTH_SERVICE_ENDPOINT to the .env file 2025-09-11 22:18:21 +08:00
weicao
79a1b62f68 Add .env configuration file for metrics service 2025-09-11 17:40:18 +08:00
weicao
44f08eee68 Add metrics service with user registration API endpoints
- Add complete metrics microservice structure
- Implement StarRocks database integration
- Add user registration data query APIs:
  - Daily registered users by date range
  - Recent N days registration data
  - Registration data by start date and days
  - Registration summary statistics
- Add comprehensive error handling and logging
- Include test scripts and documentation
2025-09-11 17:35:20 +08:00
YuehuCao
05aca96639 feat(template): add the new job notification template 2025-09-08 17:10:01 +08:00
4f09a5e4df Merge pull request 'feat(websockt): add websocket' (#43) from tania_local into dev
Reviewed-on: freeleaps/freeleaps-service-hub#43
Reviewed-by: jingyao1991 <jingyao1991@noreply.gitea.freeleaps.mathmast.com>
2025-09-05 01:24:04 +00:00
YuehuCao
d20b5abff5 feat(websockt): add websocket 2025-09-04 15:56:56 +08:00
icecheng
52f8715241 feat(devops): If ttl_hours < 0, the deployment will take effect permanently 2025-09-03 16:36:33 +08:00
165e10c79d Merge pull request 'tania_local' (#40) from tania_local into dev
Reviewed-on: freeleaps/freeleaps-service-hub#40
Reviewed-by: jingyao1991 <jingyao1991@noreply.gitea.freeleaps.mathmast.com>
2025-08-29 01:11:13 +00:00
YuehuCao
8a5343156c feat(email): remove rate limit functionality 2025-08-28 16:23:57 +08:00
sunhaolou
c200e70970 feat: add new apis for Magicleaps product use 2025-08-25 17:31:16 +08:00
7c69fd84ab Merge branch 'dev' into tania_local 2025-08-21 03:39:19 +00:00
9120104cf5 Delete apps/notification/tests/alpha.env
chore(config): remove redundant environment configs
2025-08-19 16:39:37 +00:00
YuehuCao
d7a615b8ea chore(config): remove redundant environment configs 2025-08-20 00:35:59 +08:00
YuehuCao
a0b63cd0be refactor(test): relocate template tests to integration suite 2025-08-20 00:34:33 +08:00
YuehuCao
fc2aaebf94 chore: remove redundant email test file 2025-08-20 00:27:24 +08:00
YuehuCao
09b1017027 chore(alpha.env): Move alpha.env to tests, because this file is only used to verify local-to-alpha connectivity and should not live at the project root 2025-08-19 09:57:02 +08:00
YuehuCao
2213fa59b5 feat(templates): enforce uniqueness and improve safety
- Raise TemplateExistsError when duplicate detected
- Migrate placeholder syntax from {} to {{}}
- Add validation for:
  * Reserved keyword collisions
  * Injection attempt patterns
- Update all test cases
2025-08-18 22:15:43 +08:00
YuehuCao
e2a049a658 style: remove empty lines 2025-08-15 23:24:18 +08:00
YuehuCao
b9bd4f373e fix(email_sending): resolve the NameError 2025-08-15 15:42:11 +08:00
YuehuCao
5b727cb51c fix(email sending): guidance for use of exchange 2025-08-15 00:23:22 +08:00
YuehuCao
59e8c06078 feat(alpha): make the alpha environment available 2025-08-14 21:36:38 +08:00
YuehuCao
b8aa0cf2b9 fix(email_sending): use the template created and stored in mongodb 2025-08-14 21:35:14 +08:00
YuehuCao
d829cbf90d test(api): test the api interfaces cao work 2025-08-14 21:11:58 +08:00
YuehuCao
370cd61fd2 refactor(email_sender): change email_sender type from list to str 2025-08-14 21:08:43 +08:00
YuehuCao
b6d5ae97ee test(email): test the email sending function, and this file can be deleted 2025-08-13 22:41:51 +08:00
YuehuCao
72ba74618b chore: set up local testing 2025-08-13 22:23:49 +08:00
YuehuCao
6d7c6af8a1 fix(email): make these changes to Fixed the duplicate email sending bug 2025-08-13 22:22:12 +08:00
YuehuCao
58c77ce002 feat(templates): add duplicate creation prevention 2025-08-12 13:58:08 +08:00
6132f98283 Merge branch 'dev' into feature/icecheng/role_management 2025-08-12 03:24:03 +00:00
icecheng
e2f51d09da feat(role): update docs 2025-08-12 11:17:52 +08:00
YuehuCao
f5206175da refactor(routes): sync port with changed route 2025-08-11 23:20:32 +08:00
YuehuCao
91b84434d0 chore(config): change the port to keep similarity with authentication of magicleaps
refactor(routes): shorten API endpoint
2025-08-11 23:13:24 +08:00
YuehuCao
40a43aa538 chore(infra): remove Chinese comments 2025-08-11 18:54:26 +08:00
YuehuCao
f95552ff4d chore: add local testing configs and MongoDB message templates 2025-08-11 18:50:43 +08:00
YuehuCao
830311fe7e feat(routes): add API setup support for route files 2025-08-11 16:14:37 +08:00
YuehuCao
c968f3a594 chore(test): remove unusful tests 2025-08-11 15:47:08 +08:00
YuehuCao
350270fe6e refactor(services): correct misleading error log output 2025-08-11 15:40:29 +08:00
YuehuCao
0a01b1c6c6 feat(service): Add email status update handling for bounce cases 2025-08-11 15:33:43 +08:00
YuehuCao
1d6f41c3b5 Refactor(application): Extract default email as magic values to avoid hardcoding 2025-08-11 15:30:40 +08:00
YuehuCao
11c1cc811d Refactor(application): Extract frequently used value into class-level constant
email_sender_hub.py: extract email_sender_manager = EmailSenderManager()
notification_hub.py: extract notification_manager = NotificationManager()
template_message_hub.py: extract template_message_manager = TemplateMessageManager()
template_message_hub.py: add more details in render_template function
2025-08-11 15:21:17 +08:00
dongli
8caa8e6b31 Add dummy change to trigger ci/cd 2025-08-10 18:21:39 -07:00
YuehuCao
cc90c862d7 feat(multi-tenant): define the send status and bounce type 2025-08-09 11:57:37 +08:00
YuehuCao
b6f8b70f69 fix(notification): some small changes 2025-08-09 11:56:00 +08:00
YuehuCao
7cb5ba4a78 refactor(version): replace legacy version with HTML update 2025-08-09 11:47:38 +08:00
YuehuCao
b5c9ab6126 feat(email): implement multi-tenant delivery function 2025-08-09 11:34:15 +08:00
YuehuCao
4187c95743 feat(email_comsumer): introduce multi-tenant delivery system 2025-08-09 11:27:17 +08:00
YuehuCao
d164b6f567 feat(email_sending): introduce multi-tenant delivery system 2025-08-09 11:25:47 +08:00
Nicolas
04acd78d78 fix: connect to existing named queue instead of creating anonymous queue
- Change AsyncMQClient to connect to existing persistent queue by name
- Fix issue where DevOps Service created temporary anonymous queues instead of consuming from the correct named queue
- This allows consuming the 42 backlogged messages in freeleaps.devops.reconciler.output queue
- Change queue properties: exclusive=False, auto_delete=False, durable=True
- Resolves the core issue where messages were split between persistent and temporary queues
2025-08-08 12:45:21 +08:00
Nicolas
4340949f57 fix: make startup and shutdown event handlers async in common provider
- Fix TypeError: object NoneType can't be used in 'await' expression
- FastAPI requires event handlers to be async functions
- This was blocking the entire application startup sequence
- Fixes the issue where message queue consumers were not starting properly
2025-08-08 12:33:14 +08:00
Nicolas
e4fe9394b1 fix: use environment variable for RabbitMQ output queue name
- Add RABBITMQ_OUTPUT_QUEUE_NAME environment variable support
- Fix hardcoded queue name 'reconciler.output' to use configurable queue name
- Default to 'freeleaps.devops.reconciler.output' if env var not set
- Add debug logging to show which queue name is being used
- This fixes the issue where 42 messages were stuck in the output queue due to queue name mismatch
2025-08-08 12:01:47 +08:00
Nicolas
b5ca0cf0f5 fix: update devops service to subscribe to correct reconciler heartbeat queue 2025-08-07 18:29:59 +08:00
YuehuCao
2f10275493 refactor(architecture): implement 5-layer separation
for both template message and email senders, their workflow will follow:
api->application->business->service->infra
2025-08-07 12:58:19 +08:00
YuehuCao
58d085a4c6 feat(api): re-code the api interfaces for template message and email senders 2025-08-07 12:49:12 +08:00
YuehuCao
c1148a44d5 feat(models): add indexs and models
add high-frequent indexes for TemplateMessageDoc and EmailSenderDoc
add some models that will be used in sending email
2025-08-07 12:44:46 +08:00
dongli
d680b9e015 Fix check_deployment_status 2025-08-03 21:39:39 -07:00
zhenyus
879e45eeb5 fix: correct deployment TTL calculation in DeploymentService
Updated the TTL calculation in the DeploymentService to multiply by 3600 instead of 60, ensuring accurate time-to-live settings for deployments.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 12:22:24 +08:00
zhenyus
6c60a0b6a5 fix: update deployment service to use correct product ID
Changed the parameter name from deployment_project_id to deployment_product_id in the DevOpsReconcileRequest to ensure accurate referencing of the product associated with the deployment.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 04:04:19 +08:00
zhenyus
5f3368cbdc fix: correct typo in BASE_RECONCILE_URL parameter in DeploymentService
Updated the parameter name in the _start_deployment method to match the corrected constant in site_settings.py, ensuring consistency across the codebase.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:51:15 +08:00
zhenyus
e41aa3d983 fix: correct typo in BASE_RECONCILE_URL in site_settings.py
Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:41:26 +08:00
zhenyus
6ebac252b0 refactor: change DevOpsReconcileOperationType to inherit from str and Enum
Updated the DevOpsReconcileOperationType class to inherit from both str and Enum, enhancing its usability as a string enumeration in the application.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:28:06 +08:00
zhenyus
2dd73c0734 refactor: enhance lazy initialization and error handling in message consumer startup
Updated the message consumer initialization to occur lazily during the startup event, improving application startup performance. Added detailed logging for service initialization, registration, and error handling to enhance traceability and robustness during startup and shutdown processes.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 03:01:11 +08:00
zhenyus
95b6560ffd refactor: improve clarity of subscriber startup process in message_queue.py
Updated comment to specify that the subscriber starts in the background, enhancing code readability and understanding of the asynchronous behavior.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 02:48:55 +08:00
zhenyus
9283e52e48 feat: enhance message consumer startup and shutdown logging in message_queue.py
Added print statements to log the status of message consumers during startup and shutdown processes, improving traceability and debugging capabilities.

Signed-off-by: zhenyus <zhenyus@mathmast.com>
2025-08-03 02:38:33 +08:00