Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
Contributor
|
Congratulations on an auspicious PR number :) |
9 of 36 tasks
ekoops
force-pushed
the
ekoops/metrics-map-size
branch
from
November 13, 2026 09:19
e4c9fbc to
f9ec2de
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Member
|
I come here for 50k PRs 🕺 |
dylandreimerink
approved these changes
Nov 13, 2026
ekoops
force-pushed
the
ekoops/metrics-map-size
branch
from
November 13, 2026 13:32
f9ec2de to
fa9e5a4
Compare
Contributor
Author
|
/test |
This required changing the `MetricsMap` interface to provide a `DeleteAll()` method instead of a `Delete(key)` one: indeed `Delete()` was used inside the callback provided to `IterateWithCallback()`, and the new `IterateWithCallback()` implementation holds a read lock over the map for the entire iteration procedure, so calling `Delete()` in the callback would have caused a dead-lock. Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
`cilium_metrics` max_entries is set to `METRICS_MAP_SIZE`. The agent generates that macro from `metricsmap.MaxEntries` (1024), so the datapath map has been created with 1024 entries at runtime since 321b147 ("metricsmap: reduce MaxEntries to account for maximum key space"). Only the static value in `bpf/node_config.h` was left at 65536. That value is the one used by static builds (e.g. the BPF tests) and baked into `maps_generated.go`, which the map registry uses as the base spec of the map. Set the static value to 1024 and regenerate `maps_generated.go`, so that the static definition matches the one used at runtime. No functional change for the agent. Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
This lets us get rid of the corresponding `METRICS_MAP_SIZE` C macro that used to represent the number of max entries for `cilium_metrics`. Map flags are configured by leveraging the `MapRegistry.Modify()` API, while the number of max entries is left untouched, as the base map spec (baked into `maps_generated.go`, and generated from map's datapath definition) already stores the right value (1024). Signed-off-by: Leonardo Di Giovanna <leonardodigiovanna1@gmail.com>
ekoops
force-pushed
the
ekoops/metrics-map-size
branch
from
November 13, 2026 13:45
fa9e5a4 to
7986409
Compare
This comment has been minimized.
This comment has been minimized.
brlbil
approved these changes
Nov 13, 2026
This branch has not been deployed
This file contains hidden or 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
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.
This lets us get rid of the corresponding
METRICS_MAP_SIZEC macro that used to represent the number of max entries forcilium_metrics.Map flags are configured by leveraging the
MapRegistry.Modify()API, while the number of max entries is left untouched, as the base map spec (baked intomaps_generated.go, and generated from map's datapath definition) already stores the right value (1024).Notice that the
metricsMaptype now embeds a*bpf.Mapinstead of*ebpf.Map.Finally, notice that the original static value for
METRICS_MAP_SIZEwas 65536, but the agent has always set it to 1024 at runtime (seemetricsmap.MaxEntries) ignoring the stale static value (that value became stale after 321b147cba33 got merged). For this reason, I changed the map definition to use 1024 instead of 65536.Related: #48853
AIL: 0