Skip to content

rfac: outputAccesslog func to skip accesslog at conn establishment #1376

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

Merged
merged 1 commit into from
May 9, 2025

Conversation

yp969803
Copy link
Contributor

@yp969803 yp969803 commented May 8, 2025

What type of PR is this?
=/kind enhancement

What this PR does / why we need it:
outputAccesslog func to skip accesslog at conn establishment

Which issue(s) this PR fixes:
Fixes #1375

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@Copilot Copilot AI review requested due to automatic review settings May 8, 2025 10:38
@kmesh-bot kmesh-bot requested review from nlgwcy and YaoZengzeng May 8, 2025 10:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR is an enhancement to update network connection logging behavior by skipping access logs at connection establishment. Key changes include replacing the TCP_CLOSTED constant with TCP_CLOSED, updating the LONG_CONN_METRIC_THRESHOLD from 5 seconds to 30 seconds, and modifying the condition in OutputAccesslog to use the report count for skipping logs.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/controller/telemetry/metric_test.go Updated test expectation to use TCP_CLOSED instead of TCP_CLOSTED
pkg/controller/telemetry/metric.go Replaced TCP_CLOSTED with TCP_CLOSED; adjusted LONG_CONN_METRIC_THRESHOLD and inline comments
pkg/controller/telemetry/accesslog.go Modified the log skipping condition from checking duration to verifying first report
Comments suppressed due to low confidence (1)

pkg/controller/telemetry/accesslog.go:82

  • The updated condition for skipping the access log now uses totalReports instead of connection duration; please verify that this change covers all intended scenarios for connection establishment.
if data.state == TCP_ESTABLISHED && conn_metrics.totalReports == 1 {

@@ -48,7 +48,7 @@ const (

DEFAULT_UNKNOWN = "-"

Copy link
Preview

Copilot AI May 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The threshold change from 5 seconds to 30 seconds may require an update to corresponding inline comments or documentation to reflect the new behavior.

Suggested change
// Threshold for long-lived connections, updated from 5 seconds to 30 seconds.

Copilot uses AI. Check for mistakes.

@yp969803
Copy link
Contributor Author

yp969803 commented May 8, 2025

@hzxuzhonghu can u review, it is more better approach

@yp969803
Copy link
Contributor Author

yp969803 commented May 8, 2025

also i haved fixed the typo TCP_CLOSTED

Copy link

codecov bot commented May 8, 2025

Codecov Report

Attention: Patch coverage is 12.50000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 46.25%. Comparing base (77a6ac8) to head (c6c7086).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/telemetry/metric.go 14.28% 4 Missing and 2 partials ⚠️
pkg/controller/telemetry/accesslog.go 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
pkg/controller/telemetry/utils.go 69.33% <ø> (ø)
pkg/controller/telemetry/accesslog.go 84.84% <0.00%> (-5.48%) ⬇️
pkg/controller/telemetry/metric.go 59.45% <14.28%> (ø)

... and 1 file with indirect coverage changes


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 9ef41e7...c6c7086. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -48,7 +48,7 @@ const (

DEFAULT_UNKNOWN = "-"

LONG_CONN_METRIC_THRESHOLD = uint64(5 * time.Second)
LONG_CONN_METRIC_THRESHOLD = uint64(30 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any basis for the threshold modification to 30s?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have changed it to 5

Copy link
Member

@hzxuzhonghu hzxuzhonghu left a comment

Choose a reason for hiding this comment

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

/lgtm

@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot kmesh-bot merged commit 8af0ce4 into kmesh-net:main May 9, 2025
11 checks passed
@hzxuzhonghu
Copy link
Member

/cherry-pick release-1.1

@kmesh-bot
Copy link
Collaborator

@hzxuzhonghu: new pull request created: #1382

In response to this:

/cherry-pick release-1.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kmesh-bot
Copy link
Collaborator

@hzxuzhonghu: new pull request could not be created: failed to create pull request against kmesh-net/kmesh#release-1.1 from head kmesh-bot:cherry-pick-1376-to-release-1.1: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for kmesh-bot:cherry-pick-1376-to-release-1.1."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

In response to this:

/cherry-pick release-1.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not output accesslog at conn start
4 participants