-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[receiver/k8scluster] Do not keep metrics in memory #24769
Merged
dmitryax
merged 1 commit into
open-telemetry:main
from
dmitryax:k8scluster-move-metrics-builder
Aug 5, 2023
Merged
[receiver/k8scluster] Do not keep metrics in memory #24769
dmitryax
merged 1 commit into
open-telemetry:main
from
dmitryax:k8scluster-move-metrics-builder
Aug 5, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dmitryax
changed the title
[chore] [receiver/k8scluster] Reuse one MetricsBuilder instance
[chore] [receiver/k8scluster] Reuse MetricsBuilder instance
Aug 1, 2023
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
from
August 1, 2023 16:16
bb66ede
to
be19f3c
Compare
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
from
August 2, 2023 08:17
be19f3c
to
7cb9c73
Compare
dmitryax
changed the title
[chore] [receiver/k8scluster] Reuse MetricsBuilder instance
[chore] [receiver/k8scluster] Do not keep all the metrics in memory
Aug 2, 2023
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
2 times, most recently
from
August 2, 2023 08:53
1b17192
to
048b85d
Compare
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
3 times, most recently
from
August 4, 2023 23:38
61e2640
to
b72ca92
Compare
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
from
August 4, 2023 23:42
b72ca92
to
ade7882
Compare
dmitryax
changed the title
[chore] [receiver/k8scluster] Do not keep all the metrics in memory
[receiver/k8scluster] Do not keep metrics in memory
Aug 4, 2023
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
from
August 4, 2023 23:57
ade7882
to
08b9ba0
Compare
atoulme
approved these changes
Aug 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flies a bit over my head, but I know we have a good e2e test for this which would pick up regressions. LGTM
Construct metrics on every scrape instead. We keep k8s objects in cache anyway, so we can use that instead of the pre-built metrics. This reduces RAM utilization. This also allows us extracting a metrics builder instance and do not create it on every scrape. This is the recommended approach that all other receivers follow. It ensures that any warnings defined in the metadata.yaml will be displayed only once, not on every scrape interval.
dmitryax
force-pushed
the
k8scluster-move-metrics-builder
branch
from
August 5, 2023 03:19
08b9ba0
to
fe8c6f3
Compare
dmitryax
added a commit
that referenced
this pull request
Aug 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Construct metrics on every scrape instead of keeping them in memory and copy them with modifications on every scrape. We keep k8s objects in cache anyway, so we can use that instead of the pre-built metrics. This reduces RAM utilization.
This also allows us to extract a metrics builder instance and not create it on every scrape. This is the recommended approach that all other receivers follow. It ensures that any warnings defined in the metadata.yaml will be displayed only once, not on every scrape interval.
Memory utilization before/after the change on a cluster with 100 nodes and 1k pods: