GithubHelp home page GithubHelp logo

Comments (4)

roblaszczak avatar roblaszczak commented on July 24, 2024 11

Lengyel, magyar – két jó barát, so added in 🎉 #24

from watermill.

roblaszczak avatar roblaszczak commented on July 24, 2024

Hello, message already has something that can be used as a context: metadata.

It is also a middleware which can be used for distributed tracing: https://github.com/ThreeDotsLabs/watermill/blob/master/message/router/middleware/correlation.go

Does it meet your requirements? :)

from watermill.

sagikazarmark avatar sagikazarmark commented on July 24, 2024

Yeah, I know it has metadata, but it cannot accept a context.Context since it only supports string metadata.

As for distributed tracing: in simple cases and for logging a correlation ID might be enough, but in a distributed system which uses a more sophisticated tracing mechanism (eg. OpenTracing or OpenCensus) it may not be.

Ideally the distributed tracing middleware would extract the serialized tracing information (which in this case is more than just a correlation ID) from the metadata and attach the tracing spans to the context of the message. That way all the middlewares and handlers can receive the same context and record tracing information.

To do the same thing currently, you have to extract the tracing information in each and every middleware/handler. context.Context is the defacto solution for this kind of job.

There is one question though: context is immutable and in most cases where context is involved some kind of message passing, adding something to the context requires creating a new message. In case of http.Request it is just a copy of the message, but in this library there are mutexes involved as well, so I'm not 100% sure how easy it would be to implement context support.

from watermill.

sagikazarmark avatar sagikazarmark commented on July 24, 2024

WOW, nice 🙂 Thanks a lot!

from watermill.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.