hs-opentelemetry-vendor-honeycomb 0.0.1.2 → 1.0.0.0
raw patch · 6 files changed
+60/−30 lines, 6 filesdep ~hs-opentelemetry-apidep ~hs-opentelemetry-vendor-honeycombPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: hs-opentelemetry-api, hs-opentelemetry-vendor-honeycomb
API changes (from Hackage documentation)
- OpenTelemetry.Vendor.Honeycomb: instance Data.String.IsString OpenTelemetry.Vendor.Honeycomb.EnvironmentName
- OpenTelemetry.Vendor.Honeycomb: instance Data.String.IsString OpenTelemetry.Vendor.Honeycomb.HoneycombTeam
- OpenTelemetry.Vendor.Honeycomb: instance GHC.Show.Show OpenTelemetry.Vendor.Honeycomb.DatasetInfo
- OpenTelemetry.Vendor.Honeycomb: instance GHC.Show.Show OpenTelemetry.Vendor.Honeycomb.EnvironmentName
- OpenTelemetry.Vendor.Honeycomb: instance GHC.Show.Show OpenTelemetry.Vendor.Honeycomb.HoneycombTarget
- OpenTelemetry.Vendor.Honeycomb: instance GHC.Show.Show OpenTelemetry.Vendor.Honeycomb.HoneycombTeam
+ OpenTelemetry.Vendor.Honeycomb: instance GHC.Internal.Data.String.IsString OpenTelemetry.Vendor.Honeycomb.EnvironmentName
+ OpenTelemetry.Vendor.Honeycomb: instance GHC.Internal.Data.String.IsString OpenTelemetry.Vendor.Honeycomb.HoneycombTeam
+ OpenTelemetry.Vendor.Honeycomb: instance GHC.Internal.Show.Show OpenTelemetry.Vendor.Honeycomb.DatasetInfo
+ OpenTelemetry.Vendor.Honeycomb: instance GHC.Internal.Show.Show OpenTelemetry.Vendor.Honeycomb.EnvironmentName
+ OpenTelemetry.Vendor.Honeycomb: instance GHC.Internal.Show.Show OpenTelemetry.Vendor.Honeycomb.HoneycombTarget
+ OpenTelemetry.Vendor.Honeycomb: instance GHC.Internal.Show.Show OpenTelemetry.Vendor.Honeycomb.HoneycombTeam
Files
- ChangeLog.md +4/−0
- LICENSE +1/−1
- README.md +29/−1
- hs-opentelemetry-vendor-honeycomb.cabal +17/−17
- src/OpenTelemetry/Vendor/Honeycomb.hs +9/−10
- test/Main.hs +0/−1
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for hs-opentelemetry-vendor-honeycomb +## 1.0.0.0 - 2026-05-29++- Promoted to 1.0.0.0 for the hs-opentelemetry 1.0 release.+ ## 0.0.1.2 - Support newer dependencies
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) Mercury Technologies, Inc 2022+Copyright (c) Mercury Technologies, Inc 2022-2026 All rights reserved.
README.md view
@@ -1,1 +1,29 @@-# otlp+# Honeycomb Utilities++[](https://hackage.haskell.org/package/hs-opentelemetry-vendor-honeycomb)++Utilities for deriving Honeycomb-specific constructs from OpenTelemetry instrumentation.++## Usage++For example, the following will print the URL for the Honeycomb trace visualization associated with the current span:++```haskell+do+ config <- getConfigPartsFromEnv >>= \case+ Nothing -> throwIO $ userError "invalid Honeycomb config"+ Just (teamWriteKey, datasetName) -> pure $ HoneyComb.config teamWriteKey datasetName+ provider <- getGlobalTracerProvider+ target <- resolveHoneycombTarget provider config++ timestamp <- Data.Time.Clock.getCurrentTime++ context <- OpenTelemetry.Context.ThreadLocal.lookupContext >>= \case+ Nothing -> throwIO $ userError "no trace context available"+ Just context -> pure context+ spanContext <- OpenTelemetry.Context.lookupSpan context >>= \case+ Nothing -> throwIO $ userError "no span in trace context"+ Just span -> getSpanContext span++ print $ makeDirectTraceLink target timestamp spanContext.traceId+```
hs-opentelemetry-vendor-honeycomb.cabal view
@@ -1,22 +1,22 @@ 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.38.3. -- -- see: https://github.com/sol/hpack -name: hs-opentelemetry-vendor-honeycomb-version: 0.0.1.2-synopsis: Optional OpenTelemetry integration for Honeycomb-description: Please see the README on GitHub at <https://github.com/iand675/hs-opentelemetry#readme>-category: OpenTelemetry-homepage: https://github.com/iand675/hs-opentelemetry#readme-bug-reports: https://github.com/iand675/hs-opentelemetry/issues-author: Ian Duncan, Jade Lovelace-maintainer: ian@iankduncan.com-copyright: 2024 Ian Duncan, Mercury Technologies-license: BSD3-license-file: LICENSE-build-type: Simple+name: hs-opentelemetry-vendor-honeycomb+version: 1.0.0.0+synopsis: Optional OpenTelemetry integration for Honeycomb+description: Please see the README on GitHub at <https://github.com/iand675/hs-opentelemetry#readme>+category: OpenTelemetry+homepage: https://github.com/iand675/hs-opentelemetry#readme+bug-reports: https://github.com/iand675/hs-opentelemetry/issues+author: Ian Duncan, Jade Lovelace+maintainer: ian@iankduncan.com+copyright: 2024 Ian Duncan, Mercury Technologies+license: BSD3+license-file: LICENSE+build-type: Simple extra-source-files: README.md ChangeLog.md@@ -37,7 +37,7 @@ base >=4.7 && <5 , bytestring , honeycomb >=0.1.0.1- , hs-opentelemetry-api+ , hs-opentelemetry-api ==1.0.* , mtl , text , time@@ -60,8 +60,8 @@ hspec-discover:hspec-discover build-depends: base >=4.7 && <5- , hs-opentelemetry-api- , hs-opentelemetry-vendor-honeycomb+ , hs-opentelemetry-api ==1.0.*+ , hs-opentelemetry-vendor-honeycomb ==1.0.* , hspec , time default-language: Haskell2010
src/OpenTelemetry/Vendor/Honeycomb.hs view
@@ -44,7 +44,9 @@ import Control.Monad.Reader (MonadIO (..), MonadTrans (..), ReaderT (runReaderT)) import Control.Monad.Trans.Maybe (MaybeT (..)) import Data.ByteString (ByteString)+import qualified Data.ByteString.Builder as BSB import qualified Data.ByteString.Char8 as BS8+import qualified Data.ByteString.Lazy as BSL import qualified Data.HashMap.Strict as HM import Data.String (IsString) import Data.Text (Text)@@ -112,10 +114,9 @@ This does not do any HTTP. - FIXME(jadel): This should ideally fetch this from the tracer provider, but- it's nonobvious how to architect being able to do that (requires changes in- hs-opentelemetry-api). For now let's take a Tracer such that we- can fix it later, then do it the obvious way.+ Note: this reads OTLP headers from environment variables directly rather+ than extracting them from the TracerProvider. The TracerProvider parameter+ is accepted for forward compatibility but currently unused. -} getConfigPartsFromEnv :: (MonadIO m) => TracerProvider -> m (Maybe (Text, DatasetName)) getConfigPartsFromEnv _ = do@@ -220,15 +221,13 @@ <> query Classic ds -> teamPrefix <> "/datasets/" <> (encodeUtf8 . fromDatasetName $ ds) <> "/trace" <> query where- -- XXX(jadel): I feel like there's not really any way to know what these- -- actual values are, even if we are omniscient of the Haskell application.- -- For instance, if someone else calls us, we simply don't know when the- -- trace started. So it's kind of a fool's errand. Let's just give ± 1hr and- -- call it a day.+ -- Trace start/end times are unknown at URL generation time (the trace may+ -- still be in progress, or originated from another service). Use ±1hr as a+ -- reasonable window for the Honeycomb UI query. oneHour = secondsToNominalDiffTime 3600 guessedStart = addUTCTime (-oneHour) timestamp guessedEnd = addUTCTime oneHour timestamp- convertTimestamp = BS8.pack . show @Integer . truncate . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds+ convertTimestamp = BSL.toStrict . BSB.toLazyByteString . BSB.integerDec . truncate . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds teamPrefix = "https://ui.honeycomb.io/" <> encodeUtf8 (unHoneycombTeam targetTeam) query =
test/Main.hs view
@@ -6,7 +6,6 @@ import Prelude --- FIXME(jadel): use the hs-opentelemetry-instrumentation-hspec example main :: IO () main = do putStrLn "Begin tests"