streamnative / kop

Kafka-on-Pulsar - A protocol handler that brings native Kafka protocol to Apache Pulsar
https://streamnative.io/docs/kop
Apache License 2.0
447 stars 132 forks source link

Add Time based metric exipration. #1996

Closed lifepuzzlefun closed 10 months ago

lifepuzzlefun commented 10 months ago

Fixes #1956

Motivation

FastThreadLocal wont cleanup until thread exit. so we can just check if the stats is not recorded a long time if expired just remove from threadlocal

Modifications

add time check logic if long time have no record just remove the stats.

Verifying this change

Documentation

Check the box below.

Need to update docs?

CLAassistant commented 10 months ago

CLA assistant check
All committers have signed the CLA.

github-actions[bot] commented 10 months ago

@lifepuzzlefun:Thanks for your contribution. For this PR, do we need to update docs? (The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

github-actions[bot] commented 10 months ago

@lifepuzzlefun:Thanks for providing doc info!

codecov[bot] commented 10 months ago

Codecov Report

Merging #1996 (4ef255d) into master (26980a3) will decrease coverage by 0.02%. Report is 1 commits behind head on master. The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1996      +/-   ##
============================================
- Coverage     17.05%   17.04%   -0.02%     
  Complexity      728      728              
============================================
  Files           191      191              
  Lines         14235    14248      +13     
  Branches       1332     1336       +4     
============================================
  Hits           2428     2428              
- Misses        11631    11644      +13     
  Partials        176      176              
Files Changed Coverage Δ
...e/pulsar/handlers/kop/KafkaTopicLookupService.java 1.92% <0.00%> (-0.04%) :arrow_down:
.../handlers/kop/stats/DataSketchesOpStatsLogger.java 0.00% <0.00%> (ø)
...eamnative/pulsar/handlers/kop/stats/LocalData.java 0.00% <0.00%> (ø)
.../handlers/kop/stats/PrometheusMetricsProvider.java 0.00% <0.00%> (ø)
...pulsar/handlers/kop/stats/ThreadLocalAccessor.java 0.00% <0.00%> (ø)