Skip to content

rxmsgs related statistics reported by the consumer are incorrect, when messages are produced by a trx producer #1333

Open
@gelihu

Description

@gelihu

Description

Incorrect stats: rxmsgs of top level metrics and partition metrics of a topic for a consumer type client.
reported rxmsgs = 2 * actual rxmsgs.

How to reproduce

Basic producer and consumer are sufficient to reproduce the issue.

using (var prd = new ProducerBuilder<byte[], byte[]>(cfg).SetStatisticsHandler((p,stat) => Console.WriteLine($"Producer Stat: {stat}").Build())
{
  prd.InitTransaction(default(TimeSpan));
  try
  {
    prd.BeginTransaction();
    for (int i = 0; i < 1; i++)
    {
       byte[] key; rand.NextBytes(key);
       byte[] val; rand.NextBytes(val);
       prd.Produce(topic, new Message<byte[],byte[]> { Key = key, Value =  val });
    }
    prd.CommitTransaction(default(TimeSpan));
  }
  catch (ProduceException<byte[], byte[]> e) {
    prd.AbortTransaction(default(TimeSpan));
  }
}

using (var csm = new ConsumerBuilder<byte[],byte[]>(cfg).SetStatisticsHandler((cn,stat) => Console.WriteLine($"Stat: {stat}").Build())
{
  csm.Subscribe(topic);
  while (true) { csm.Consume(cts.Token); }
}

Checklist

Please provide the following information:

  • A complete (i.e. we can run it), minimal program demonstrating the problem. No need to supply a project file.
  • Confluent.Kafka nuget version: 1.4.0.
  • Apache Kafka version: 2.2.0.
  • Client configuration.
  • Operating system: Windows 10.
  • Provide logs (with "debug" : "..." as necessary in configuration).
  • Provide broker log excerpts.
  • Critical issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions