@@ -16,65 +16,62 @@ module Development.IDE.Core.Tracing
16
16
)
17
17
where
18
18
19
- import Control.Concurrent.Async (Async , async )
20
- import Control.Concurrent.Extra (Var , modifyVar_ , newVar ,
21
- readVar , threadDelay )
22
- import Control.Exception (evaluate )
23
- import Control.Exception.Safe (SomeException , catch ,
24
- generalBracket )
25
- import Control.Monad (forM_ , forever , void , when ,
26
- (>=>) )
27
- import Control.Monad.Catch (ExitCase (.. ), MonadMask )
28
- import Control.Monad.Extra (whenJust )
19
+ import Control.Concurrent.Async (Async , async )
20
+ import Control.Concurrent.Extra (Var , modifyVar_ , newVar ,
21
+ readVar , threadDelay )
22
+ import Control.Exception (evaluate )
23
+ import Control.Exception.Safe (SomeException , catch ,
24
+ generalBracket )
25
+ import Control.Monad (forM_ , forever , void , when ,
26
+ (>=>) )
27
+ import Control.Monad.Catch (ExitCase (.. ), MonadMask )
28
+ import Control.Monad.Extra (whenJust )
29
29
import Control.Monad.IO.Unlift
30
- import Control.Seq (r0 , seqList , seqTuple2 ,
31
- using )
32
- import Data.ByteString (ByteString )
33
- import Data.ByteString.Char8 (pack )
34
- import Data.Dynamic (Dynamic )
35
- import qualified Data.HashMap.Strict as HMap
36
- import Data.IORef (modifyIORef' , newIORef ,
37
- readIORef , writeIORef )
38
- import Data.String (IsString (fromString ))
39
- import qualified Data.Text as T
40
- import Data.Text.Encoding (encodeUtf8 )
41
- import Data.Typeable (TypeRep , typeOf )
42
- import Data.Word (Word16 )
43
- import Debug.Trace.Flags (userTracingEnabled )
44
- import Development.IDE.Core.RuleTypes (GhcSession (GhcSession ),
45
- GhcSessionDeps (GhcSessionDeps ),
46
- GhcSessionIO (GhcSessionIO ))
47
- import Development.IDE.Graph (Action )
30
+ import Control.Seq (r0 , seqList , seqTuple2 , using )
31
+ import Data.ByteString (ByteString )
32
+ import Data.ByteString.Char8 (pack )
33
+ import Data.Dynamic (Dynamic )
34
+ import qualified Data.HashMap.Strict as HMap
35
+ import Data.IORef (modifyIORef' , newIORef ,
36
+ readIORef , writeIORef )
37
+ import Data.String (IsString (fromString ))
38
+ import qualified Data.Text as T
39
+ import Data.Text.Encoding (encodeUtf8 )
40
+ import Data.Typeable (TypeRep , typeOf )
41
+ import Data.Word (Word16 )
42
+ import Debug.Trace.Flags (userTracingEnabled )
43
+ import Development.IDE.Core.RuleTypes (GhcSession (GhcSession ),
44
+ GhcSessionDeps (GhcSessionDeps ),
45
+ GhcSessionIO (GhcSessionIO ))
46
+ import Development.IDE.Graph (Action )
48
47
import Development.IDE.Graph.Rule
49
- import Development.IDE.Types.Diagnostics (FileDiagnostic ,
50
- showDiagnostics )
51
- import Development.IDE.Types.Location (Uri (.. ))
52
- import Development.IDE.Types.Logger (Logger (Logger ), logDebug ,
53
- logInfo )
54
- import Development.IDE.Types.Shake (Value ,
55
- ValueWithDiagnostics (.. ),
56
- Values , fromKeyType )
57
- import Foreign.Storable (Storable (sizeOf ))
58
- import HeapSize (recursiveSize , runHeapsize )
59
- import Ide.PluginUtils (installSigUsr1Handler )
60
- import Ide.Types (PluginId (.. ))
61
- import Language.LSP.Types (NormalizedFilePath ,
62
- fromNormalizedFilePath )
63
- import Numeric.Natural (Natural )
64
- import OpenTelemetry.Eventlog (SpanInFlight (.. ), addEvent ,
65
- beginSpan , endSpan ,
66
- mkValueObserver , observe ,
67
- setTag , withSpan , withSpan_ )
68
-
69
-
48
+ import Development.IDE.Types.Location (Uri (.. ))
49
+ import Development.IDE.Types.Logger (Logger (Logger ), logDebug ,
50
+ logInfo )
51
+ import Development.IDE.Types.Shake (Value ,
52
+ ValueWithDiagnostics (.. ),
53
+ Values , fromKeyType )
54
+ import Foreign.Storable (Storable (sizeOf ))
55
+ import HeapSize (recursiveSize , runHeapsize )
56
+ import Ide.PluginUtils (installSigUsr1Handler )
57
+ import Ide.Types (PluginId (.. ))
58
+ import Language.LSP.Types (NormalizedFilePath ,
59
+ fromNormalizedFilePath )
60
+ import Numeric.Natural (Natural )
61
+ import OpenTelemetry.Eventlog (SpanInFlight (.. ), addEvent ,
62
+ beginSpan , endSpan ,
63
+ mkValueObserver , observe ,
64
+ setTag , withSpan , withSpan_ )
65
+
66
+ #if MIN_VERSION_ghc(8,8,0)
70
67
otTracedProvider :: MonadUnliftIO m => PluginId -> ByteString -> m a -> m a
71
68
otTracedGarbageCollection :: (MonadMask f , MonadIO f , Show a ) => ByteString -> f [a ] -> f [a ]
72
69
withEventTrace :: (MonadMask m , MonadIO m ) => String -> ((ByteString -> ByteString -> m () ) -> m a ) -> m a
73
-
74
-
75
-
76
-
77
-
70
+ #else
71
+ otTracedProvider :: MonadUnliftIO m => PluginId -> String -> m a -> m a
72
+ otTracedGarbageCollection :: ( MonadMask f , MonadIO f , Show a ) => String -> f [ a ] -> f [ a ]
73
+ withEventTrace :: ( MonadMask m , MonadIO m ) => String -> (( String -> ByteString -> m () ) -> m a ) -> m a
74
+ #endif
78
75
79
76
withTrace :: (MonadMask m , MonadIO m ) =>
80
77
String -> ((String -> String -> m () ) -> m a ) -> m a
0 commit comments