packages feed

hotel-california 0.0.5.0 → 0.0.6.0

raw patch · 5 files changed

+24/−8 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ HotelCalifornia.Exec: runNoTracing :: Subprocess -> IO ()
- HotelCalifornia.Tracing: withGlobalTracing :: MonadUnliftIO m => m a -> m a
+ HotelCalifornia.Tracing: withGlobalTracing :: MonadUnliftIO m => (Maybe HoneycombTarget -> m a) -> m a

Files

CHANGELOG.md view
@@ -8,6 +8,13 @@  ## Unreleased +## 0.0.6.0 - 2024-03-28++- [#20](https://github.com/parsonsmatt/hotel-california/pull/19/)+    - Reduce Honeycomb target initialization timeout from 3 seconds to 1 second.+    - `withGlobalTracing` now expects a callback that accepts the honeycomb target.+    - Executable bypasses OTEL operations if Honeycomb target cannot be initialized.+ ## 0.0.5.0 - 2024-02-29  - [#19](https://github.com/parsonsmatt/hotel-california/pull/19/)
app/Main.hs view
@@ -47,9 +47,11 @@  main :: IO () main = do-    withGlobalTracing do+    withGlobalTracing $ \mTarget -> do         let parserPrefs = defaultPrefs{ prefMultiSuffix = "..." }         Command {..} <- customExecParser parserPrefs optionsParser         case commandSubCommand of             Exec execArgs ->-                runExecArgs execArgs+                case mTarget of+                    Just _target -> runExecArgs execArgs+                    Nothing -> runNoTracing $ execArgsSubprocess execArgs
hotel-california.cabal view
@@ -1,11 +1,11 @@ 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:           hotel-california-version:        0.0.5.0+version:        0.0.6.0 description:    Please see the README on GitHub at <https://github.com/parsonsmatt/hotel-california#readme> homepage:       https://github.com/parsonsmatt/hotel-california#readme bug-reports:    https://github.com/parsonsmatt/hotel-california/issues
src/HotelCalifornia/Exec.hs view
@@ -121,6 +121,13 @@      pure $ processAttributes <> extraAttributes +runNoTracing :: Subprocess -> IO ()+runNoTracing subproc = do+    let processConfig = commandToProcessConfig subproc+    userEnv <- getEnvironment+    exitCode <- runProcess $ setEnv userEnv processConfig+    exitWith exitCode+ runExecArgs :: ExecArgs -> IO () runExecArgs ExecArgs {..} = do     initialAttributes <- makeInitialAttributes execArgsSubprocess execArgsAttributes
src/HotelCalifornia/Tracing.hs view
@@ -29,14 +29,14 @@ --   up the provider afterwards. -- --   This also sets up an empty context (creating a new trace ID).-withGlobalTracing :: MonadUnliftIO m => m a -> m a+withGlobalTracing :: MonadUnliftIO m => (Maybe Honeycomb.HoneycombTarget -> m a) -> m a withGlobalTracing act = do     void $ attachContext Context.empty     liftIO setParentSpanFromEnvironment     bracket (liftIO initializeGlobalTracerProvider) shutdownTracerProvider $ \_ -> do         -- note: this is not in a span since we don't have a root span yet so it         -- would not wind up in the trace in a helpful way anyway-        void $+        mTarget <-           Honeycomb.getOrInitializeHoneycombTargetInContext initializationTimeout             `catch` \(e :: SomeException) -> do               -- we are too early in initialization to be able to use a normal logger,@@ -47,9 +47,9 @@               liftIO . BS8.hPutStrLn stderr $ "error setting up Honeycomb trace links: " <> (BS8.pack $ displayException e)               pure Nothing -        act+        act mTarget   where-    initializationTimeout = secondsToNominalDiffTime 3+    initializationTimeout = secondsToNominalDiffTime 1  globalTracer :: MonadIO m => m Tracer globalTracer = getGlobalTracerProvider >>= \tp -> pure $ makeTracer tp "hotel-california" tracerOptions