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

Reduce unnecessary log noise #3918

Merged
merged 5 commits into from
Feb 8, 2023
Merged

Reduce unnecessary log noise #3918

merged 5 commits into from
Feb 8, 2023

Conversation

wxing1292
Copy link
Contributor

What changed?

  • Reduce unnecessary log noise in redirection handler

Why?
admin handler & other future handler does not need redirection, reduce unnecessary noise

How did you test it?
N/A

Potential risks
N/A

Is hotfix candidate?
N/A

@wxing1292 wxing1292 requested a review from a team as a code owner February 8, 2023 18:07
@wxing1292 wxing1292 enabled auto-merge (squash) February 8, 2023 18:07
// this should not happen, log warn and move on
i.logger.Warn(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", methodName))
// this should not happen for frontend APIs but ok for admin and other future handlers
// log warn and move on
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: update comment

@@ -177,8 +177,9 @@ func (i *RedirectionInterceptor) Intercept(
return i.handleRedirectAPIInvocation(ctx, req, info, handler, methodName, respAllocFn, namespaceName)
}

// this should not happen, log warn and move on
i.logger.Warn(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", methodName))
// this should not happen for frontend APIs but ok for admin and other future handlers
Copy link
Member

Choose a reason for hiding this comment

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

You can get the service name from info.FullMethod and log at Warn level for WorkflowService, and Debug level for AdminService or others. That might be more useful to catch bugs

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.logger.Warn(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", methodName))
// this should not happen for frontend APIs but ok for admin and other future handlers
// log warn and move on
i.logger.Debug(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", methodName))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
i.logger.Debug(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", methodName))
i.logger.Debug("RedirectionInterceptor encountered unknown API", tag.Name(info.FullMethod))

I'd rather see the full name to know what service it's in

// this should not happen, log warn and move on
i.logger.Warn(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", methodName))
// this should not happen for frontend APIs but ok for admin and other future handlers
i.logger.Debug(fmt.Sprintf("RedirectionInterceptor encountered unknown API: %v", info.FullMethod))
Copy link
Member

Choose a reason for hiding this comment

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

I'd still rather use tags.. this is going to actually fmt.Sprintf on every non-workflowservice rpc, right?

Copy link
Member

@alexshtin alexshtin Feb 9, 2023

Choose a reason for hiding this comment

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

yes, and not only for admin but for operator also.

@wxing1292 wxing1292 merged commit 158a70e into temporalio:master Feb 8, 2023
@wxing1292 wxing1292 deleted the logging branch February 8, 2023 21:12
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.

4 participants