Skip to content
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

Fix metrics #4506

Merged
merged 4 commits into from
Nov 13, 2019
Merged

Fix metrics #4506

merged 4 commits into from
Nov 13, 2019

Conversation

maciaszczykm
Copy link
Member

@maciaszczykm maciaszczykm commented Nov 7, 2019

Fixes #4145.

Fix 'invalid number of resources from the sidecar' error
@maciaszczykm maciaszczykm changed the title Fix metrics [WIP] Fix metrics Nov 7, 2019
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 7, 2019
@maciaszczykm
Copy link
Member Author

I have managed to fix the sparklines that are displayed right now even when there are completed pods:

Zrzut ekranu 2019-11-7 o 11 41 40

The problem with the main graphs still persists though.

@maciaszczykm maciaszczykm reopened this Nov 7, 2019
@codecov
Copy link

codecov bot commented Nov 7, 2019

Codecov Report

Merging #4506 into master will increase coverage by 0.01%.
The diff coverage is 58.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4506      +/-   ##
==========================================
+ Coverage   46.42%   46.44%   +0.01%     
==========================================
  Files         209      209              
  Lines        9641     9646       +5     
  Branches      107      107              
==========================================
+ Hits         4476     4480       +4     
- Misses       4892     4893       +1     
  Partials      273      273
Impacted Files Coverage Δ
src/app/backend/resource/dataselect/dataselect.go 23.38% <ø> (ø) ⬆️
...c/app/backend/integration/metric/sidecar/client.go 73.68% <0%> (ø) ⬆️
src/app/backend/resource/pod/list.go 71.15% <25%> (-1.4%) ⬇️
src/app/backend/resource/pod/metrics.go 30.3% <85.71%> (+9.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3b240a...3298d66. Read the comment docs.

@maciaszczykm
Copy link
Member Author

The issue is fixed, but still, some improvements need to be done in next PRs:

Zrzut ekranu 2019-11-7 o 13 20 51

@maciaszczykm maciaszczykm changed the title [WIP] Fix metrics Fix metrics Nov 7, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 7, 2019
@maciaszczykm
Copy link
Member Author

/assign @floreks @jeefy

@maciaszczykm
Copy link
Member Author

I think that in the long run, we have two options:

  • do not ask about the resources that don't have metrics
  • when a resource doesn't have metrics (sidecar is not returning them) then don't error

I have done the first to show sparklines. The second approach is used to silence the single errors that occur during scraping cumulative metrics.

@jeefy
Copy link
Member

jeefy commented Nov 9, 2019

@maciaszczykm Solution lgtm for now, but CI is squawking on a goimports issue: https://travis-ci.org/kubernetes/dashboard/jobs/608704284#L1314

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. language/fr Updates or issues for French translations. language/ja Updates or issues for Japanese translations. language/ko Updates or issues for Korean translations. language/zh Updates or issues for Chinese translations. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 12, 2019
@maciaszczykm
Copy link
Member Author

PTAL

@jeefy
Copy link
Member

jeefy commented Nov 13, 2019

/lgtm

Thanks again for tackling this

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 13, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jeefy, maciaszczykm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit b9e7f5c into kubernetes:master Nov 13, 2019
@maciaszczykm maciaszczykm deleted the fix/metrics branch November 13, 2019 17:09
@RedzRedz
Copy link

RedzRedz commented Dec 3, 2019

I use v2.0.0-beta6, but i still can't see cpu and mem usage in dashboard.
This is some logs in pod kubernetes-dashboard-****.

2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Cannot get metrics: received 0 resources from sidecar instead of 10
2019/12/03 15:35:36 Skipping metric because of error: Metric label not set.

@maciaszczykm

@pkesso
Copy link

pkesso commented Dec 6, 2019

@RedzRedz same on v2.0.0-beta7

@strainovic
Copy link

strainovic commented Dec 8, 2019

Same error on v2.0.0-beta8

2019/12/08 20:32:03 Cannot get metrics: received 34 resources from sidecar instead of 36

I have 1 Job and 1 CronJob Pod in Terminated: Completed status.

@maciaszczykm
Copy link
Member Author

The error itself is not a problem if rest of the graphs show up. There is no data for completed resources anymore and that is this "error".

2019/12/08 20:32:03 Cannot get metrics: received 34 resources from sidecar instead of 36

In that case you should be able to see graphs for 34 resources which is totally fine.

We will work on improving this later, the message should not be even there and we should not "expect" data for completed resources.

@strainovic
Copy link

@maciaszczykm
Unfortunately, I see no graphics if namespace has CronJobs/Jobs.

@maciaszczykm
Copy link
Member Author

That is strange, can you open a new issue?

@pkesso
Copy link

pkesso commented Dec 9, 2019

Still getting Cannot get metrics: received 0 resources from sidecar instead of 10 on v2.0.0b8, no CPU usage and memory usage graphs on dashboard.
Any tips?

@floreks
Copy link
Member

floreks commented Dec 9, 2019

Have you installed metrics-server?

@pkesso
Copy link

pkesso commented Dec 10, 2019

Have you installed metrics-server?

Yes, metrics-server is running.

@ysaakpr
Copy link

ysaakpr commented Dec 17, 2019

Same with me, running the latest release beta8, Unable to get any metrics on any page, Attached sample logs from dashboard.

2019/12/17 05:28:18 Getting list of all deployments in the cluster 2019/12/17 05:28:18 [2019-12-17T05:28:18Z] Incoming HTTP/1.1 GET /api/v1/csrftoken/token request from 100.101.0.28:56098: 2019/12/17 05:28:18 [2019-12-17T05:28:18Z] Outcoming response to 100.101.0.28:56098 with 200 status code 2019/12/17 05:28:18 Cannot get metrics: received 0 resources from sidecar instead of 2 2019/12/17 05:28:18 Cannot get metrics: received 0 resources from sidecar instead of 2 2019/12/17 05:28:18 Cannot get metrics: received 0 resources from sidecar instead of 2 2019/12/17 05:28:18 Cannot get metrics: received 0 resources from sidecar instead of 2

Note: I have installed cleanly, by following the recommended yaml file mentioned in the release section.

@RedzRedz
Copy link

RedzRedz commented Dec 18, 2019 via email

@ysaakpr
Copy link

ysaakpr commented Dec 19, 2019

I have confirmed, I have installed the metric-server, in kube-system namespace, following helm charts - https://github.com/helm/charts/tree/master/stable/metrics-server, And updated to latest. Still no metrics on the dashboard. I have verified that kubectl top also working, which means the metric server is working as expected.

@ysaakpr
Copy link

ysaakpr commented Dec 19, 2019

My metric server is running with --kubelet-insecure-tls. Unable to run it without that, since the kubelets are using self-signed certs(Default one created while Kops initialize the cluster)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. language/fr Updates or issues for French translations. language/ja Updates or issues for Japanese translations. language/ko Updates or issues for Korean translations. language/zh Updates or issues for Chinese translations. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kubernetes Dashboard does not show CPU Usage and Memory Usage graph if namespace has Cron Jobs
8 participants