pubsub: Emit outstanding messages metrics for publishers #6180
Labels
api: pubsub
Issues related to the Pub/Sub API.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Is your feature request related to a problem? Please describe.
The PubSub package emits two metrics related to outstanding messages:
OutstandingMessages
andOutstandingBytes
. The docs mentionAs a user, "messages held by the client" is something I care about in two contexts:
From the docs, I would have expected
OutstandingMessages
to emit metrics for both of those contexts. However, in practice, it seems like the client only incrementsOutstandingMessages
in the context of (2) (code link). At first this was surprising, as it seems like the flow controller (which is used for both publishing and subscribing) is responsible for recording this metric. However, I saw that the metric is only registered with the subscription tag, which makes sense as to why it doesn't record for publishing to a topic.This is frustrating, because I cannot tell from the pubsub client's internal metrics how many messages have been buffered but not yet persisted to PubSub. This is helpful for debugging cases where the PubSub service may be experiencing latency on Publish RPCs, I am experiencing network problems, etc.
Describe the solution you'd like
I would like the pubsub package to emit metrics on how many messages are outstanding in the context of publishing. I don't mind if this requires a separate
View
for producer outstanding metrics and subscriber outstanding metrics.Describe alternatives you've considered
We have implemented our own metrics of how many messages have not yet been fully published by keeping track of
PublishResult
s and decrementing counters when.Get()
returns. It's not as clean as having this natively in the client.The text was updated successfully, but these errors were encountered: