packages feed

hotel-california 0.0.6.0 → 0.0.6.1

raw patch · 4 files changed

+43/−25 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -8,9 +8,14 @@  ## Unreleased +## 0.0.6.1 - 2025-03-07++- [#21](https://github.com/parsonsmatt/hotel-california/pull/21)+  - Add more detail to the program description+ ## 0.0.6.0 - 2024-03-28 -- [#20](https://github.com/parsonsmatt/hotel-california/pull/19/)+- [#20](https://github.com/parsonsmatt/hotel-california/pull/20/)     - 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.
app/Main.hs view
@@ -5,6 +5,7 @@ import HotelCalifornia.Exec import HotelCalifornia.Tracing (withGlobalTracing) import Options.Applicative+import Options.Applicative.Help.Pretty (Doc, vsep)  data Command = Command     { commandGlobalOptions :: GlobalOptions@@ -16,15 +17,23 @@ data SubCommand     = Exec ExecArgs +programDescription :: Doc+programDescription = vsep+  [ "`hotel-california` is a tool for OTel tracing of shell scripts, inspired by `otel-cli`."+  , "For help with a command, say `hotel COMMAND --help`. Currently, the only supported command is `exec`."+  , ""+  , "Check out the repository any time you like at https://github.com/parsonsmatt/hotel-california."+  ]+ optionsParser :: ParserInfo Command optionsParser =-    info' parser' "Welcome to `hotel-california`"+    info' parser' programDescription   where   -- thanks danidiaz for the blog post-    info' :: Parser a -> String -> ParserInfo a-    info' p desc = info+    info' :: Parser a -> Doc -> ParserInfo a+    info' p descDoc = info         (helper <*> p)-        (fullDesc <> progDesc desc <> noIntersperse)+        (fullDesc <> progDescDoc (Just descDoc) <> noIntersperse)      parser' :: Parser Command     parser' =
hotel-california.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.36.0.+-- This file has been generated from package.yaml by hpack version 0.37.0. -- -- see: https://github.com/sol/hpack  name:           hotel-california-version:        0.0.6.0+version:        0.0.6.1 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/Tracing/TraceParent.hs view
@@ -6,17 +6,17 @@     , setParentSpanFromEnvironment     ) where -import qualified Data.ByteString as BS-import qualified Data.ByteString.Char8 as BS8-import qualified Data.Text.Encoding as TE-import qualified Data.Text as Text+import Data.ByteString qualified as BS+import Data.ByteString.Char8 qualified as BS8+import Data.Text qualified as Text+import Data.Text.Encoding qualified as TE import OpenTelemetry.Baggage (Baggage)+import OpenTelemetry.Context qualified as Ctxt+import OpenTelemetry.Context.ThreadLocal+import OpenTelemetry.Propagator.W3CBaggage qualified as W3CBaggage import OpenTelemetry.Propagator.W3CTraceContext-import OpenTelemetry.Trace.Core (SpanContext, isRemote, wrapSpanContext, Span)+import OpenTelemetry.Trace.Core (Span, SpanContext, isRemote, wrapSpanContext) import System.Environment-import OpenTelemetry.Context.ThreadLocal-import qualified OpenTelemetry.Context as Ctxt-import qualified OpenTelemetry.Propagator.W3CBaggage as W3CBaggage  -- | This function looks up the @TRACEPARENT@ and @TRACECONTEXT@ environment -- variables and returns a @'Maybe' 'SpanContext'@ constructed from them.@@ -32,7 +32,8 @@ baggageFromEnvironment = do     mBaggageBytes <- lookupEnvBS "BAGGAGE" -    let mBaggage = do+    let+        mBaggage = do             baggageBytes <- mBaggageBytes             W3CBaggage.decodeBaggage baggageBytes @@ -56,7 +57,8 @@      context <- getContext -    let baggageVariables =+    let+        baggageVariables =             case Ctxt.lookupBaggage context of                 Just baggage ->                     [("BAGGAGE", BS8.unpack (W3CBaggage.encodeBaggage baggage))]@@ -64,10 +66,10 @@                     []      pure-        (   [ ("TRACEPARENT", BS8.unpack traceParent)-            , ("TRACESTATE", BS8.unpack traceState)-            ]-        <>  baggageVariables+        ( [ ("TRACEPARENT", BS8.unpack traceParent)+          , ("TRACESTATE", BS8.unpack traceState)+          ]+            <> baggageVariables         )  -- | This function should be called after you've initialized and attached the@@ -77,16 +79,18 @@     mSpanContext <- spanContextFromEnvironment     mBaggage <- baggageFromEnvironment -    let insertSpanContext =+    let+        insertSpanContext =             case mSpanContext of                 Nothing ->                     id                 Just spanContext ->-                    Ctxt.insertSpan (wrapSpanContext spanContext{ isRemote = True })+                    Ctxt.insertSpan (wrapSpanContext spanContext{isRemote = True}) -    let insertBaggage =+    let+        insertBaggage =             case mBaggage of-                Nothing      -> id+                Nothing -> id                 Just baggage -> Ctxt.insertBaggage baggage      adjustContext (insertBaggage . insertSpanContext)