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

Redesign/remove IOperationLogger #115

Closed
Tratcher opened this issue Apr 27, 2020 · 6 comments
Closed

Redesign/remove IOperationLogger #115

Tratcher opened this issue Apr 27, 2020 · 6 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@Tratcher
Copy link
Member

var endpoint = _operationLogger.Execute(
"ReverseProxy.PickEndpoint",
() => _loadBalancer.PickEndpoint(endpoints, in loadBalancingOptions));

Using the IOperationLogger allocates a closure per call per request. We need to re-think how to write these start/stop/failed logs.

@Tratcher Tratcher added the Type: Bug Something isn't working label Apr 27, 2020
@analogrelay
Copy link
Member

Perhaps if there's Execute<T>(string, Action<T> callback, T state)? That would allow the func passed in to be static.

@davidfowl
Copy link
Contributor

We should avoid this pattern in general.

@halter73
Copy link
Member

halter73 commented Apr 27, 2020

What about a using based pattern with IDisposable structs/pooled objects? The downside is it wouldn't be able to log errors.

Or do we just give up on the idea of having a helper for logging the start and end of an operation and have everyone do it manually?

@davidfowl
Copy link
Contributor

What about a using based pattern with IDisposable structs/pooled objects? The downside is it wouldn't be able to log errors.

It should be explicit.

Or do we just give up on the idea of having a helper for logging the start and end of an operation and have everyone do it manually?

I'd prefer that.

The issue with callbacks are the ones we all hate:

  • Breaks control flow
  • Creates closures, which then need a state object to be worked around
  • Need async versions of the callback, now it's harder to optimize for the non-async code paths

@Tratcher
Copy link
Member Author

@MihaZupan this directly relates to your diagnostics work this milestone, I'll assign it to you for tracking.

@Tratcher Tratcher modified the milestones: 1.0.0, 1.0.0-preview6 Sep 21, 2020
@samsp-msft samsp-msft changed the title Redesign/remove IOperationLogger Proxy supplies logs for with pertinent info for each stage of the request Oct 21, 2020
@samsp-msft samsp-msft added the User Story Used for divisional .NET planning label Oct 21, 2020
@MihaZupan MihaZupan changed the title Proxy supplies logs for with pertinent info for each stage of the request Redesign/remove IOperationLogger Jan 12, 2021
@MihaZupan
Copy link
Member

MihaZupan commented Jan 12, 2021

Closing this issue as the problem discussed above ("Redesign/remove IOperationLogger") has been dealth with by #501.

Opening a new issue for the user story: #660

@MihaZupan MihaZupan removed the User Story Used for divisional .NET planning label Jan 12, 2021
@MihaZupan MihaZupan removed this from the YARP 1.0.0-preview8 milestone Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants