Documentation
¶
Overview ¶
Package mqmetrics holds the instruments every messagequeue broker records, so that the four brokers agree on what each number means.
Index ¶
Constants ¶
const ( MessagesPublished = "messagequeue.messages_published" PublishErrors = "messagequeue.publish_errors" PublishLatencyMS = "messagequeue.publish_latency_ms" MessagesConsumed = "messagequeue.messages_consumed" HandlerErrors = "messagequeue.handler_errors" ConsumeLatencyMS = "messagequeue.consume_latency_ms" ReceiveErrors = "messagequeue.receive_errors" )
The instrument names, one set shared by every broker.
These used to be built per topic — fmt.Sprintf("%s_consumed", topic) — which cost two things. A dashboard had no single series to aggregate over, because every topic was its own instrument rather than one instrument with a topic attribute. And the instrument name became a function of runtime config: OpenTelemetry accepts [A-Za-z][A-Za-z0-9_./-]{0,254} for an instrument name, which a PubSub subscription path ("projects/p/subscriptions/s") satisfies only by accident and an SQS queue URL does not satisfy at all, so a queue name that the broker was perfectly happy with failed instrument construction at startup. SQS documented that hazard against itself; it applied to all four.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer is the instrument set a broker's consumer records.
func NewConsumer ¶
NewConsumer builds the consumer instrument set for a topic.
func (*Consumer) Handled ¶
Handled records the outcome of one handler invocation: latency either way, then one of the two counters.
MessagesConsumed counts here rather than on arrival. Incrementing it before calling the handler made it a count of messages received, which is a number the broker already reports and which cannot go down when the handler starts failing — so a consumer whose handler errored on every message showed a healthy climbing "consumed" line with nothing beside it to contradict that.
func (*Consumer) ReceiveFailed ¶
ReceiveFailed counts a failure to read from the broker, as distinct from a handler that was given a message and failed on it.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is the instrument set a broker's publisher records.
func NewPublisher ¶
NewPublisher builds the publisher instrument set for a topic.