ui: Update to not return metrics for ingress gateways (#9081)

This commit is contained in:
Kenia 2020-11-02 13:38:43 -05:00 committed by GitHub
parent 102aefdb49
commit 10aa848005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 27 deletions

View File

@ -45,18 +45,18 @@
</dl>
{{/if}}
</div>
{{#if @hasMetricsProvider }}
{{#if (and @hasMetricsProvider (not-eq @service.Kind 'ingress-gateway'))}}
{{#if (eq @type 'upstream')}}
<TopologyMetrics::Stats
@endpoint='upstream-summary-for-service'
@service={{@service}}
@service={{@service.Service}}
@item={{item.Name}}
@noMetricsReason={{@noMetricsReason}}
/>
{{else}}
<TopologyMetrics::Stats
@endpoint='downstream-summary-for-service'
@service={{@service}}
@service={{@service.Service}}
@item={{item.Name}}
@noMetricsReason={{@noMetricsReason}}
/>

View File

@ -13,7 +13,7 @@
</div>
<TopologyMetrics::Card
@items={{@topology.Downstreams}}
@service={{@service.Service.Service}}
@service={{@service.Service}}
@dc={{@topology.Datacenter}}
@hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{this.noMetricsReason}}
@ -31,6 +31,7 @@
@protocol={{@topology.Protocol}}
@noMetricsReason={{this.noMetricsReason}}
/>
{{#if (not-eq @service.Service.Kind 'ingress-gateway')}}
<TopologyMetrics::Stats
@endpoint='summary-for-service'
@service={{@service.Service.Service}}
@ -39,6 +40,7 @@
@noMetricsReason={{this.noMetricsReason}}
/>
{{/if}}
{{/if}}
<div class="link">
{{#if @metricsHref}}
<a class="metrics-link" href={{@metricsHref}} target="_blank" rel="noopener noreferrer" data-test-metrics-anchor>Open metrics Dashboard</a>
@ -63,7 +65,7 @@
<p>{{dc}}</p>
<TopologyMetrics::Card
@items={{upstreams}}
@service={{@service.Service.Service}}
@service={{@service.Service}}
@dc={{@topology.Datacenter}}
@type='upstream'
@hasMetricsProvider={{this.hasMetricsProvider}}

View File

@ -26,7 +26,10 @@ export default class TopologyMetrics extends Component {
// TODO we can make the configurable even before we have a full solution for
// multi-DC forwarding for Prometheus so providers that are global for all
// DCs like an external managed APM can still load in all DCs.
if (this.env.var('CONSUL_DATACENTER_LOCAL') != this.args.topology.get('Datacenter')) {
if (
this.env.var('CONSUL_DATACENTER_LOCAL') !== this.args.topology.get('Datacenter') ||
this.args.service.Service.Kind === 'ingress-gateway'
) {
this.noMetricsReason = 'Unable to fetch metrics for a remote datacenter';
}
}

View File

@ -11,12 +11,9 @@ export default Route.extend({
// so check the length here.
let to = 'topology';
const parentModel = this.modelFor(parent);
const hasProxy = get(parentModel, 'proxies');
const hasProxy = get(parentModel, 'proxies.length') !== 0;
const kind = get(parentModel, 'items.firstObject.Service.Kind');
if (hasProxy.length === 0) {
to = 'instances';
} else {
switch (kind) {
case 'ingress-gateway':
if (!get(parentModel, 'topology.Datacenter')) {
@ -30,11 +27,10 @@ export default Route.extend({
to = 'instances';
break;
default:
if (!get(parentModel, 'topology.Datacenter')) {
if (!hasProxy || !get(parentModel, 'topology.Datacenter')) {
to = 'instances';
}
}
}
this.replaceWith(`${parent}.${to}`, parentModel);
},

View File

@ -29,7 +29,7 @@
<TabNav @items={{
compact
(array
(if (and topology.Datacenter (gt proxies.length 0))
(if (and topology.Datacenter (or (gt proxies.length 0) (eq item.Service.Kind 'ingress-gateway')))
(hash label="Topology" href=(href-to "dc.services.show.topology") selected=(is-href "dc.services.show.topology"))
'')
(if (eq item.Service.Kind 'terminating-gateway')