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

refactor: update metric api to cumulate task count after db purge #60

Merged

Conversation

codebender37
Copy link
Collaborator

@codebender37 codebender37 commented Dec 3, 2024

  • increment the task result count everytime the api is called instead of fetch from TaskResult table
  • use Redis INCR for atomic increments that work across all instances
  • change log level on substrate.go, and subnet_state which are spamming
  • fix time bugs on checking expired task by using UTC()

- increment the task result count everytime the api is called instead of fetch from TaskResult table
- use Redis INCR for atomic increments that work across all instances
pkg/metric/metrics_service.go Outdated Show resolved Hide resolved
@codebender37 codebender37 marked this pull request as ready for review December 5, 2024 11:24
- added some changes for PR feedback
- removed cache on GetTasksByWorkerSubscription to fix task list not properly updated
@codebender37 codebender37 force-pushed the refactor/update-metric-api-to-cumulate-task-result-count branch from b3db3b1 to 4d3c375 Compare December 5, 2024 19:43
pkg/metric/metrics_service.go Outdated Show resolved Hide resolved
pkg/metric/metrics_service.go Outdated Show resolved Hide resolved
pkg/metric/metrics_service.go Outdated Show resolved Hide resolved
pkg/metric/metrics_service.go Outdated Show resolved Hide resolved
pkg/orm/task.go Outdated Show resolved Hide resolved
pkg/orm/task_result.go Show resolved Hide resolved
- add TasksByWorker cache back that was removed because of inconsistent UI
- reset the related cache after successful task sumit, or create
- refactor some code in cache.go
- add some changes from PR feedback
@codebender37 codebender37 force-pushed the refactor/update-metric-api-to-cumulate-task-result-count branch from 73963b9 to ec5b221 Compare December 9, 2024 07:06
karootplx
karootplx previously approved these changes Dec 9, 2024
Copy link
Collaborator

@karootplx karootplx left a comment

Choose a reason for hiding this comment

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

lgtm

@codebender37 codebender37 force-pushed the refactor/update-metric-api-to-cumulate-task-result-count branch from ec5b221 to 36e1082 Compare December 9, 2024 13:22
- use UTC on current time when checking on expired task
- remove the check for expire task with no result, since schedular handling it already
@codebender37 codebender37 force-pushed the refactor/update-metric-api-to-cumulate-task-result-count branch from 36e1082 to dc80cfb Compare December 9, 2024 13:29
@karootplx karootplx marked this pull request as draft December 9, 2024 13:57
@karootplx karootplx marked this pull request as ready for review December 10, 2024 05:48
Copy link
Member

@jarvis8x7b jarvis8x7b left a comment

Choose a reason for hiding this comment

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

lgtm

@codebender37 codebender37 merged commit f2654a6 into dev Dec 11, 2024
1 check passed
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.

3 participants