Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support expire prometheus metrics #10869

Conversation

monkeyDluffy6017
Copy link
Contributor

Description

The prometheus metrics we record are stored in LRUs, and although there is no memory leakage, the metrics are not eliminated until they reach the upper limit of the LRUs. As the metrics become more and more numerous, the prometheus server consumes more and more CPU when pulling data, and a mechanism is needed to eliminate the outdated data.

Fixes #9627

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@monkeyDluffy6017 monkeyDluffy6017 marked this pull request as draft January 25, 2024 12:53
@ShenFeng312
Copy link
Contributor

LGTM!

# default_buckets:
# - 10
# - 50
# - 100
# - 200
# - 500
# expire: 86400 # the expiration time after metrics become inactive, unit: second
Copy link
Member

Choose a reason for hiding this comment

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

Default value should be 0 to keep the same strategy as before, no expiration time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@theweakgod
Copy link
Contributor

👍

@monkeyDluffy6017 monkeyDluffy6017 marked this pull request as ready for review February 6, 2024 10:16
Copy link
Contributor

@shreemaan-abhishek shreemaan-abhishek left a comment

Choose a reason for hiding this comment

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

LGTM

conf/config-default.yaml Outdated Show resolved Hide resolved
Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

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

LGTM

@god12311
Copy link

@monkeyDluffy6017 Hello, if I want to fix this issue in version 3.2.2 of APISIX, can I make the changes according to the code in this link (https://github.com/apache/apisix/pull/10869/files), or can I directly replace the prometheus/exporter.lua file? Looking forward to your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: apisix 内存管理-过期监控key不释放问题
8 participants