packages feed

aws-xray-client-wai 0.1.0.0 → 0.1.0.1

raw patch · 3 files changed

+42/−47 lines, 3 filesdep ~aws-xray-clientdep ~basedep ~bytestringPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aws-xray-client, base, bytestring, containers, lens, random, text, time, unliftio, unliftio-core, vault, wai

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,6 +1,10 @@-## [*Unreleased*](https://github.com/freckle/aws-xray-client/tree/aws-xray-client-wai-v0.1.0.0...main)+## [*Unreleased*](https://github.com/freckle/aws-xray-client/compare/aws-xray-client-wai-v0.1.0.1...main)  None++## [v0.1.0.1](https://github.com/freckle/aws-xray-client/compare/aws-xray-client-wai-v0.1.0.0...aws-xray-client-wait-v0.1.0.1)++- Build on GHC 8.10  ## [v0.1.0.0](https://github.com/freckle/aws-xray-client/tree/aws-xray-client-wai-v0.1.0.0) 
aws-xray-client-wai.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.12 name:               aws-xray-client-wai-version:            0.1.0.0+version:            0.1.0.1 license:            MIT copyright:          2021 Renaissance Learning Inc maintainer:         engineering@freckle.com@@ -35,16 +35,16 @@         TypeApplications TypeFamilies      build-depends:-        aws-xray-client >=0.1.0.0,-        base >=4.12.0.0 && <5,-        bytestring >=0.10.8.2,-        containers >=0.6.0.1,+        aws-xray-client >=0.1.0.1,+        base >=4.14.1.0 && <5,+        bytestring >=0.10.12.0,+        containers >=0.6.2.1,         http-types >=0.12.3,-        lens >=4.17.1,-        random >=1.1,-        text >=1.2.3.1,-        time >=1.8.0.2,-        unliftio >=0.2.11,-        unliftio-core >=0.1.2.0,-        vault >=0.3.1.2,-        wai >=3.2.2.1+        lens >=4.19.2,+        random >=1.2.0,+        text >=1.2.4.1,+        time >=1.9.3,+        unliftio >=0.2.18,+        unliftio-core >=0.2.0.1,+        vault >=0.3.1.5,+        wai >=3.2.3
library/Network/AWS/XRayClient/WAI.hs view
@@ -1,7 +1,4 @@-{-# LANGUAGE NamedFieldPuns #-}---- | Module for using a WAI Middleware as an X-Ray client.-+-- | Module for using a WAI Middleware as an X-Ray client module Network.AWS.XRayClient.WAI   ( XRayClientConfig(..)   , xrayClientConfig@@ -27,7 +24,6 @@ import qualified Data.ByteString.Char8 as BS8 import Data.Foldable (toList) import Data.IORef-import Data.Monoid ((<>)) import Data.Sequence (Seq, (|>)) import qualified Data.Sequence as Seq import Data.Text (Text)@@ -45,16 +41,16 @@ import UnliftIO.Exception (finally)  -- | Configuration type for the XRay client middleware.-data XRayClientConfig-  = XRayClientConfig+data XRayClientConfig = XRayClientConfig   { xrayClientConfigDaemonHost :: !Text-    -- ^ The host that the daemon is listening on.+  -- ^ The host that the daemon is listening on.   , xrayClientConfigDaemonPort :: !Int-    -- ^ The port that the daemon is listening on.+  -- ^ The port that the daemon is listening on.   , xrayClientConfigApplicationName :: !Text-    -- ^ The value of the "name" field that will be sent to X-Ray.-  , xrayClientConfigSampler :: !(Maybe (Request -> Response -> POSIXTime -> POSIXTime -> IO Bool))-    -- ^ A sampling function to filter traces.+  -- ^ The value of the "name" field that will be sent to X-Ray.+  , xrayClientConfigSampler+      :: !(Maybe (Request -> Response -> POSIXTime -> POSIXTime -> IO Bool))+  -- ^ A sampling function to filter traces.   }  -- | Constructor for 'XRayClientConfig' with required arguments.@@ -174,18 +170,17 @@     %~ (xraySegmentHttpResponseStatus ?~ statusCode (responseStatus response))  -- | We use the WAI 'V.Vault' to store data needed during traces.-data XRayVaultData-  = XRayVaultData+data XRayVaultData = XRayVaultData   { xrayVaultDataTraceIdHeaderData :: !XRayTraceIdHeaderData-    -- ^ Data about the current trace.+  -- ^ Data about the current trace.   , xrayVaultDataClientConfig :: !XRayClientConfig-    -- ^ Client configuration passed into the middleware.+  -- ^ Client configuration passed into the middleware.   , xrayVaultDataRootSegmentId :: !XRaySegmentId-    -- ^ Segment ID of the root segment for this request.+  -- ^ Segment ID of the root segment for this request.   , xrayVaultDataStdGen :: !(IORef StdGen)-    -- ^ 'StdGen' for generating segment IDs and trace IDs.+  -- ^ 'StdGen' for generating segment IDs and trace IDs.   , xrayVaultDataSubsegments :: !(IORef (Seq XRaySegment))-    -- ^ Current list of subsegments.+  -- ^ Current list of subsegments.   }  -- | This is a 'V.Key' for the @vault@ inside each WAI 'Request'. It is used to@@ -223,22 +218,18 @@   startTime <- liftIO getPOSIXTime    -- Catch any exceptions and rethrow them once we've sent the segment-  finally action-    $ liftIO-    $ do-        endTime <- getPOSIXTime+  finally action $ liftIO $ do+    endTime <- getPOSIXTime -        -- Generate a segment ID-        segmentId <- withRandomGenIORef-          (xrayVaultDataStdGen vaultData)-          generateXRaySegmentId+    segmentId <- withRandomGenIORef+      (xrayVaultDataStdGen vaultData)+      generateXRaySegmentId -        -- Create the subsegment value and append to the subsegments.-        let-          subsegment =-            xraySubsegment subsegmentName segmentId startTime (Just endTime)-          subsegment' = modifySubsegment subsegment-        atomicallyAddVaultDataSubsegment vaultData subsegment'+    let+      subsegment =+        xraySubsegment subsegmentName segmentId startTime (Just endTime)+      subsegment' = modifySubsegment subsegment+    atomicallyAddVaultDataSubsegment vaultData subsegment'  -- | Add subsegment to XRay vault data 'IORef'. atomicallyAddVaultDataSubsegment :: XRayVaultData -> XRaySegment -> IO ()