Giter Site home page Giter Site logo

Allow specifying tags for metrics about ekg-core HOT 3 OPEN

tibbe avatar tibbe commented on August 15, 2024
Allow specifying tags for metrics

from ekg-core.

Comments (3)

tibbe avatar tibbe commented on August 15, 2024

This is in the plans but I haven't had time to work on it yet. I'd like a design where creating e.g. a counter indexed by N dimensions (e.g. integers and strings) can be done in a type safe manner i.e. once the counter is created calling inc on that counter requires that you pass N dimension values of the right type. Here's how to not do it:

data Dim = T Text | I Int
newCounter :: [Dim] -> IO Counter
inc :: Counter -> [Dim] -> IO ()

I was thinking of using e.g. a phantom type to track the dimensions for a given counter by using a more untyped representation internally. Needs some thought.

from ekg-core.

ocharles avatar ocharles commented on August 15, 2024

Interesting idea. Keep me posted!

from ekg-core.

lucasdicioccio avatar lucasdicioccio commented on August 15, 2024

Just saw this issue, was replying on #12 (comment) that I've started a patch.
I'll be updating only this issue starting from now.

I'll fix ekg-json soon (very likely adding a key to the ToJSON instance), then ekg will take me more work (in particular, the HTML+JS rendering).

Then, we can imagine a typeful API using typelevel strings or a typeclass to add a variable number of arguments. This typeful API could live in another package.

I'm still unsure whether we should add a hashmap-like interface to "manage" counters for points using new dimensional breakdowns. In particular, there's a risk to have an unbounded number of counters growth if library users do not pay attention + I don't like exposing a lookupOrCreate function when I often use counters in tight-loops on-the-fly -- imho, such a lookupOrCreate function should live in another package.

from ekg-core.

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.