add ExposeLag option, to be able to disable lag exporting
Some checks failed
coverage / build (push) Failing after 1m35s
test / test (push) Failing after 15m18s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-10-09 23:20:10 +03:00
parent d5d1e26d7b
commit 581fecd8f1
5 changed files with 121 additions and 81 deletions

View File

@@ -15,7 +15,7 @@ var (
DefaultCommitInterval = 5 * time.Second
// DefaultStatsInterval specifies how fast check consumer lag
DefaultStatsInterval = 5 * time.Second
DefaultStatsInterval = 30 * time.Second
// DefaultSubscribeMaxInflight specifies how much messages keep inflight
DefaultSubscribeMaxInflight = 100
@@ -120,3 +120,10 @@ func PublishPromise(fn func(*kgo.Record, error)) broker.PublishOption {
func ClientPublishPromise(fn func(*kgo.Record, error)) client.PublishOption {
return client.SetPublishOption(publishPromiseKey{}, fn)
}
type exposeLagKey struct{}
// ExposeLag enabled subscriber lag via [meter.Meter]
func ExposeLag(b bool) broker.Option {
return broker.SetOption(exposeLagKey{}, b)
}