feat: export relation between experiment and container to metrics #4415
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.
What problem does this PR solve?
RFC: chaos-mesh/rfcs#47
This PR implements the feature of exporting relation metrics in RFC. Relation metrics are the metrics that describe the relation between the Chaos experiment and the container. These metrics are exported by Chaos Controller Manager. The proposed metric name is:
chaos_controller_manager_chaos_experiments_container_relation
. It is exported with the following labels:namespace
kind
phase
The phase of the experiment.No longer export this because of confusion.name
uid
pod
container
The relation metrics are exported for all Chaos experiments managed by Chaos Controller Manager if the phase of the experiment is not
Finished
orDeleting
. This prevents exporting too many metrics by ignoring inactive experiments.For each selected container in the experiment, Chaos Controller Manager exports a relation metric. The value of the metric is always fixed to
1
for the convenience of joining metrics.What's changed and how it works?
Proposal: chaos-mesh/rfcs#47
This PR modifies Chaos Controller Manager by exporting new metrics to
/metric
endpoint. The relationship between the experiment and the selected container is extracted through the status records of Chaos Object.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: