add tracer enabled status
Some checks failed
test / test (push) Failing after 17m28s
coverage / build (push) Failing after 17m37s
sync / sync (push) Has been cancelled

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-05-19 09:34:19 +03:00
parent b2cd7d8b8e
commit 969e459e3d
4 changed files with 31 additions and 12 deletions

View File

@@ -282,7 +282,9 @@ func (pc *consumer) consume() {
pc.kopts.Meter.Counter(semconv.SubscribeMessageInflight, "endpoint", record.Topic, "topic", record.Topic).Dec()
if err != nil {
sp.SetStatus(tracer.SpanStatusError, err.Error())
if sp != nil {
sp.SetStatus(tracer.SpanStatusError, err.Error())
}
pc.kopts.Meter.Counter(semconv.SubscribeMessageTotal, "endpoint", record.Topic, "topic", record.Topic, "status", "failure").Inc()
} else if pc.opts.AutoAck {
pm.ack = true
@@ -299,13 +301,16 @@ func (pc *consumer) consume() {
if ack {
pc.c.MarkCommitRecords(record)
} else {
sp.Finish()
if sp != nil {
sp.Finish()
}
// pc.connected.Store(0)
pc.kopts.Logger.Fatal(pc.kopts.Context, "[kgo] message not commited")
return
}
sp.Finish()
if sp != nil {
sp.Finish()
}
}
}
}