-
Notifications
You must be signed in to change notification settings - Fork 721
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
[tmpnet] Deploy collectors with golang to simplify cross-repo use #3692
base: tmpnet-simplify-monitoring-action
Are you sure you want to change the base?
[tmpnet] Deploy collectors with golang to simplify cross-repo use #3692
Conversation
59e5357
to
15c496b
Compare
// TODO(marun) Figure out a way to redirect stdout and stderr of a detached child process without a bash shell | ||
cmd := exec.Command("bash", "-c", fullCmd) | ||
configureDetachedProcess(cmd) // Ensure the child process will outlive its parent |
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 believe you can create the command and set Stdout
and Stderr
to nil directly (according to the docs)
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.
Please give it a try and get back to me, because my attempts to create a child process that outlives its parent and configured with stdout and stderr redirected to a file created and opened by that parent were entirely unsuccessful.
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've added a comment detailing why I took this approach, PTAL.
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 may be wrong here, just remembered reading the documentation around this, so thought I'd provide the suggestion. May not behave as I expected from reading the docs (either due to a misread or incorrect docs).
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.
Re-reading your original comment, what is the intended result of setting Stdout
and Stderr
to nil? I need to send the output to a file, otherwise in CI I won't be able to collect the logs for troubleshooting (from the same tmpnet dir artifacts that contain the networks).
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 that I thought you were trying to ignore the output here:
// TODO(marun) Figure out a way to redirect stdout and stderr of a detached child process without a bash shell |
Stdout
and Stderr
to the corresponding file and avoid constructing a bash command.
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 attempted to do just that, but the following combination did not result in a log file that the child was writing to:
- child process that will outlife its parent
- child process configured with stderr and stdout set to a file opened by the parent
15c496b
to
ccd3382
Compare
757b07a
to
6060ccd
Compare
a8099ea
to
34a8689
Compare
6060ccd
to
d857661
Compare
01300b7
to
266cdb9
Compare
0c9fe11
to
b1e800e
Compare
266cdb9
to
194a2d3
Compare
5547800
to
0790dd1
Compare
b1e800e
to
260259e
Compare
4daa019
to
31be45a
Compare
tests/fixture/tmpnet/README.md
Outdated
loki_password: ${{ secrets.LOKI_PASSWORD || '' }} | ||
``` | ||
|
||
The action assumes a nix flake file in the repo root that enables |
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 guess the multiple apostrophes ('
) above are causing this formatting issue? I'm not inclined to try to fix this, since the above is verbatim how the action is expected to be used.
91b64a7
to
4dce5a1
Compare
func (v *FlagVars) NetworkShutdownDelay() time.Duration { | ||
if v.delayNetworkShutdown { | ||
if v.startCollectors { |
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.
Why is startCollectors
replacing delayNetworkShutdown
and being used in NetworkShutdownDelay()
?
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.
Ah ok, the network shutdown delay was added to account for a final network scrape, so we are removing the old flag and checking startCollectors
to decide whether we need a non-zero network shutdown delay.
env: | ||
LOKI_USERNAME: ${{ inputs.loki_username }} | ||
LOKI_PASSWORD: ${{ inputs.loki_password }} | ||
# TODO(marun) Stop emitting this annotation so that any annotation that appears can be assumed to be actionable |
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.
What annotation is this referring to?
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.
The script that this step calls creates a github actions 'annotation' that appears on the summary page of the run. But I'm thinking it does more harm than good since the only other annotations are typically warnings from actions warning of deprecations that we need to notice and respond to.
// TODO(marun) Figure out a way to redirect stdout and stderr of a detached child process without a bash shell | ||
cmd := exec.Command("bash", "-c", fullCmd) | ||
configureDetachedProcess(cmd) // Ensure the child process will outlive its parent |
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 that I thought you were trying to ignore the output here:
// TODO(marun) Figure out a way to redirect stdout and stderr of a detached child process without a bash shell |
Stdout
and Stderr
to the corresponding file and avoid constructing a bash command.
260259e
to
af785f9
Compare
Previously, prometheus and promtail were installed and launched by with bash scripts. Migrating installation to nix and launch to golang enables directly sharing the functionality with subnet-evm and hypersdk. No more having to copy and maintain copies of the scripts in multiple repos.
- ensure started/stopped -> start/stop collectors - use the same helpers between collector start and node process
4dce5a1
to
1a5222c
Compare
Why this should be merged
Previously, prometheus and promtail for collecting from local tmpnet networks were installed and launched by bash scripts. Migrating installation to nix and launch to golang simplifies reuse from subnet-evm and hypersdk. No more having to copy and maintain copies of the scripts in multiple repos.
How this works
--start-collectors
How this was tested
Need to be documented in RELEASES.md?
N/A
TODO