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

View File

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

View File

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

View File

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

View File

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