Code Monkey home page Code Monkey logo

Comments (5)

56quarters avatar 56quarters commented on July 17, 2024

Ha, funny you should mention this. I was just thinking about how to add some sort of MetricFormatter trait + impl to StatsdClient for #41 and it seemed a little ugly to have to start passing another generic param around.

Getting rid of the generic param and wrapping the sink in Arc (as well as making the client Clone) makes sense to me. Since this is a breaking change it would probably end up in 0.10.0 or later.

from cadence.

56quarters avatar 56quarters commented on July 17, 2024

The only problem I see with wrapping the sink in an Arc<MetricSink + Sync + Send> is that the AsyncMetricSink, which uses a thread pool, is not Sync. Since it uses a std::sync::mpsc::Sender instance, it relies on being .cloned() between threads.

So, AsyncMetricSink is not compatible with using an Arc<MetricSink + Sync + Send> in the client struct. But, I've been wanting to get rid of AsyncMetricSink anyway.

So my plan is to deprecate AsyncMetricSink (per #34) and release version 0.10.0. After that I'll remove it and make this change in version 0.11.0.

from cadence.

robinst avatar robinst commented on July 17, 2024

Yay, excellent!

from cadence.

56quarters avatar 56quarters commented on July 17, 2024

Hey @robinst,

I submitted a PR to remove the generic param from the client (#52) if you like to check it out. The biggest change was adding some docs to the client on the ways that it could be shared between threads, based on the use cases you've described here. Let me know what you think. Thanks!

from cadence.

robinst avatar robinst commented on July 17, 2024

Looks good! Just had a single comment. Like the docs as well, very nice.

from cadence.

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.