douxu
03bd058558
feat: implement end-to-end distributed tracing for HTTP and async tasks
...
- introduce typed traceCtxKey to prevent context key collisions (staticcheck fix)
- inject B3 trace values into c.Request.Context() in StartTrace middleware
so handlers using c.Request.Context() carry trace info
- create startup trace context in main.go, replacing context.TODO()
- propagate HTTP traceID/spanID through TaskQueueMessage into RabbitMQ
worker, linking HTTP request → publish → execution on the same traceID
- fix GORM logger null traceID by binding ctx to AutoMigrate and queries
via db.WithContext(ctx)
- thread ctx through handler factory to fix null traceID in startup logs
- replace per-request RabbitMQ producer with channel-based
PushTaskToRabbitMQ goroutine; restrict Swagger to non-production
2026-04-23 16:48:32 +08:00
douxu
809e1cd87d
Refactor: extract task constants to dedicated constants package
...
- Add constants/task.go with centralized task-related constants
- Task priority levels (default, high, low)
- Task queue configuration (exchange, queue, routing key)
- Task message settings (max priority, TTL)
- Task retry settings (max retries, delays)
- Test task settings (sleep duration, max limit)
- Update task-related files to use constants from constants package:
- handler/async_task_create_handler.go
- task/queue_message.go
- task/queue_producer.go
- task/retry_manager.go
- task/test_task.go
- task/types.go (add TypeTest)
- task/worker.go
2026-04-22 17:20:26 +08:00
douxu
4a3f7a65bc
Refactor async task handlers into specialized handlers
...
Split monolithic async_task_handler.go into separate handlers:
- async_task_cancel_handler.go: Handles task cancellation
- async_task_create_handler.go: Handles task creation
- async_task_progress_update_handler.go: Handles progress updates
- async_task_result_detail_handler.go: Handles result details
- async_task_result_query_handler.go: Handles result queries
- async_task_status_update_handler.go: Handles status updates
This improves code organization and maintainability by separating concerns.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 14:09:02 +08:00
douxu
4d5fcbc376
Refactor async task system with unified task interfaces and add test task type
...
- Create task/types_v2.go with unified task type definitions and interfaces
* Add UnifiedTaskType and UnifiedTaskStatus constants
* Define Task:Params interface for parameter validation and serialization
* Define UnifiedTask interface as base for all task implementations
* Add BaseTask for common task functionality
2026-04-14 17:00:30 +08:00
douxu
9e4c35794c
implemented task queue publishing using RabbitMQ
...
Added configuration middleware integration
Added retry logic for queue publishing
Added task worker initialization (main.go):
Created initTaskWorker function for task worker configuration
Added worker startup and shutdown logic
Added CORS middleware configuration
Registered config middleware
2026-04-01 17:15:33 +08:00
douxu
de5f976c31
add route of async task system
2026-03-17 16:08:46 +08:00
douxu
898beaeec4
optimize struct of rabbitmq event
2026-03-02 17:00:09 +08:00
douxu
2ececc38d9
optimzie code organization structure of rabbitmq event
2026-02-25 17:14:25 +08:00
douxu
9be984899c
optimize code of push event alarm func
2026-02-03 17:05:32 +08:00
douxu
3ff29cc072
optimize code of real time data pull api
2026-01-28 14:03:25 +08:00
douxu
617d21500e
optimize code of redis connenct func and real time data calculate
2026-01-27 17:41:17 +08:00
douxu
1a1727adab
optimize reponse code and business code of measurement sub api
2026-01-26 16:29:50 +08:00
douxu
fd2b202037
optimize code of websocket close handler
2026-01-22 16:19:00 +08:00
douxu
e1886bc347
optimize code of judge wether success or failed return content
2026-01-19 16:39:35 +08:00
douxu
ba5e5b3d1c
optimzie code of constants package
2026-01-16 17:08:28 +08:00
douxu
d3b1f0afbe
add code of send all target removed system signal in real time data pull api and fix bug of component attribute query api
2026-01-14 17:32:01 +08:00
douxu
cf880279e4
optimize real time data query api
2026-01-13 17:23:47 +08:00
douxu
d75b9a624c
optimize handler of compoent attribute query api
2026-01-13 11:39:00 +08:00
douxu
cceffa8219
add handler of compoent attribute query api
2026-01-12 17:21:04 +08:00
douxu
d1495b7ab8
optimize code of component attribute update api
2026-01-09 17:26:45 +08:00
douxu
60eab0675e
optimize code of component attrbute update api
2026-01-08 17:34:44 +08:00
douxu
f47e278f85
fix bug of first subscription different interval measurement data
2026-01-07 17:28:09 +08:00
douxu
a31bd6f395
add component attribute group update api and optimzie diagram hash set params
2026-01-05 17:20:41 +08:00
douxu
51f65500f3
add func of init component measurement recommend
2025-12-24 16:55:55 +08:00
douxu
9499e579b3
optimize code of sql struct and measurement node recommend api
2025-12-19 17:33:12 +08:00
douxu
0add3cf6db
feat:implement search support for abbreviated token ranges (e.g., token4-token7)
2025-12-15 16:49:38 +08:00
douxu
c92cee9575
optimzie logic of real time data pull api
2025-12-12 17:22:20 +08:00
douxu
2a3852a246
add diagram node link process api
2025-12-10 16:12:13 +08:00
douxu
f48807e5e5
optimize measurement link api
2025-12-08 17:01:24 +08:00
douxu
3f70be0d1c
fix bug of new version of measurement recommend api
2025-12-06 18:32:00 +08:00
douxu
46e72ce588
optimize redis test data lua shell
2025-12-04 17:26:35 +08:00
douxu
b99c03296a
optimize measurement recommend api
2025-12-03 16:55:14 +08:00
douxu
8a4116879b
add real time data measurement target update func
2025-12-02 17:26:15 +08:00
douxu
fca6905d74
optimize real time data pulling and subscription api
2025-11-27 16:59:03 +08:00
douxu
6f3134b5e9
optimize struct of real time data subscription api and fix bug of real time data pull api
2025-11-26 17:49:24 +08:00
douxu
b6e47177fb
debugging API using single measurement point subscription case
2025-11-25 16:13:55 +08:00
douxu
d434a7737d
optimize variable naming and init real time data compute func
2025-11-13 17:29:49 +08:00
douxu
984ee3003d
optimize variable naming and api swagger comment
2025-11-13 11:48:26 +08:00
douxu
041d7e5788
optimize variable naming and optimize real time data computing api
2025-11-12 17:34:18 +08:00
douxu
b43adf9b67
optimize logger info of real time data subscription api
2025-11-11 17:45:36 +08:00
douxu
a82e02126d
extracting duplicate code snippets to form a common function
2025-11-11 17:37:06 +08:00
douxu
93d1eea61f
optimize sendRealTimeDataStream of real time data pull api
2025-11-11 11:50:25 +08:00
douxu
8d6efe8bb1
optimize real time data pull api
2025-11-10 17:32:18 +08:00
douxu
6de3c5955b
optimize real time data pull api
2025-11-08 17:11:45 +08:00
douxu
8090751914
optimize update monitor config func of real time data query api
2025-11-06 17:22:14 +08:00
douxu
b75358e676
optimize first create monitor config func of real time data query api
2025-11-05 18:20:54 +08:00
douxu
f5ea909120
optimize real time data query api
2025-11-04 17:12:15 +08:00
douxu
594dc68ab1
create api of real time data monitor
2025-11-03 17:35:03 +08:00
douxu
2584f6dacb
optimize real time data query api
2025-10-28 16:59:16 +08:00
douxu
09700a86ee
optimize real time data receive api
2025-10-27 16:47:04 +08:00