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

Feature: Add context logging to WorkloadSpread #1879

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AiRanthem
Copy link
Member

Ⅰ. Describe what this PR does

all logs generated by WorkloadSpread (oth the controller and the webhook) are tagged with a context. This tag allows all logs from a single reconcile or mutating operation to be correlated, which looks like:

I0109 03:54:32.927508       1 workloadspread.go:314] "Operation Pod matched WorkloadSpread" context="0fb847f6-2894-4849-b3e3-7d9c20f12c93" operation="Create" podNs="e2e-tests-workloadspread-vknnd" podName="busybox-9tfc8" wsNs="e2e-tests-workloadspread-vknnd" wsName="test-workload-spread"
I0109 03:54:32.928258       1 workloadspread.go:329] "inject Pod subset data for WorkloadSpread" context="0fb847f6-2894-4849-b3e3-7d9c20f12c93" podNs="e2e-tests-workloadspread-vknnd" podName="busybox-9tfc8" suitableSubsetName="zone-a" wsNs="e2e-tests-workloadspread-vknnd" wsName="test-workload-spread"
I0109 03:54:32.928276       1 workloadspread.go:333] "handler operation Pod generatedUID for WorkloadSpread done" context="0fb847f6-2894-4849-b3e3-7d9c20f12c93" operation="Create" podNs="e2e-tests-workloadspread-vknnd" podName="busybox-9tfc8" generatedUID="" wsNs="e2e-tests-workloadspread-vknnd" wsName="test-workload-spread"
I0109 03:54:32.928308       1 workloadspread.go:255] "Cost of handling pod creation by WorkloadSpread" context="0fb847f6-2894-4849-b3e3-7d9c20f12c93" namespace="e2e-tests-workloadspread-vknnd" name="test-workload-spread" cost="853.708µs"

Ⅱ. Does this pull request fix one issue?

fixes #1878

Ⅲ. Describe how to verify it

Just see the logs

Ⅳ. Special notes for reviews

Signed-off-by: AiRanthem <zhongtianyun.zty@alibaba-inc.com>
Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 63.38028% with 78 lines in your changes missing coverage. Please review.

Project coverage is 50.97%. Comparing base (0d0031a) to head (0b23bf6).
Report is 141 commits behind head on master.

Files with missing lines Patch % Lines
...roller/workloadspread/workloadspread_controller.go 76.05% 16 Missing and 1 partial ⚠️
pkg/util/workloadspread/workloadspread.go 72.22% 14 Missing and 1 partial ⚠️
pkg/util/log.go 0.00% 10 Missing ⚠️
pkg/webhook/pod/validating/workloadspread.go 0.00% 10 Missing ⚠️
...ler/workloadspread/workloadspread_event_handler.go 72.00% 7 Missing ⚠️
...troller/workloadspread/update_pod_deletion_cost.go 58.33% 2 Missing and 3 partials ⚠️
pkg/webhook/pod/mutating/workloadspread.go 0.00% 4 Missing ⚠️
...validating/workloadspread_create_update_handler.go 0.00% 3 Missing ⚠️
...loadspread/validating/workloadspread_validation.go 75.00% 3 Missing ⚠️
.../workloadspread/workloadspread_controller_utils.go 66.66% 2 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1879      +/-   ##
==========================================
+ Coverage   47.91%   50.97%   +3.05%     
==========================================
  Files         162      193      +31     
  Lines       23491    25001    +1510     
==========================================
+ Hits        11256    12744    +1488     
+ Misses      11014    10953      -61     
- Partials     1221     1304      +83     
Flag Coverage Δ
unittests 50.97% <63.38%> (+3.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

[feature request] context logging
1 participant