tracing 0.0.7.0 → 0.0.7.1
raw patch · 2 files changed
+17/−4 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Monitor.Tracing.Zipkin: addProducerKind :: Builder -> Builder
+ Monitor.Tracing.Zipkin: b3FromSpan :: Span -> B3
Files
- src/Monitor/Tracing/Zipkin.hs +16/−3
- tracing.cabal +1/−1
src/Monitor/Tracing/Zipkin.hs view
@@ -24,13 +24,13 @@ -- * Cross-process spans -- ** Communication- B3(..), b3ToHeaders, b3FromHeaders, b3ToHeaderValue, b3FromHeaderValue,+ B3(..), b3ToHeaders, b3FromHeaders, b3ToHeaderValue, b3FromHeaderValue, b3FromSpan, -- ** Span generation clientSpan, clientSpanWith, serverSpan, serverSpanWith, producerSpanWith, consumerSpanWith, -- * Custom metadata -- ** Tags- tag, addTag, addInheritedTag,+ tag, addTag, addInheritedTag, addProducerKind, -- ** Annotations -- | Annotations are similar to tags, but timestamped. annotate, annotateAt,@@ -175,6 +175,15 @@ addTag key val bldr = bldr { builderTags = Map.insert (publicKeyPrefix <> key) (JSON.toJSON val) (builderTags bldr) } +-- | Adds a producer kind tag to a builder. This is a convenience method to use with 'rootSpanWith', for example:+--+-- > rootSpanWith addProducerKind alwaysSampled "root" $ action+--+-- Use this method if you want to create a root producer span.+-- Otherwise use 'producerSpanWith' to create a sub span with producer kind.+addProducerKind :: Builder -> Builder+addProducerKind = addTag kindKey producerKindValue+ -- | Adds an inherited tag to a builder. Unlike a tag added via 'addTag', this tag: -- -- * will be inherited by all the span's /local/ children.@@ -319,6 +328,10 @@ kindKey :: Key kindKey = "z.k" +-- Value that indicates a producer span kind.+producerKindValue :: Text+producerKindValue = "PRODUCER"+ outgoingSpan :: MonadTrace m => Text -> Endo Builder -> Name -> (Maybe B3 -> m a) -> m a outgoingSpan kind endo name f = childSpanWith (appEndo endo') name actn where endo' = insertTag kindKey kind <> endo@@ -346,7 +359,7 @@ -- | Generates a child span with @PRODUCER@ kind. This function also provides the corresponding 'B3' -- so that it can be forwarded to the consumer. producerSpanWith :: MonadTrace m => (Builder -> Builder) -> Name -> (Maybe B3 -> m a) -> m a-producerSpanWith f = outgoingSpan "PRODUCER" (Endo f)+producerSpanWith f = outgoingSpan producerKindValue (Endo f) incomingSpan :: MonadTrace m => Text -> B3 -> Endo Builder -> m a -> m a incomingSpan kind b3 endo actn =
tracing.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.0 name: tracing-version: 0.0.7.0+version: 0.0.7.1 synopsis: Distributed tracing description: An OpenTracing-compliant, simple, and extensible distributed tracing library.