mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-07 09:48:27 +00:00
Improve comments; fix missing links w/o metrics
This commit is contained in:
@@ -198,7 +198,7 @@ class NodeDetails extends React.Component {
|
||||
</div>}
|
||||
|
||||
<div className="node-details-content">
|
||||
{Object.keys(metricLinks).length > 0 && <div className="node-details-content-section">
|
||||
{((details.metrics || []).length + Object.keys(unattachedLinks).length > 0) && <div className="node-details-content-section">
|
||||
<div className="node-details-content-section-header">Status</div>
|
||||
<NodeDetailsHealth
|
||||
metrics={details.metrics}
|
||||
|
||||
@@ -29,7 +29,6 @@ export default class NodeDetailsHealth extends React.Component {
|
||||
topologyId,
|
||||
} = this.props;
|
||||
|
||||
const hasUnattached = Object.keys(unattachedLinks).length > 0;
|
||||
const primeCutoff = metrics.length > 3 && !this.state.expanded ? 2 : metrics.length;
|
||||
const primeMetrics = metrics.slice(0, primeCutoff);
|
||||
const overflowMetrics = metrics.slice(primeCutoff);
|
||||
@@ -57,7 +56,7 @@ export default class NodeDetailsHealth extends React.Component {
|
||||
handleClick={this.handleClickMore} collection={this.props.metrics}
|
||||
expanded={this.state.expanded} notShown={notShown} hideNumber />
|
||||
|
||||
{hasUnattached && <div className="node-details-health-wrapper">
|
||||
<div className="node-details-health-wrapper">
|
||||
{Object.keys(unattachedLinks).map(id => <CloudFeature alwaysShow key={id}>
|
||||
<NodeDetailsHealthLinkItem
|
||||
withoutGraph
|
||||
@@ -66,7 +65,7 @@ export default class NodeDetailsHealth extends React.Component {
|
||||
topologyId={topologyId}
|
||||
/>
|
||||
</CloudFeature>)}
|
||||
</div>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/ugorji/go/codec"
|
||||
)
|
||||
|
||||
// MetricLink describes a link referencing a metric.
|
||||
// MetricLink describes a URL referencing a metric.
|
||||
type MetricLink struct {
|
||||
// References the metric id
|
||||
ID string `json:"id,omitempty"`
|
||||
@@ -37,22 +37,27 @@ var (
|
||||
// Prometheus queries for topologies
|
||||
topologyQueries = map[string]map[string]*template.Template{
|
||||
report.Pod: {
|
||||
// Metric names provided by cAdvisor in kubelet
|
||||
docker.MemoryUsage: prepareTemplate(`sum(container_memory_usage_bytes{pod_name="{{.Label}}"})`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`sum(rate(container_cpu_usage_seconds_total{pod_name="{{.Label}}"}[1m]))`),
|
||||
},
|
||||
report.ReplicaSet: {
|
||||
docker.MemoryUsage: prepareTemplate(`sum(container_memory_usage_bytes{pod_name=~"{{.Label}}-.+"})`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`sum(rate(container_cpu_usage_seconds_total{pod_name=~"{{.Label}}-.+"}[1m]))`),
|
||||
// Metric names provided by cAdvisor in kubelet
|
||||
docker.MemoryUsage: prepareTemplate(`sum(container_memory_usage_bytes{pod_name=~"{{.Label}}-[^-]+-[^-]"})`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`sum(rate(container_cpu_usage_seconds_total{pod_name=~"{{.Label}}-[^-]+-[^-]"}[1m]))`),
|
||||
},
|
||||
report.Deployment: {
|
||||
docker.MemoryUsage: prepareTemplate(`sum(container_memory_usage_bytes{pod_name=~"{{.Label}}-[0-9]+-[^-]+"})`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`sum(rate(container_cpu_usage_seconds_total{pod_name=~"{{.Label}}-[0-9]+-[^-]+"}[1m]))`),
|
||||
// Metric names provided by cAdvisor in kubelet
|
||||
docker.MemoryUsage: prepareTemplate(`sum(container_memory_usage_bytes{pod_name=~"{{.Label}}-[^-]+-[^-]+"})`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`sum(rate(container_cpu_usage_seconds_total{pod_name=~"{{.Label}}-[^-]+-[^-]+"}[1m]))`),
|
||||
},
|
||||
report.DaemonSet: {
|
||||
// Metric names defined as recording rule. Filters by `monitor=""` for cortex-only data.
|
||||
docker.MemoryUsage: prepareTemplate(`namespace_name:container_memory_usage_bytes:sum{name="{{.Label}}",monitor=""}`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`namespace_name:container_cpu_usage_seconds_total:sum_rate{name="{{.Label}}"}`),
|
||||
},
|
||||
report.Service: {
|
||||
// Metric names defined as recording rule. Filters by `monitor=""` for cortex-only data.
|
||||
docker.MemoryUsage: prepareTemplate(`namespace_name:container_memory_usage_bytes:sum{name="{{.Label}}",monitor=""}`),
|
||||
docker.CPUTotalUsage: prepareTemplate(`namespace_name:container_cpu_usage_seconds_total:sum_rate{name="{{.Label}}"}`),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user