examples: Add unix-accept-latency#634
Merged
bobrik merged 1 commit intocloudflare:masterfrom Apr 30, 2026
Merged
Conversation
Contributor
|
CI is unhappy, presumably because of kernel version mismatch. Can you take a look? |
Contributor
|
It was actually #635, so you probably just need to rebase. |
ebpf_exporter ships examples covering TCP accept queue latency but no equivalent for AF_UNIX. Listener-side accept queue stalls on busy UNIX stream sockets are invisible to the existing examples. Add an example that measures the time a connection spends on the listener's accept queue and exports it as an exp2 histogram, unix_accept_latency_seconds, labeled by listener path. Track three common server sockets out of the box: /run/dbus/system_bus_socket, /run/systemd/journal/stdout, and /var/run/mysqld/mysqld.sock. Operators are expected to edit the path list to match the host. Attach an fentry on security_unix_stream_connect() to stamp the server-side newsk in BPF_MAP_TYPE_SK_STORAGE when the listener's unix_sock->addr->name[0].sun_path matches one of the monitored entries. On unix_accept() fexit, look up the stamp on the accepted sk, compute the delta, and feed it into the histogram. Storing the matched path index alongside the timestamp avoids re-walking unix_sock->addr on the accept side; sk_storage presence already proves the socket is monitored. Latencies are bucketed in milliseconds from 1 ms to 1024 ms. Samples above the top edge are clamped into the last bucket.
3c59db6 to
4157073
Compare
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.
ebpf_exporter ships examples covering TCP accept queue latency but no equivalent for AF_UNIX. Listener-side accept queue stalls on busy UNIX stream sockets are invisible to the existing examples.
Add an example that measures the time a connection spends on the listener's accept queue and exports it as an exp2 histogram, unix_accept_latency_seconds, labeled by listener path. Track three common server sockets out of the box: /run/dbus/system_bus_socket, /run/systemd/journal/stdout, and /var/run/mysqld/mysqld.sock. Operators are expected to edit the path list to match the host.
Attach an fentry on security_unix_stream_connect() to stamp the server-side newsk in BPF_MAP_TYPE_SK_STORAGE when the listener's unix_sock->addr->name[0].sun_path matches one of the monitored entries. On unix_accept() fexit, look up the stamp on the accepted sk, compute the delta, and feed it into the histogram. Storing the matched path index alongside the timestamp avoids re-walking unix_sock->addr on the accept side; sk_storage presence already proves the socket is monitored.
Latencies are bucketed in milliseconds from 1 ms to 1024 ms. Samples above the top edge are clamped into the last bucket.