Skip to content

Update Producer stats on producer flush() or close() #12426

Description

@frankjkelly

Is your enhancement request related to a problem? Please describe.
The default producer stats update period is 60 seconds

/**
* Stats will be activated with positive statsIntervalSeconds
*
* @return the interval between each stat info <i>(default: 60 seconds)</i>
*/
public long getStatsIntervalSeconds() {
return confData.getStatsIntervalSeconds();
}

if you have a short-lived producer (lasts less than 60 seconds) then the quantile latencies will not get updated and you will see 0 values for the latencies

synchronized (ds) {
latencyPctValues = ds.getQuantiles(PERCENTILES);
ds.reset();
}

Describe the solution you'd like
It would be nice on Producer flush() or close() to capture the complete final state of the statistics (including the latencies)
Say perhaps on close() here
https://github.com/apache/pulsar/blob/v2.7.2/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java#L842

Describe alternatives you've considered
Not aware of alternatives but perhaps others are

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions