hs-opentelemetry-instrumentation-persistent 0.1.0.0 → 0.1.0.1
raw patch · 4 files changed
+23/−44 lines, 4 filesdep −hs-opentelemetry-instrumentation-persistentdep ~hs-opentelemetry-apinew-uploader
Dependencies removed: hs-opentelemetry-instrumentation-persistent
Dependency ranges changed: hs-opentelemetry-api
Files
- ChangeLog.md +3/−1
- hs-opentelemetry-instrumentation-persistent.cabal +4/−26
- src/OpenTelemetry/Instrumentation/Persistent.hs +16/−14
- test/Spec.hs +0/−3
ChangeLog.md view
@@ -1,6 +1,8 @@ # Changelog for hs-opentelemetry-persistent -## Unreleased changes+## 0.1.0.1++- Support newer dependencies ## 0.1.0.0
hs-opentelemetry-instrumentation-persistent.cabal view
@@ -1,17 +1,17 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.35.2.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: hs-opentelemetry-instrumentation-persistent-version: 0.1.0.0+version: 0.1.0.1 description: Please see the README on GitHub at <https://github.com/iand675/hs-opentelemetry/tree/main/instrumentation/persistent#readme> homepage: https://github.com/iand675/hs-opentelemetry#readme bug-reports: https://github.com/iand675/hs-opentelemetry/issues author: Ian Duncan, Jade Lovelace maintainer: ian@iankduncan.com-copyright: 2023 Ian Duncan, Mercury Technologies+copyright: 2024 Ian Duncan, Mercury Technologies license: BSD3 license-file: LICENSE build-type: Simple@@ -33,29 +33,7 @@ build-depends: base >=4.7 && <5 , clock- , hs-opentelemetry-api ==0.1.*- , mtl- , persistent >=2.13.3- , resourcet- , text- , unliftio- , unordered-containers- , vault- default-language: Haskell2010--test-suite hs-opentelemetry-persistent-test- type: exitcode-stdio-1.0- main-is: Spec.hs- other-modules:- Paths_hs_opentelemetry_instrumentation_persistent- hs-source-dirs:- test- ghc-options: -threaded -rtsopts -with-rtsopts=-N- build-depends:- base >=4.7 && <5- , clock- , hs-opentelemetry-api ==0.1.*- , hs-opentelemetry-instrumentation-persistent+ , hs-opentelemetry-api ==0.2.* , mtl , persistent >=2.13.3 , resourcet
src/OpenTelemetry/Instrumentation/Persistent.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedLists #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -13,8 +14,8 @@ import Control.Monad.IO.Class import Control.Monad.Reader import Data.Acquire.Internal-import Data.IORef import qualified Data.HashMap.Strict as H+import Data.IORef import Data.Maybe (fromMaybe) import Data.Text (Text) import qualified Data.Text as T@@ -75,12 +76,12 @@ {- | Wrap a 'SqlBackend' with appropriate tracing context and attributes so that queries are tracked appropriately in the tracing hierarchy. -}-wrapSqlBackend ::- MonadIO m =>- -- | Attributes that are specific to providers like MySQL, PostgreSQL, etc.- H.HashMap Text Attribute ->- SqlBackend ->- m SqlBackend+wrapSqlBackend+ :: MonadIO m+ => H.HashMap Text Attribute+ -- ^ Attributes that are specific to providers like MySQL, PostgreSQL, etc.+ -> SqlBackend+ -> m SqlBackend wrapSqlBackend attrs conn_ = do tp <- getGlobalTracerProvider wrapSqlBackend' tp attrs conn_@@ -89,12 +90,13 @@ {- | Wrap a 'SqlBackend' with appropriate tracing context and attributes so that queries are tracked appropriately in the tracing hierarchy. -}-wrapSqlBackend' :: MonadIO m =>- TracerProvider ->- -- | Attributes that are specific to providers like MySQL, PostgreSQL, etc.- H.HashMap Text Attribute ->- SqlBackend ->- m SqlBackend+wrapSqlBackend'+ :: MonadIO m+ => TracerProvider+ -> H.HashMap Text Attribute+ -- ^ Attributes that are specific to providers like MySQL, PostgreSQL, etc.+ -> SqlBackend+ -> m SqlBackend wrapSqlBackend' tp attrs conn_ = do let conn = Data.Maybe.fromMaybe conn_ (lookupOriginalConnection conn_) {- A connection is acquired when the connection pool is asked for a connection. The runSqlPool function in Persistent then@@ -105,7 +107,7 @@ connParentSpan <- liftIO $ newIORef Nothing connSpanInFlight <- liftIO $ newIORef Nothing -- TODO add schema to tracerOptions?- let t = makeTracer tp "hs-opentelemetry-persistent" tracerOptions+ let t = makeTracer tp $detectInstrumentationLibrary tracerOptions let hooks = emptySqlBackendHooks { hookGetStatement = \conn sql stmt -> do
− test/Spec.hs
@@ -1,3 +0,0 @@--main :: IO ()-main = putStrLn "Test suite not yet implemented"