Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Add Time based metric exipration. #1996

Merged

Conversation

lifepuzzlefun
Copy link
Contributor

@lifepuzzlefun lifepuzzlefun commented Aug 12, 2023

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?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@CLAassistant
Copy link

CLAassistant commented Aug 12, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

@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 github-actions bot added doc-info-missing This pr needs to mark a document option in description and removed doc-info-missing This pr needs to mark a document option in description labels Aug 12, 2023
@github-actions
Copy link

@lifepuzzlefun:Thanks for providing doc info!

@github-actions github-actions bot added the no-need-doc This pr does not need any document label Aug 12, 2023
@codecov
Copy link

codecov bot commented Aug 12, 2023

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%) ⬇️
.../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%> (ø)

Copy link
Collaborator

@BewareMyPower BewareMyPower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it does not fix the issue directly, it's a good way to prevent such issues. So it LGTM.

@BewareMyPower BewareMyPower merged commit 33d3c04 into streamnative:master Aug 14, 2023
18 of 20 checks passed
Demogorgon314 pushed a commit to Demogorgon314/kop that referenced this pull request Oct 30, 2023
Fixes streamnative#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.

(cherry picked from commit 33d3c04)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no-need-doc This pr does not need any document type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Memory leak of the map in ThreadLocalAccessor
3 participants