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

Replace service cpu/mem link to 'Monitor' #3060

Merged
merged 2 commits into from
Feb 9, 2018

Conversation

rbruggem
Copy link
Contributor

@rbruggem rbruggem commented Feb 6, 2018

The previous link to 'Monitor' contained a recording rule metric, and since not all Weave Clound instances have recording rules, the link would redirect to a 'Monitor' page without data points.
The recording rule metric has been substituted with the underlying query.

Fixes #2925

@rbruggem rbruggem requested a review from dlespiau February 6, 2018 18:42
docker.CPUTotalUsage: `namespace_label_name:container_cpu_usage_seconds_total:sum_rate{label_name="{{label}}",namespace="{{namespace}}"}`,
docker.MemoryUsage: `namespace_label_name:container_memory_usage_bytes:sum{label_name="{{label}}",namespace="{{namespace}}"}`,
docker.CPUTotalUsage: `sum(label_replace(sum(rate(container_cpu_usage_seconds_total{image!="",namespace="{{namespace}}"}[5m])) by (pod_name, namespace), "pod", "$1", "pod_name", "(.*)") * on (pod) group_right(pod_name) kube_pod_labels{_weave_namespace="weave",_weave_service="kube-state-metrics",label_name="{{label}}"})`,
docker.MemoryUsage: `sum(label_replace(sum(container_memory_usage_bytes{image!="",namespace="{{namespace}}"}) by (pod_name, namespace), "pod", "$1", "pod_name", "(.*)") * on (pod) group_right(pod_name) kube_pod_labels{_weave_namespace="weave",_weave_service="kube-state-metrics",label_name="{{label}}"})`,

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@@ -71,8 +71,8 @@ var (
// NB: Pods need to be labeled and selected by their respective Service name, meaning:
// - The Service's `spec.selector` needs to select on `name`
// - The Service's `metadata.name` needs to be the same value as `spec.selector.name`
docker.CPUTotalUsage: `namespace_label_name:container_cpu_usage_seconds_total:sum_rate{label_name="{{label}}",namespace="{{namespace}}"}`,
docker.MemoryUsage: `namespace_label_name:container_memory_usage_bytes:sum{label_name="{{label}}",namespace="{{namespace}}"}`,
docker.CPUTotalUsage: `sum(label_replace(sum(rate(container_cpu_usage_seconds_total{image!="",namespace="{{namespace}}"}[5m])) by (pod_name, namespace), "pod", "$1", "pod_name", "(.*)") * on (pod) group_right(pod_name) kube_pod_labels{_weave_namespace="weave",_weave_service="kube-state-metrics",label_name="{{label}}"})`,

This comment was marked as abuse.

The previous link to 'Monitor' contained a recording rule metric, and since not all Weave Clound instances have recording rules, the link would redirect to a 'Monitor' page without data points.
The recording rule metric has been substituted with the underlying query.
@rbruggem rbruggem force-pushed the service-cpu-mem-link-to-monitor branch from 9700c6a to 23f8d40 Compare February 7, 2018 13:11
@rbruggem rbruggem requested a review from dlespiau February 7, 2018 14:06
Copy link
Contributor

@dlespiau dlespiau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, hadn't noticed the new review request.

The link returned by service metrics is now built by looking up the deployment name in `report.Report` instead of assuming the service and the deployment have the same name.
@rbruggem
Copy link
Contributor Author

rbruggem commented Feb 8, 2018

@dlespiau thanks!

I have added an additional commit which removes the assumption in the service metrics that the service name equals the deployment name.

@rbruggem rbruggem requested a review from rade February 8, 2018 14:27
@rade rade requested review from dlespiau and removed request for rade February 8, 2018 14:58
Copy link
Contributor

@dlespiau dlespiau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe? I haven't spent any time on scope, I can believe this looks for Deployments backing up a service though :)

@rbruggem rbruggem merged commit 14f77fc into master Feb 9, 2018
@rbruggem rbruggem deleted the service-cpu-mem-link-to-monitor branch February 9, 2018 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants