Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Consider adding a 'correlationId' middleware #371

Closed
rynowak opened this issue Feb 24, 2016 · 4 comments
Closed

Consider adding a 'correlationId' middleware #371

rynowak opened this issue Feb 24, 2016 · 4 comments

Comments

@rynowak
Copy link
Member

rynowak commented Feb 24, 2016

It's a common pattern (like WCF activity ID) to create a correlation id and use it across multiple services with logging. This way if your logs all go to the same store you can associate all of the business processes across service/server boundaries that are part of the same unit of work.

  1. Front-end server creates a correlation ID and creates a log scope
  2. Front-end server stashes the correlation ID in a way that some other code can get it (http context extension?)
  3. Front-end server makes a call to another service - propagates the ID by taking it out of http context and passing it via a header (http client)
  4. Back-end server reads the header and creates a log scope
  5. And so on...

There's 3-5 lines of boilerplate required to do steps 1,2, and 4, and we could easily make a middleware that does it for you.

We might want to add an extension method for step 3.

@ejsmith
Copy link

ejsmith commented Feb 25, 2016

I don't think anything in the core interfaces needs to be changed for this, right? If so, this type of functionality really needs to be in another package. I am personally trying to get them to move all extension methods out to another package because the simpler we keep this abstractions package, the more chance it has of becoming the defacto standard for .NET logging and that would be a huge win.

@davidfowl
Copy link
Member

This should be moved to either basic middleware or hosting

@rynowak
Copy link
Member Author

rynowak commented Feb 26, 2016

If so, this type of functionality really needs to be in another package.

Yup. That's how we'd do it.

@muratg
Copy link

muratg commented Mar 3, 2016

This issue was moved to aspnet/BasicMiddleware#32

@muratg muratg closed this as completed Mar 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants