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

[MINOR] improvement(server) Add context to rpc audit log to output necessary context #2088

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

maobaolong
Copy link
Member

What changes were proposed in this pull request?

(Please outline the changes and how this PR fixes the issue.)

Why are the changes needed?

(Please clarify why the changes are needed. For instance,

  1. If you propose a new API, clarify the use case for a new API.
  2. If you fix a bug, describe the bug.)

Fix: # (issue)

Does this PR introduce any user-facing change?

(Please list the user-facing changes introduced by your change, including

  1. Change in user-facing APIs.
  2. Addition or removal of property keys.)

No.

How was this patch tested?

(Please test your changes, and provide instructions on how to test it:

  1. If you add a feature or fix a bug, add a test to cover your changes.
  2. If you fix a flaky test, repeat it for many times to prove it works.)

Copy link

github-actions bot commented Aug 28, 2024

Test Results

 2 832 files  + 50   2 832 suites  +50   5h 30m 16s ⏱️ - 16m 50s
 1 019 tests + 31   1 014 ✅ + 28   1 💤 ±0  1 ❌ +1  3 🔥 +2 
12 818 runs  +425  12 794 ✅ +417  15 💤 ±0  1 ❌ +1  8 🔥 +7 

For more details on these failures and errors, see this check.

Results for commit 5681cf6. ± Comparison against base commit e62fe7c.

♻️ This comment has been updated with latest results.

if (context == null) {
context = contextPart;
} else {
this.context += ", " + contextPart;
Copy link
Member

Choose a reason for hiding this comment

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

This looks strange, from my thought, If want to record the whole up/downstream context tips. Maybe we need to introduce the dedicated Context class to record the all children context?

Copy link
Member

Choose a reason for hiding this comment

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

Like this?

class Context {
 string contextName;
 List<Context> children;
}

getBlockIdsByPartitionId(requestPartitions, bitmap, res, blockIdLayout);
RpcAuditContext.getRpcAuditContext()
.ifPresent(
Copy link
Member

Choose a reason for hiding this comment

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

ifPresent is a good practise, because this avoids unnessary cpu cost if having the much string operations.

@@ -906,7 +908,7 @@ public void getShuffleResultForMultiPart(

auditContext.withAppId(appId).withShuffleId(shuffleId);
auditContext.withArgs(
"partitionsListSize=" + partitionsList.size() + ", blockIdLayout=" + blockIdLayout);
"partitionsList=" + partitionsList + ", blockIdLayout=" + blockIdLayout);
Copy link
Member

Choose a reason for hiding this comment

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

Concern that the partitionsList will cost too much time. Right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed

@@ -18,24 +18,33 @@
package org.apache.uniffle.common.audit;

import java.io.Closeable;
import java.util.Optional;

import org.slf4j.Logger;

import org.apache.uniffle.common.rpc.StatusCode;

/** Context for rpc audit logging. */
public abstract class RpcAuditContext implements Closeable {
Copy link
Member

Choose a reason for hiding this comment

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

If having performance degression, can we disable this by config? @maobaolong I see some time consuming operations in the hotspot path.

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.

2 participants