Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module for creating great logs in code using Kafka.
Synopsis
- emptyDetails :: Details
- data Details
- topic :: Details -> Maybe Text
- partitionId :: Details -> Maybe Int
- key :: Details -> Maybe Text
- contents :: Details -> Maybe Contents
- createTime :: Details -> Maybe UTCTime
- logAppendTime :: Details -> Maybe UTCTime
- processAttempt :: Details -> Maybe Int
- assignedPartitions :: Details -> Maybe Int
- pausedPartitions :: Details -> Maybe Int
- timeSinceLastRebalance :: Details -> Maybe Float
- requestId :: Details -> Maybe Text
- mkContents :: ToJSON a => a -> Contents
- data Contents
Documentation
emptyDetails :: Details Source #
An empty details value to be modified by you.
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
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.
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.
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 }