[release/1.7] Fix "invalid metric type" error message for cgroup v1#10814
Merged
dmcgowan merged 1 commit intoOct 16, 2024
Merged
Conversation
Iceber
commented
Oct 11, 2024
| data, err := typeurl.UnmarshalAny(stats) | ||
| if err != nil { | ||
| s := &v2.Metrics{} | ||
| if err := typeurl.UnmarshalTo(stats, s); err != nil { |
Member
Author
There was a problem hiding this comment.
It just guarantees the same style of code as v1/metrics.go.
Member
Even if 2.x doesn't have this problem, can we do the code change on One other note: there's a blank line between the |
Member
Author
yeah, thanks for the suggestion, I wasn't sure whether to change him on 2.x first. |
Co-authored-by: Sam Lockart <sam.lockart@zendesk.com> Signed-off-by: Iceber Gu <caiwei95@hotmail.com>
4e6e97d to
d6f5778
Compare
Member
|
|
estesp
approved these changes
Oct 16, 2024
dmcgowan
approved these changes
Oct 16, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pr comes from not updating #9195, and it only works for release/1.7, it didn't have this problem in 1.6 on 2.x
Unmarshal
io.containerd.cgroups.v1.MetricswithUnmarshalAnyin 1.7+ (don't track which version it started with, but the latest version still has this issue) will first be parsed as github.com/containerd/cgroups/stats/v1.Metrics.This is due to hcsshim causing the dependency to have both github.com/containerd/cgroups/stats/v1/ and . /vendor/github.com/containerd/cgroups/v3/cgroup1/stats
How to reproduce this issue:
env:
steps:
[metrics] address = "127.0.0.1:7000"{"error":null,"level":"error","msg":"invalid metric type for ...Copy from #9195 (comment)