-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[ASCII-1886] List agent open files in flares on Linux #28584
Conversation
Regression DetectorRegression Detector ResultsRun ID: a8c32720-c6f2-498e-9049-b8c7cf70b5cd Metrics dashboard Target profiles Baseline: bcbcd06 Performance changes are noted in the perf column of each table:
No significant changes in experiment optimization goalsConfidence level: 90.00% There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.
|
perf | experiment | goal | Δ mean % | Δ mean % CI | links |
---|---|---|---|---|---|
➖ | file_tree | memory utilization | +1.88 | [+1.78, +1.98] | Logs |
➖ | basic_py_check | % cpu utilization | +0.96 | [-1.65, +3.57] | Logs |
➖ | uds_dogstatsd_to_api | ingress throughput | +0.00 | [-0.03, +0.04] | Logs |
➖ | tcp_dd_logs_filter_exclude | ingress throughput | +0.00 | [-0.01, +0.01] | Logs |
➖ | pycheck_lots_of_tags | % cpu utilization | -0.12 | [-2.58, +2.35] | Logs |
➖ | otel_to_otel_logs | ingress throughput | -0.57 | [-1.38, +0.24] | Logs |
➖ | idle | memory utilization | -0.99 | [-1.03, -0.95] | Logs |
➖ | tcp_syslog_to_blackhole | ingress throughput | -1.30 | [-13.98, +11.38] | Logs |
➖ | uds_dogstatsd_to_api_cpu | % cpu utilization | -1.78 | [-2.57, -0.98] | Logs |
Bounds Checks
perf | experiment | bounds_check_name | replicates_passed |
---|---|---|---|
✅ | idle | memory_usage | 10/10 |
Explanation
A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".
For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:
-
Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.
-
Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.
-
Its configuration does not mark it "erratic".
Go Package Import DifferencesBaseline: bcbcd06
|
Test changes on VMUse this command from test-infra-definitions to manually test this PR changes on a VM: inv create-vm --pipeline-id=42571680 --os-family=ubuntu Note: This applies to commit 999bab2 |
var out bytes.Buffer | ||
writer := tabwriter.NewWriter(&out, 1, 1, 1, ' ', 0) | ||
|
||
fmt.Fprint(writer, "FD\tType\tSize\tOpenPerm\tFilePerm\tName\t\n") | ||
for _, file := range files { | ||
fmt.Fprintf(writer, "%s\t%s\t%d\t%s\t%s\t%s\t\n", file.Fd, file.Type, file.Size, file.OpenPerm, file.FilePerm, file.Name) | ||
} | ||
|
||
_ = writer.Flush() | ||
return out.String() |
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.
👏 👏 👏 👏 👏 👏 👏 👏 👏 👏
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.
I was pretty happy when I discovered text/tabwriter
😁
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.
I added a test for that function by the way, it's somewhat testing text/tabwriter
but I think it can avoid breaking things in the output format accidentally
cmd/agent/subcommands/run/command.go
Outdated
@@ -336,6 +337,7 @@ func getSharedFxOption() fx.Option { | |||
path.DefaultStreamlogsLogFile, | |||
)), | |||
flare.Module(), | |||
lsof.Module(), |
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.
I think we could probably move this directly in the flare component. I think is a bit overkill to have a component that only add a flare provider.
What do you think?
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.
I was thinking long term, this component could provide an API endpoint to access the open files information, that way the flare can include the info for every running agent
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.
Good use case 😄
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.
If that is the case we might need to make part of the core bundle, what do you think?
Overall things look good to me. I think we could improve the error handling and if something fails we could write that into the result file in the flare, that way we have more visibility into things when extracting |
"strings" | ||
"syscall" | ||
|
||
"github.com/prometheus/procfs" |
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.
Good thing that we already had this dependency in the Agent 😉
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.
To be fair it has almost no dependency itself, and I don't think it needs CGO, so I think it's a pretty lightweight dependency anyway
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.
Yeah it's mostly a text parser for /proc
This was already resolve by this comment #28584 (comment) |
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.
Awesome work 🎉
/merge |
🚂 MergeQueue: pull request added to the queue The median merge time in Use |
/merge -c |
This merge request build was cancelled If you need support, contact us on Slack #devflow! |
/merge |
🚂 MergeQueue: pull request added to the queue The median merge time in Use |
What does this PR do?
Add a package
pkg/util/lsof
which provides open file information for a given process, and use it to add a file in flares containing the agent's open files.Motivation
Help with debugging, know what the agent is doing, what dynamic libraries are loaded, etc.
Additional Notes
Only implemented on Linux for now, and in non-local mode.
In local mode there is currently no way to know the PID of the running agent (pid file is an optional arg of the run command, and it doesn't exist in the flare command).
Example output for an agent:
Possible Drawbacks / Trade-offs
Describe how to test/QA your changes
Tested manually when running the agent in a Linux container.
Also explicitly tried using
LD_PRELOAD
to replace thertloader
shared library with a custom one, and it was properly displayed.