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
bpf,metrics: add line/file information to drop metrics #30972
Merged
Merged
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
ti-mo
added
the
release-note/minor
This PR changes functionality that users may find relevant to operating Cilium.
label
Feb 26, 2024
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
4 times, most recently
from
February 28, 2024 15:05
094d8e9
to
e56f5c0
Compare
/test |
ti-mo
added
backport/author
The backport will be carried out by the author of the PR.
needs-backport/1.15
This PR / issue needs backporting to the v1.15 branch
labels
Feb 28, 2024
ti-mo
requested review from
learnitall,
markpash,
tommyp1ckles,
dylandreimerink and
derailed
February 28, 2024 15:23
learnitall
approved these changes
Feb 28, 2024
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.
Looks good for API, thanks!
derailed
approved these changes
Feb 28, 2024
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.
@ti-mo Nice improvement!
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
February 29, 2024 11:44
e56f5c0
to
bfca4c4
Compare
/test |
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
February 29, 2024 11:56
bfca4c4
to
1530425
Compare
/test |
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
February 29, 2024 12:40
1530425
to
ea34700
Compare
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
March 5, 2024 09:18
d838984
to
8aa8df1
Compare
/test |
markpash
approved these changes
Mar 5, 2024
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
March 6, 2024 16:14
8aa8df1
to
4c72db3
Compare
/test |
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
March 13, 2024 13:44
4c72db3
to
135cf26
Compare
/test |
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
March 19, 2024 15:33
135cf26
to
232b587
Compare
/test |
This commit is split off from subsequent commits to backport to 1.15. In a follow-up commit, the reserved space in metricsmap.Key will be used for storing line and file info. Since older versions of Cilium don't decode these fields yet, this either causes duplicate metrics to be displayed, or causes the last metricsmap entry with a given reason/direction combination to overwrite the counters of other entries, resulting in wrong metrics. metricsmapCollector.Collect() was believed to handle this correctly, but the code turned out to be wrong. The updated implementation sums up all values that resolve to the same label set. Various cleanups were made to remove type conversions and improve legibility. Signed-off-by: Timo Beckers <timo@isovalent.com>
This commit moves the filename->id lookup machinery around a bit to conform better to the existing structure of the Makefile and checker scripts. bpf/source_names_to_ids.h was moved to bpf/lib/source_info.h, check-sources.sh was moved out of the loader package and into the usual scripts directory in contrib/, and no longer has its own Makefile target. In addition to __MAGIC_FILE__, this commit adds __MAGIC_LINE__ that resolves to 0 in BPF tests, for reasons documented in the source code. A follow-up commit will make use of it. Also fixes all shellcheck warnings in check-sources.sh. Signed-off-by: Timo Beckers <timo@isovalent.com>
Fixes cilium#27748 Example output: ``` ~ cilium bpf metrics list REASON DIRECTION PACKETS BYTES LINE FILE Interface INGRESS 151 9368 1092 bpf_host.c Interface INGRESS 731 139248 659 bpf_overlay.c Success EGRESS 137 8212 1531 bpf_host.c Success EGRESS 9 744 1286 bpf_lxc.c Success INGRESS 11 926 86 l3.h Success INGRESS 1403 299078 231 trace.h Unsupported L3 protocol EGRESS 6 460 1466 bpf_lxc.c ``` ``` ~ cilium bpf metrics list -o json { "reason": "Success", "direction": "egress", "packets": 406587, "bytes": 78023315, "line": 40, "file": "encap.h" }, { "reason": "Unsupported L3 protocol", "direction": "egress", "packets": 167, "bytes": 12050, "line": 1466, "file": "bpf_lxc.c" } ``` Signed-off-by: Timo Beckers <timo@isovalent.com>
ti-mo
force-pushed
the
tb/missed-tail-call-lineinfo
branch
from
March 21, 2024 11:05
232b587
to
794f4a6
Compare
/test |
aanm
approved these changes
Mar 22, 2024
1 task
ti-mo
added
backport-pending/1.15
The backport for Cilium 1.15.x for this PR is in progress.
needs-backport/1.14
This PR / issue needs backporting to the v1.14 branch
and removed
needs-backport/1.15
This PR / issue needs backporting to the v1.15 branch
needs-backport/1.14
This PR / issue needs backporting to the v1.14 branch
labels
Mar 22, 2024
github-actions
bot
added
backport-done/1.15
The backport for Cilium 1.15.x for this PR is done.
and removed
backport-pending/1.15
The backport for Cilium 1.15.x for this PR is in progress.
labels
Mar 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport/author
The backport will be carried out by the author of the PR.
backport-done/1.15
The backport for Cilium 1.15.x for this PR is done.
release-note/minor
This PR changes functionality that users may find relevant to operating Cilium.
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.
Quick summary of the changes here:
__MAGIC_LINE__
macro/metrics
orcilium-dbg metrics list
to avoid breaking users' Prometheus setupsFixes: #27748
Example output: