packages feed

hs-opentelemetry-api 0.0.3.4 → 0.0.3.5

raw patch · 2 files changed

+1/−113 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

hs-opentelemetry-api.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           hs-opentelemetry-api-version:        0.0.3.4+version:        0.0.3.5 synopsis:       OpenTelemetry API for use by libraries for direct instrumentation or wrapper packages. description:    Please see the README on GitHub at <https://github.com/iand675/hs-opentelemetry/tree/main/api#readme> category:       OpenTelemetry, Telemetry, Monitoring, Observability, Metrics
src/OpenTelemetry/Trace/Id.hs view
@@ -96,118 +96,6 @@     Left err -> error err     Right ok -> ok ---- | bytes pointed to by src to the hexadecimal binary representation.-toHexadecimal :: ShortByteString -- ^ source bytes-              -> ShortByteString -- ^ hexadecimal output-toHexadecimal (SBS bin) = runST $ ST $ \s ->-  case newByteArray# (n *# 2# ) s of-    (# s1, mba #) -> case loop 0# mba s1 of-      s2 -> case unsafeFreezeByteArray# mba s2 of-        (# s3, ba #) -> (# s3, SBS ba #)-  where-    !n = sizeofByteArray# bin-    loop i bout s-      | isTrue# (i ==# n) = s-      | otherwise = do-          let !w = indexWord8Array# bin i-          let !(# w1, w2 #) = convertByte w-          case writeWord8Array# bout (i *# 2#) w1 s of-            s1 -> case writeWord8Array# bout ((i *# 2#) +# 1#) w2 s1 of-              s2 -> loop (i +# 1#) bout s2---- | Convert a value Word# to two Word#s containing--- the hexadecimal representation of the Word#-convertByte :: Word# -> (# Word#, Word# #)-convertByte b = (# r tableHi b, r tableLo b #)-  where-        r :: Addr# -> Word# -> Word#-        r table ix = indexWord8OffAddr# table (word2Int# ix)--        !tableLo =-            "0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef\-            \0123456789abcdef0123456789abcdef"#-        !tableHi =-            "00000000000000001111111111111111\-            \22222222222222223333333333333333\-            \44444444444444445555555555555555\-            \66666666666666667777777777777777\-            \88888888888888889999999999999999\-            \aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb\-            \ccccccccccccccccdddddddddddddddd\-            \eeeeeeeeeeeeeeeeffffffffffffffff"#-{-# INLINE convertByte #-}---- | Convert a base16 @src to the byte equivalent.------ length of the 'ShortByteString' input must be even------ TODO, not working right-fromHexadecimal :: ShortByteString -> (Maybe ShortByteString)-fromHexadecimal src@(SBS sbs)-  | odd (length src) = Nothing-  | otherwise = runST $ ST $ \s -> case newByteArray# newLen# s of-      (# s1, dst #) -> case loop dst 0# 0# s1 of-        (# s2, Just _ #) -> (# s2, Nothing #)-        (# s2, Nothing #) -> case unsafeFreezeByteArray# dst s2 of-          (# s3, sbs' #) -> (# s3, Just $ SBS sbs' #)-  where-    !(I# newLen#) = length src `div` 2-    loop dst di i s-      | isTrue# (i ==# newLen#) = (# s, Nothing #)-      | otherwise = do-        let a = rHi (indexWord8Array# sbs i)-        let b = rLo (indexWord8Array# sbs (i +# 1#))-        if isTrue# (eqWord# a (int2Word# 0xff#)) || isTrue# (eqWord# b (int2Word# 0xff#))-            then (# s, Just (I# i) #)-            else-              case writeWord8Array# dst di (or# a b) s of-                s1 -> loop dst (di +# 1#) (i +# 2#) s1--    rLo ix = indexWord8OffAddr# tableLo (word2Int# ix)-    rHi ix = indexWord8OffAddr# tableHi (word2Int# ix)--    !tableLo =-            "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xff\xff\xff\xff\xff\xff\-              \\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\x0a\x0b\x0c\x0d\x0e\x0f\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#-    !tableHi =-            "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\x00\x10\x20\x30\x40\x50\x60\x70\x80\x90\xff\xff\xff\xff\xff\xff\-              \\xff\xa0\xb0\xc0\xd0\xe0\xf0\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xa0\xb0\xc0\xd0\xe0\xf0\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\-              \\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"#- -- | Generate a 'TraceId' using the provided 'IdGenerator' -- -- This function is generally called by the @hs-opentelemetry-sdk@,