Skip to content

Commit

Permalink
Add a message transaction counter
Browse files Browse the repository at this point in the history
Co-authored-by: ybelMekk <[email protected]>
Co-authored-by: sindrerh2 <[email protected]>
  • Loading branch information
3 people committed Nov 22, 2024
1 parent 8f11a57 commit eccab2c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/canary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ const (
SlowConsumer = "slow-consumer"
KafkaTransactionTopic = "kafka-transaction-topic"
KafkaTransactionEnable = "enable-transaction-canary"

// TODO: kafta-transaction-canary bits
// topic + enable,
// consumer isolation level,
// producer init-transaction,
// producer transaction id,
// consumer commit-offsets,
// begin-tx, abort-tx, commit-tx flow
)

const (
Expand Down Expand Up @@ -109,6 +117,12 @@ var (
Buckets: prometheus.LinearBuckets(0.01, 0.01, 100),
})

TransactedNumbers = prometheus.NewCounter(prometheus.CounterOpts{
Name: "transacted_messages_total",
Namespace: Namespace,
Help: "transacted messages, transcations happen in units of 100 messages in the canary",
})

// - Gauges
// - `kafka_producer_transaction_creation_time_ms`: Time taken to create a transaction.
// - `kafka_producer_transaction_commit_time_ms`: Time taken to commit a transaction.
Expand Down Expand Up @@ -245,6 +259,7 @@ func main() {
}

logger.Infof("Started message producer.")

// --> Transaction <--
// produce to kafkaTopic, consume from kafkatopic and put on kafkaTransactionTopic
txCallback := canarykafka.NewCallback(false, cons)
Expand Down

0 comments on commit eccab2c

Please sign in to comment.