hs-opentelemetry-exporter-in-memory 0.0.1.3 → 0.0.1.4
raw patch · 6 files changed
+74/−79 lines, 6 filesdep −hs-opentelemetry-exporter-in-memorydep ~hs-opentelemetry-apinew-uploader
Dependencies removed: hs-opentelemetry-exporter-in-memory
Dependency ranges changed: hs-opentelemetry-api
Files
- ChangeLog.md +4/−1
- hs-opentelemetry-exporter-in-memory.cabal +15/−29
- src/OpenTelemetry/Exporter/InMemory.hs +4/−46
- src/OpenTelemetry/Exporter/InMemory/LogRecord.hs +2/−0
- src/OpenTelemetry/Exporter/InMemory/Span.hs +49/−0
- test/Spec.hs +0/−3
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for hs-opentelemetry-exporter-in-memory +## 0.0.1.2 ++- Support newer dependencies+ ## 0.0.1.1 - Support hs-opentelemetry-api-0.0.2.0@@ -7,4 +11,3 @@ ## 0.0.1.0 - Initial release-## Unreleased changes
hs-opentelemetry-exporter-in-memory.cabal view
@@ -1,20 +1,20 @@ 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-exporter-in-memory-version: 0.0.1.3-description: Please see the README on GitHub at <https://github.com/iand675/hs-opentelemetry/tree/main/exporters/in-memory#readme>-homepage: https://github.com/iand675/hs-opentelemetry#readme-bug-reports: https://github.com/iand675/hs-opentelemetry/issues-author: Ian Duncan-maintainer: ian@iankduncan.com-copyright: 2021 Ian Duncan-license: BSD3-license-file: LICENSE-build-type: Simple+name: hs-opentelemetry-exporter-in-memory+version: 0.0.1.4+description: Please see the README on GitHub at <https://github.com/iand675/hs-opentelemetry/tree/main/exporters/in-memory#readme>+homepage: https://github.com/iand675/hs-opentelemetry#readme+bug-reports: https://github.com/iand675/hs-opentelemetry/issues+author: Ian Duncan+maintainer: ian@iankduncan.com+copyright: 2021 Ian Duncan+license: BSD3+license-file: LICENSE+build-type: Simple extra-source-files: README.md ChangeLog.md@@ -26,6 +26,8 @@ library exposed-modules: OpenTelemetry.Exporter.InMemory+ OpenTelemetry.Exporter.InMemory.LogRecord+ OpenTelemetry.Exporter.InMemory.Span other-modules: Paths_hs_opentelemetry_exporter_in_memory hs-source-dirs:@@ -34,22 +36,6 @@ build-depends: async , base >=4.7 && <5- , hs-opentelemetry-api >=0.0.3 && <0.2- , unagi-chan- default-language: Haskell2010--test-suite hs-opentelemetry-exporter-in-memory-test- type: exitcode-stdio-1.0- main-is: Spec.hs- other-modules:- Paths_hs_opentelemetry_exporter_in_memory- hs-source-dirs:- test- ghc-options: -threaded -rtsopts -with-rtsopts=-N- build-depends:- async- , base >=4.7 && <5- , hs-opentelemetry-api >=0.0.3 && <0.2- , hs-opentelemetry-exporter-in-memory+ , hs-opentelemetry-api ==0.2.* , unagi-chan default-language: Haskell2010
src/OpenTelemetry/Exporter/InMemory.hs view
@@ -1,49 +1,7 @@-module OpenTelemetry.Exporter.InMemory (- inMemoryChannelExporter,- inMemoryListExporter,- module Control.Concurrent.Chan.Unagi,+module OpenTelemetry.Exporter.InMemory+ {-# DEPRECATED "use OpenTelemetry.Exporter.InMemory.Span instead" #-} (+ module OpenTelemetry.Exporter.InMemory.Span, ) where -import Control.Concurrent.Async-import Control.Concurrent.Chan.Unagi-import Control.Monad.IO.Class-import Data.IORef-import OpenTelemetry.Processor-import OpenTelemetry.Trace.Core---{- | Access exported spans via a concurrently accessible channel that produces spans.- The spans are exported in the order that the spans end.--}-inMemoryChannelExporter :: (MonadIO m) => m (Processor, OutChan ImmutableSpan)-inMemoryChannelExporter = liftIO $ do- (inChan, outChan) <- newChan- let processor =- Processor- { processorOnStart = \_ _ -> pure ()- , processorOnEnd = \ref -> do- writeChan inChan =<< readIORef ref- , processorShutdown = do- async $ pure ShutdownSuccess- , processorForceFlush = pure ()- }- pure (processor, outChan)-+import OpenTelemetry.Exporter.InMemory.Span -{- | Access exported spans via a mutable reference to a list of spans. The spans- are not guaranteed to be exported in a particular order.--}-inMemoryListExporter :: (MonadIO m) => m (Processor, IORef [ImmutableSpan])-inMemoryListExporter = liftIO $ do- listRef <- newIORef []- let processor =- Processor- { processorOnStart = \_ _ -> pure ()- , processorOnEnd = \ref -> do- s <- readIORef ref- atomicModifyIORef listRef (\l -> (s : l, ()))- , processorShutdown = do- async $ pure ShutdownSuccess- , processorForceFlush = pure ()- }- pure (processor, listRef)
+ src/OpenTelemetry/Exporter/InMemory/LogRecord.hs view
@@ -0,0 +1,2 @@+module OpenTelemetry.Exporter.InMemory.LogRecord () where+
+ src/OpenTelemetry/Exporter/InMemory/Span.hs view
@@ -0,0 +1,49 @@+module OpenTelemetry.Exporter.InMemory.Span (+ inMemoryChannelExporter,+ inMemoryListExporter,+ module Control.Concurrent.Chan.Unagi,+) where++import Control.Concurrent.Async+import Control.Concurrent.Chan.Unagi+import Control.Monad.IO.Class+import Data.IORef+import OpenTelemetry.Processor.Span+import OpenTelemetry.Trace.Core+++{- | Access exported spans via a concurrently accessible channel that produces spans.+ The spans are exported in the order that the spans end.+-}+inMemoryChannelExporter :: (MonadIO m) => m (SpanProcessor, OutChan ImmutableSpan)+inMemoryChannelExporter = liftIO $ do+ (inChan, outChan) <- newChan+ let processor =+ SpanProcessor+ { spanProcessorOnStart = \_ _ -> pure ()+ , spanProcessorOnEnd = \ref -> do+ writeChan inChan =<< readIORef ref+ , spanProcessorShutdown = do+ async $ pure ShutdownSuccess+ , spanProcessorForceFlush = pure ()+ }+ pure (processor, outChan)+++{- | Access exported spans via a mutable reference to a list of spans. The spans+ are not guaranteed to be exported in a particular order.+-}+inMemoryListExporter :: (MonadIO m) => m (SpanProcessor, IORef [ImmutableSpan])+inMemoryListExporter = liftIO $ do+ listRef <- newIORef []+ let processor =+ SpanProcessor+ { spanProcessorOnStart = \_ _ -> pure ()+ , spanProcessorOnEnd = \ref -> do+ s <- readIORef ref+ atomicModifyIORef listRef (\l -> (s : l, ()))+ , spanProcessorShutdown = do+ async $ pure ShutdownSuccess+ , spanProcessorForceFlush = pure ()+ }+ pure (processor, listRef)
− test/Spec.hs
@@ -1,3 +0,0 @@--main :: IO ()-main = putStrLn "Test suite not yet implemented"