packages feed

helics 0.1.3 → 0.2.0

raw patch · 3 files changed

+29/−7 lines, 3 filesdep ~base

Dependency ranges changed: base

Files

helics.cabal view
@@ -1,5 +1,5 @@ name:                helics-version:             0.1.3+version:             0.2.0 synopsis:            New Relic® agent SDK wrapper for Haskell. description:            New Relic® agent SDK wrapper for Haskell.@@ -36,7 +36,7 @@                        Network.Helics.Foreign.Transaction                        Network.Helics.Foreign.System   -- other-extensions:    -  build-depends:       base               >=4.7  && <4.8+  build-depends:       base               >=4.6  && <4.8                      , data-default-class >=0.0  && <0.1                      , time               >=1.2  && <1.6                      , unix               >=2.6  && <2.8@@ -53,7 +53,7 @@ executable helics-example   main-is:             example.hs   if flag(example)-    build-depends:       base               >=4.7 && <4.8+    build-depends:       base               >=4.6 && <4.8                        , helics                        , bytestring     buildable:         True
src/Network/Helics.hs view
@@ -22,6 +22,7 @@     , autoScope     , rootSegment     , genericSegment+    , Operation(..)     , DatastoreSegment(..)     , datastoreSegment     , externalSegment@@ -189,9 +190,22 @@ genericSegment (SegmentId pid) name act (TransactionId tid) = segment tid     (S.useAsCString name $ newrelic_segment_generic_begin tid pid) act +data Operation+    = SELECT+    | INSERT+    | UPDATE+    | DELETE+    deriving (Show)++opToBS :: Operation -> S.ByteString+opToBS SELECT = newrelicDatastoreSelect+opToBS INSERT = newrelicDatastoreInsert+opToBS UPDATE = newrelicDatastoreUpdate+opToBS DELETE = newrelicDatastoreDelete+ data DatastoreSegment = DatastoreSegment     { table              :: S.ByteString-    , operation          :: S.ByteString+    , operation          :: Operation     , sql                :: S.ByteString     , sqlTraceRollupName :: S.ByteString     , sqlObFuscator      :: Maybe (S.ByteString -> S.ByteString)@@ -207,9 +221,9 @@  datastoreSegment :: SegmentId -> DatastoreSegment -> IO a -> TransactionId -> IO a datastoreSegment (SegmentId pid) DatastoreSegment{..} act (TransactionId tid) = -    S.useAsCString table     $ \tbl ->-    S.useAsCString operation $ \op ->-    S.useAsCString sql       $ \q  ->+    S.useAsCString table              $ \tbl ->+    S.useAsCString (opToBS operation) $ \op ->+    S.useAsCString sql                $ \q  ->     S.useAsCString sqlTraceRollupName $ \tr -> do     case sqlObFuscator of         Nothing -> segment tid
src/Network/Helics/Foreign/Transaction.hsc view
@@ -1,4 +1,5 @@ {-# LANGUAGE ForeignFunctionInterface #-}+{-# LANGUAGE OverloadedStrings #-}  module Network.Helics.Foreign.Transaction where @@ -6,6 +7,7 @@  import Foreign.C import Foreign.Ptr+import qualified Data.ByteString as S  newtype TransactionId = TransactionId CLong @@ -14,6 +16,12 @@ autoScope, rootSegment :: SegmentId autoScope   = SegmentId #const NEWRELIC_AUTOSCOPE rootSegment = SegmentId #const NEWRELIC_ROOT_SEGMENT++newrelicDatastoreSelect, newrelicDatastoreInsert, newrelicDatastoreUpdate, newrelicDatastoreDelete :: S.ByteString+newrelicDatastoreSelect = #{const_str NEWRELIC_DATASTORE_SELECT}+newrelicDatastoreInsert = #{const_str NEWRELIC_DATASTORE_INSERT}+newrelicDatastoreUpdate = #{const_str NEWRELIC_DATASTORE_UPDATE}+newrelicDatastoreDelete = #{const_str NEWRELIC_DATASTORE_DELETE}  foreign import ccall newrelic_enable_instrumentation :: CInt -> IO ()