08 The Broker In Klok Dev

The Broker In klok.dev

klok.dev shows the Pulsar broker live: every topic of a namespace, how much is waiting, how fast it is read, which routes publish and read it, and who may read it. It also applies Git to the broker: a topic or a grant is a change to the owning tenant's Pulsar file in Git first, and klok.dev then creates on the broker what the file declares. This page explains what the figures mean and how a change reaches the broker. The click-by-click guide for each role is in klok.dev's own documentation, frontend-klok-dev.

Where To Look

You want to know Open
How every topic of a namespace is doing Run → Broker (/monitoring/broker), tab Topics, then the namespace
Who reads a topic, on how many pods and with what concurrency, and who may read it the topic's own page, from the table
What waits anywhere: backlogs that no consumer reads, and dead-letter queues that hold messages Broker → Health (/monitoring/runtime-health), summed over every namespace you may see
Every topic of one datamodel, with all its purposes, the routes that publish it and the routes that read it the datamodel's page under Build → Datamodels, tab Topics

The figures on the Topics tab and on a topic's page refresh every ten seconds. klok.dev stores none of them; the rates are the broker's own averages.

What you see depends on who you are. A KlokAdmin sees every namespace. Anyone else sees their own tenant's namespaces, and their own tenant's subscriptions on another tenant's topics where the tenant holds consume.

Three Sources, Always Named

Every figure on these pages comes from one of three sources, and the page says which:

  • Declared, from Git: the routes that are built to publish or read a topic, from each project's documentation publish and the integration context graph. A topic name that klok.dev had to work out from a route's pattern and configuration, rather than read from the build, is marked as derived.
  • Observed, from the broker: backlog, rates, subscriptions, consumers and publishers, right now.
  • Access, from Git and the broker: the topics and grants in the owning tenant's Pulsar file, compared with what the broker holds. A grant in Git that the broker does not hold yet is not applied; a grant the broker holds that is not in Git is drift.

What The Columns Mean

Column Meaning
Datamodel, purpose read from the topic name, <Model>[_<purpose>]
Publishers, subscriptions who writes and who reads, observed; a reader is its subscription, named after its route id
Concurrency declared / effective, per subscription (below)
Backlog messages published and not yet acknowledged by the subscription
Rate in messages per second published on the topic
Dispatch rate messages per second the broker sends to the subscription's consumers
Acknowledge rate messages per second the subscription's consumers acknowledge: the real speed of the reader
Oldest message the age of the oldest message still in the backlog
Time to drain backlog divided by acknowledge rate: how long the backlog lasts if nothing new arrives
DLQ the size of <topic>_DLQ, messages the reader gave up on

A rising backlog with a steady acknowledge rate means the reader is slower than the publisher. A backlog that stands still with an acknowledge rate of zero means the reader is stopped. A growing DLQ means messages are failing, and Retries, DLQ, And Failure Events is the next page to read.

Declared And Effective Concurrency

The declared concurrency is the route's <RouteId>.subscription.concurrency as the project's documentation publish reports it from configuration. The effective concurrency is what each pod actually runs: the broker client attaches metadata to every consumer and producer it creates, and the broker shows it with the topic's statistics:

Metadata Value
klok-route-id the route that owns the consumer or producer
klok-instance the pod's klok.instance
klok-subscription-concurrency the number of receive loops on the consumer

When the two differ, an override in Vault, the environment or a framework default is in play. A consumer from a broker client that does not attach the metadata shows its concurrency as unknown.

Why One Pod Is One Consumer

The broker client opens one consumer per subscription in a pod and runs all its receive loops on it. The broker counts consumers, so a worker with concurrency 80 on one pod shows one consumer. Read concurrency from the effective column, not from the number of consumers.

Why Unacked Is Not "In Progress"

The broker's unackedMessages counts every message it has sent to a consumer and not yet seen acknowledged. That includes the messages the consumer fetched ahead into its receiver queue (1,000 by default), not only the ones a receive loop is handling. A busy worker therefore shows about 1,000 unacked messages whatever its concurrency. Judge progress by the acknowledge rate and the time to drain.

Requesting A Topic Or Access

The broker creates no topics by itself: a topic exists when the owning tenant's Pulsar file lists it and the file has been applied. Developers ask for what is missing in klok.dev, and the owner approves:

  1. A developer asks. Request topic or access in the header of Run → Broker (/monitoring/broker/request), the Request it links on a project's Broker setup panel, and the link in every TOPIC_MISSING and TOPIC_ACCESS_DENIED message open the same page, for a new topic, consume or publish. A person of another tenant may ask for consume, never for publish.
  2. The owner approves. A TenantAdmin of the owning tenant, a DomainAdmin of the topic's namespace, or a KlokAdmin gets an e-mail and approves in Broker → Requests (/monitoring/broker/requests).
  3. klok.dev writes it into Git and applies it. The change goes into the owning tenant's Pulsar file in klok/environment/klok-environment-setup (ansible-master/playbooks/group_vars/all/pulsar_tenant_<tenant>.yml) as a merge request that klok.dev merges, and then klok.dev creates the topic, with its companions, or the grant on the broker. The requester gets an e-mail when it is applied.

The generic topic of every datamodel, and the ODL's change event topics, need no request: klok.dev declares them in Git and applies them itself. Until the broker has a change that Git has, the topic's page shows it as not applied; the next Ensure run applies it. A merge made by hand in GitLab is applied the same way.

The whole walk for developers, owners and platform staff is Topics On The Klok Broker. The rules behind it, write narrow and consume wide, and why klok.dev reads the broker with one identity and applies Git with another, are on the framework development guide's page Broker Access And Tenant Isolation. Topic names and purposes are in the Topic And Naming Cheatsheet.