ui: Pass down nspace and dc from Service model down to prometheus request (#9175)

* Pass down nspace and dc from Service model down to prometheus request

* Reviewing notes fix-ups

* Fix on dc/nspace to send from upstream/downstream card
This commit is contained in:
Kenia 2020-11-13 10:39:00 -05:00 committed by GitHub
parent c003871c54
commit 78b704be87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 9 deletions

View File

@ -7,7 +7,7 @@
{{@item.Name}}
</p>
<div class="details">
{{#if (and (and nspace (env 'CONSUL_NSPACES_ENABLED')) @type)}}
{{#if (and (and @nspace (env 'CONSUL_NSPACES_ENABLED')) @type)}}
<dl class="nspace">
<dt>
<Tooltip>
@ -47,6 +47,8 @@
{{#if (and @hasMetricsProvider (not-eq @service.Kind 'ingress-gateway'))}}
{{#if (eq @type 'upstream')}}
<TopologyMetrics::Stats
@nspace={{@item.Namespace}}
@dc={{@item.Datacenter}}
@endpoint='upstream-summary-for-service'
@service={{@service.Service}}
@item={{@item.Name}}
@ -54,6 +56,8 @@
/>
{{else}}
<TopologyMetrics::Stats
@nspace={{@item.Namespace}}
@dc={{@item.Datacenter}}
@endpoint='downstream-summary-for-service'
@service={{@service.Service}}
@item={{@item.Name}}

View File

@ -8,7 +8,7 @@
{{#if (gt @topology.Downstreams.length 0)}}
<div id="downstream-container">
<div>
<p>{{@topology.Datacenter}}</p>
<p>{{@dc}}</p>
<span>
<Tooltip>
Only showing downstreams within the current datacenter for {{@service.Service.Service}}.
@ -17,9 +17,10 @@
</div>
{{#each @topology.Downstreams as |item|}}
<TopologyMetrics::Card
@item={{item}}
@nspace={{@nspace}}
@dc={{@dc}}
@service={{@service.Service}}
@dc={{@topology.Datacenter}}
@item={{item}}
@hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{this.noMetricsReason}}
/>
@ -32,16 +33,18 @@
</div>
{{#if this.hasMetricsProvider }}
<TopologyMetrics::Series
@nspace={{@nspace}}
@dc={{@dc}}
@service={{@service.Service.Service}}
@dc={{@topology.Datacenter}}
@protocol={{@topology.Protocol}}
@noMetricsReason={{this.noMetricsReason}}
/>
{{#if (not-eq @service.Service.Kind 'ingress-gateway')}}
<TopologyMetrics::Stats
@nspace={{@nspace}}
@dc={{@dc}}
@endpoint='summary-for-service'
@service={{@service.Service.Service}}
@dc={{@topology.Datacenter}}
@protocol={{@topology.Protocol}}
@noMetricsReason={{this.noMetricsReason}}
/>
@ -73,9 +76,10 @@
<p>{{dc}}</p>
{{#each upstreams as |item|}}
<TopologyMetrics::Card
@nspace={{@nspace}}
@dc={{@dc}}
@item={{item}}
@service={{@service.Service}}
@dc={{@topology.Datacenter}}
@type='upstream'
@hasMetricsProvider={{this.hasMetricsProvider}}
@noMetricsReason={{this.noMetricsReason}}

View File

@ -1,6 +1,6 @@
{{#unless @noMetricsReason}}
<DataSource
@src={{uri nspace dc 'metrics' 'summary-for-service' @service @protocol}}
@src={{uri @nspace @dc 'metrics' 'summary-for-service' @service @protocol}}
@onchange={{action 'change'}}
@onerror={{action (mut error) value="error"}}
/>

View File

@ -1,6 +1,6 @@
{{#unless @noMetricsReason}}
<DataSource
@src={{uri nspace dc 'metrics' @endpoint @service @protocol}}
@src={{uri @nspace @dc 'metrics' @endpoint @service @protocol}}
@onchange={{action 'statsUpdate'}}
@onerror={{action (mut error) value="error"}}
/>

View File

@ -5,6 +5,8 @@
{{/if}}
{{#if topology}}
<TopologyMetrics
@nspace={{nspace}}
@dc={{dc}}
@service={{items.firstObject}}
@topology={{topology}}
@metricsHref={{render-template urls.service (hash