Git Product home page Git Product logo

pickle's Introduction

pickle

Instant StatsD in Haskell. Easy to implement in a program you've already written without any refactoring to pass any sockets/configuration around.

Usage

Call setupPickle defaultConfig at least once, e.g.

{-# LANGUAGE OverloadedStrings #-}
import qualified Data.Map.Strict as M

main :: IO()
main = do
    setupPickle defaultConfig
    {...}

Then to send metrics you can just call one of these functions:

let name  = "gauge.name"
    value = 42
    tags  = M.fromList [("key","value), ("tag2","value")]
gauge   name value (Just tags)
timer   name value (Just tags) Nothing
counter name value (Just tags) Nothing

Pickle will take care of the rest. He's a good boy.

my dogger, pickle

pickle's People

Contributors

traviswhitaker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pickle's Issues

Tags are not passed in the network call

In the below function, tags are being parsed but never sent over the network call

    mPick <- gpPickle <$> atomically (readTVar pickle)
    case mPick of
        Nothing -> pure () -- no connection, give up.
        Just (Pickle sock cfg) -> do
            let tags = parseTags $ (fromMaybe M.empty mTags) <> (statsdTags cfg)
                sampling = maybe "" (\s -> "|@" <> showT s ) mSampling
                name = (statsdPrefix cfg) <> n
                msg  = name <> ":" <> (showT val) <> "|" <> kind <> sampling
            when (statsdVerbose cfg) (T.putStrLn $ "Sending metric: " <> msg)
            void $ (try $ send sock $ T.encodeUtf8 msg :: IO(Either SomeException Int))
            

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.