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

Add ActivityTracker to worker stats option #1362

Merged
merged 10 commits into from
Aug 29, 2024

Conversation

ketsiambaku
Copy link
Contributor

@ketsiambaku ketsiambaku commented Aug 26, 2024

What changed?
This changes adds the ActivityTracker in the worker options. In this PR, to count and get information on running activities in a worker.

The activityTracker field is added to activityTaskHandler and localActivityTaskHandler and emitted upon calling Execute() ExecuteWithActualArgs() for local activity.

Why?
Want to retrieve running activities on a worker instance

How did you test it?
unit tests
local test

Potential risks
When deploying the noop implementation is used by default
potential risks include nil pointer dereference panics in the event that we missed initializing the activityTracker in a particular flow

Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.48%. Comparing base (ed58224) to head (a1086da).
Report is 1 commits behind head on master.

Additional details and impacted files
Files with missing lines Coverage Δ
internal/common/debug/workerstats_noop.go 100.00% <100.00%> (ø)
internal/internal_task_handlers.go 75.85% <100.00%> (-0.08%) ⬇️
internal/internal_task_pollers.go 75.72% <100.00%> (+0.15%) ⬆️
internal/internal_worker.go 80.41% <100.00%> (+0.08%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ed58224...a1086da. Read the comment docs.

@ketsiambaku ketsiambaku changed the title Add activity tracker option and emit activity counter Add ActivityTracker to worker stats option Aug 26, 2024
return &activityStopperImpl{info: info, tracker: ati}
}

func (ati *activityTrackerImpl) Stats() Activities {
Copy link
Contributor Author

@ketsiambaku ketsiambaku Aug 29, 2024

Choose a reason for hiding this comment

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

We can group Activities by activityType or other fields of ActivityInfo if needed internally

internal/common/debug/types.go Outdated Show resolved Hide resolved
internal/common/debug/example_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@jakobht jakobht left a comment

Choose a reason for hiding this comment

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

A few nits, but looks good

internal/common/debug/example_test.go Outdated Show resolved Hide resolved
internal/common/debug/example_test.go Outdated Show resolved Hide resolved
internal/internal_task_handlers.go Outdated Show resolved Hide resolved
internal/internal_task_pollers.go Outdated Show resolved Hide resolved
@ketsiambaku ketsiambaku merged commit 3d320e7 into uber-go:master Aug 29, 2024
21 checks 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