nri-observability-0.1.1.0: Report log spans collected by nri-prelude.
Safe HaskellNone
LanguageHaskell2010

Log.Kafka

Description

A module for creating great logs in code using Kafka.

Synopsis

Documentation

emptyDetails :: Details Source #

An empty details value to be modified by you.

data Details Source #

A type describing a kafka message being processed by a consumer.

emptyDetails
  { topic = Just "kafka-topic"
  , partitionId = Just 1
  , contents = Just (mkContents "This message is a JSON string!")
  }

Instances

Instances details
Generic Details Source # 
Instance details

Defined in Log.Kafka

Associated Types

type Rep Details :: Type -> Type #

Methods

from :: Details -> Rep Details x #

to :: Rep Details x -> Details #

ToJSON Details Source # 
Instance details

Defined in Log.Kafka

TracingSpanDetails Details Source # 
Instance details

Defined in Log.Kafka

type Rep Details Source # 
Instance details

Defined in Log.Kafka

topic :: Details -> Maybe Text Source #

The topic name of the message.

partitionId :: Details -> Maybe Int Source #

The partition id of the message.

key :: Details -> Maybe Text Source #

The key of the message (if it has one). If a key is provided by a message producer it is used to determine the partition id, in such a way that messages with the same key are guaranteed to end up in the same partition.

contents :: Details -> Maybe Contents Source #

The contents of the message.

createTime :: Details -> Maybe UTCTime Source #

The time at which this message was created by a producer. Whether this property is available for a message depends on the `log.message.timestamp.type` configuration option. More context: https://github.com/edenhill/librdkafka/blob/8bacbc0b4c357193288c81277bfcc815633126ea/INTRODUCTION.md#latency-measurement

logAppendTime :: Details -> Maybe UTCTime Source #

The time at which this message was added to a log by a broker. Whether this property is available for a message depends on the `log.message.timestamp.type` configuration option. More context: https://github.com/edenhill/librdkafka/blob/8bacbc0b4c357193288c81277bfcc815633126ea/INTRODUCTION.md#latency-measurement

processAttempt :: Details -> Maybe Int Source #

Zero-based counter indicating the how-manyth time it is we're attemping to process this message.

assignedPartitions :: Details -> Maybe Int Source #

The amount of partitions for this topic the consumer is responsible for.

pausedPartitions :: Details -> Maybe Int Source #

The amount of partitions this consumer currently has paused, because it's behing processing this partition.

timeSinceLastRebalance :: Details -> Maybe Float Source #

Time since last rebalance in s

requestId :: Details -> Maybe Text Source #

The request id of the http request that resulted in the enqueueing of the message that is now being processed by a worker.

mkContents :: ToJSON a => a -> Contents Source #

Create a Contents value.

The type wrapped needs to have an Aeson.ToJSON instance, so we can present it nicely in observability tools.

data MyMessagePayload { counter :: Int } deriving (Generic)
instance Aeson.ToJSON MyMessagePayload

contents = mkContents MyMessagePayload { counter = 5 }

data Contents Source #

The contents of a Kafka message. Use mkContents to create one of these.

Instances

Instances details
ToJSON Contents Source # 
Instance details

Defined in Log.Kafka