diff options
| author | KubeEdge Bot <48982446+kubeedge-bot@users.noreply.github.com> | 2022-09-23 16:11:45 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-23 16:11:45 +0800 |
| commit | e5f4b5061a1ba979127faba971e533bfa8789b2e (patch) | |
| tree | cc596d4391a28d44060cd34d9779d732250cb086 | |
| parent | Merge pull request #4206 from vincentgoat/automated-cherry-pick-of-#3807-upst... (diff) | |
| parent | fix: Ignore the cache timestamp of the MachineInfo Metrics (diff) | |
| download | kubeedge-e5f4b5061a1ba979127faba971e533bfa8789b2e.tar.gz | |
Merge pull request #4222 from fisherxu/automated-cherry-pick-of-#4160-upstream-release-1.9v1.9.5origin/release-1.9
Automated cherry pick of #4160: fix: Ignore the cache timestamp of the MachineInfo Metrics
| -rw-r--r-- | edge/pkg/edged/edged.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/edge/pkg/edged/edged.go b/edge/pkg/edged/edged.go index 32e847ced..e402f4c82 100644 --- a/edge/pkg/edged/edged.go +++ b/edge/pkg/edged/edged.go @@ -534,6 +534,17 @@ func newEdged(enable bool) (*edged, error) { if ed.machineInfo, err = ed.newMachineInfo(); err != nil { return nil, err } + // Avoid adding timestamp to machine metrics when they're cached + // Please refer to the following K8s PRs for more details: + // link: https://github.com/kubernetes/kubernetes/pull/95210#issuecomment-726143798 + // link: https://github.com/kubernetes/kubernetes/pull/97006 + // Analysis of causes : + // 1. The cadvisor collects machine metrics when it launches and then caches them for later scrape. + // It is assumed that as long as the machine is not restarted, the hardware will not change and so do the machine metrics. + // 2. This timestamp of the machine metrics should be set when they're scraped, not when they're cached. + // 3. If using the timestamp when the machine metrics are cached, the timestamp when these metrics are scraped will be outdated + // which may cause issues like 'out of order sample' when sending these metrics to prometheus. + ed.machineInfo.Timestamp = time.Time{} // create a log manager logManager, err := logs.NewContainerLogManager(runtimeService, ed.os, "10Mi", 5) |
