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

Add xfsdist example #368

Merged
merged 2 commits into from
Apr 2, 2024
Merged

Conversation

alebsys
Copy link
Contributor

@alebsys alebsys commented Apr 2, 2024

A similar PR to ext4dist for XFS

$ curl -s localhost:9435/metrics | grep xfs
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2151",program="xfs_file_read_enter",tag="a2782e80c654b953"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2152",program="xfs_file_read_exit",tag="38615d37ed968a64"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2153",program="xfs_file_write_enter",tag="a2782e80c654b953"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2154",program="xfs_file_write_exit",tag="89fc999dbdd00924"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2155",program="xfs_file_open_enter",tag="a2782e80c654b953"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2156",program="xfs_file_open_exit",tag="f0481afbbba7aad1"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2157",program="xfs_file_sync_enter",tag="a2782e80c654b953"} 1
ebpf_exporter_ebpf_program_info{config="xfsdist",id="2158",program="xfs_file_sync_exit",tag="785ee7064f87a9f1"} 1
# HELP ebpf_exporter_enabled_configs The set of enabled configs
# TYPE ebpf_exporter_enabled_configs gauge
ebpf_exporter_enabled_configs{name="xfsdist"} 1
# HELP ebpf_exporter_xfs_latency_seconds xfs IO latency histogram
# TYPE ebpf_exporter_xfs_latency_seconds histogram
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="1e-06"} 1117
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="2e-06"} 1168
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="4e-06"} 1242
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="8e-06"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="1.6e-05"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="3.2e-05"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="6.4e-05"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.000128"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.000256"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.000512"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.001024"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.002048"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.004096"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.008192"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.016384"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.032768"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.065536"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.131072"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.262144"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="0.524288"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="1.048576"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="2.097152"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="4.194304"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="8.388608"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="16.777216"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="33.554432"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="67.108864"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="134.217728"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="open",le="+Inf"} 1245
ebpf_exporter_xfs_latency_seconds_sum{operation="open"} 0.0005899999999999999
ebpf_exporter_xfs_latency_seconds_count{operation="open"} 1245
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="1e-06"} 976
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="2e-06"} 1090
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="4e-06"} 1151
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="8e-06"} 1177
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="1.6e-05"} 1198
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="3.2e-05"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="6.4e-05"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.000128"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.000256"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.000512"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.001024"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.002048"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.004096"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.008192"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.016384"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.032768"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.065536"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.131072"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.262144"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="0.524288"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="1.048576"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="2.097152"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="4.194304"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="8.388608"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="16.777216"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="33.554432"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="67.108864"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="134.217728"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="read",le="+Inf"} 1201
ebpf_exporter_xfs_latency_seconds_sum{operation="read"} 0.001838
ebpf_exporter_xfs_latency_seconds_count{operation="read"} 1201
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="1e-06"} 0
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="2e-06"} 0
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="4e-06"} 0
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="8e-06"} 0
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="1.6e-05"} 0
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="3.2e-05"} 17
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="6.4e-05"} 26
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.000128"} 28
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.000256"} 28
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.000512"} 28
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.001024"} 28
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.002048"} 45
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.004096"} 54
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.008192"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.016384"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.032768"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.065536"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.131072"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.262144"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="0.524288"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="1.048576"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="2.097152"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="4.194304"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="8.388608"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="16.777216"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="33.554432"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="67.108864"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="134.217728"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="sync",le="+Inf"} 56
ebpf_exporter_xfs_latency_seconds_sum{operation="sync"} 0.130712
ebpf_exporter_xfs_latency_seconds_count{operation="sync"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="1e-06"} 0
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="2e-06"} 14
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="4e-06"} 21
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="8e-06"} 30
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="1.6e-05"} 49
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="3.2e-05"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="6.4e-05"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.000128"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.000256"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.000512"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.001024"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.002048"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.004096"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.008192"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.016384"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.032768"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.065536"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.131072"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.262144"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="0.524288"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="1.048576"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="2.097152"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="4.194304"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="8.388608"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="16.777216"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="33.554432"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="67.108864"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="134.217728"} 56
ebpf_exporter_xfs_latency_seconds_bucket{operation="write",le="+Inf"} 56
ebpf_exporter_xfs_latency_seconds_sum{operation="write"} 0.000878
ebpf_exporter_xfs_latency_seconds_count{operation="write"} 56

@alebsys
Copy link
Contributor Author

alebsys commented Apr 2, 2024

@bobrik, locally, the build passes, as does the config check. What could be the reason for the error?

@bobrik bobrik force-pushed the xfsdist-add-example branch from 5d35d5c to f2db868 Compare April 2, 2024 16:34
@bobrik bobrik force-pushed the xfsdist-add-example branch from f2db868 to 26168ab Compare April 2, 2024 16:39
@bobrik
Copy link
Contributor

bobrik commented Apr 2, 2024

The reason is that in CI xfs is a module that is not loaded, so you don't see the symbols. I added a commit to load the module and now the tests pass.

@bobrik bobrik merged commit 2ab91c1 into cloudflare:master Apr 2, 2024
19 checks passed
return 0;
}

SEC("kprobe/xfs_file_read_iter")
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I forgot to mention in the other PR: it might be good to start using fentry/fexit for everything.

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.

2 participants