feat: export container metrics in Chaos Daemon for CRI-O and Docker runtime #4422
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.
Please Note: This PR requires PR #4416 to be merged. Please do not merge it now. I will do a rebase after previous PR get merged.
What problem does this PR solve?
RFC: chaos-mesh/rfcs#47
This PR implements the feature of exporting statistical metrics in RFC. Statistical metrics are the metrics that describe the statistical information of the container. These metrics are exported by Chaos Daemon. The previous PR #4416 implemented this feature for containerd, and this PR further provides implementations for Docker and CRI-O.
What's changed and how it works?
Proposal: chaos-mesh/rfcs#47
This PR modifies Chaos Daemon.
To export statistical metrics, Chaos Daemon will retrieve statistical information about the container from the CRI interface. Previous PR had introduced the interface
ContainerRuntimeInfoClient
and methodStatsByContainerID
for this. This PR implements these for CRI-O and Docker backend.Unlike CRI-O, the Docker backend's runtime socket (e.g.,
/var/run/docker.sock
) is not compatible with CRI API. Kubernetes uses cri-dockerd as an adapter to solve this. Therefore, the Docker backend also needs to obtain the socket path of cri-dockerd. This PR introduces the command line parameter—cri-socket-path
to read this path, and adds the related Helm Charts configurationchaosDaemon.criSocketPath
.In addition, since the Docker backend currently does not require CRI Socket for other functions. Therefore, if it cannot connect to the CRI Socket during initialization, Chaos Daemon can still start normally, but will not export any container metrics.
Related changes
UI interface
Cherry-pick to release branches (optional)
Checklist
CHANGELOG
CHANGELOG.md
Tests
Side effects
DCO
If you find the DCO check fails, please run commands like below (Depends on the actual situations. For example, if the failed commit isn't the most recent) to fix it: