diff --git a/.changelog/10858.txt b/.changelog/10858.txt new file mode 100644 index 0000000000..42b200df75 --- /dev/null +++ b/.changelog/10858.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Hide all metrics for ingress gateway services +``` \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/topology-metrics/index.hbs b/ui/packages/consul-ui/app/components/topology-metrics/index.hbs index 72d78f584b..10391bc24b 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/index.hbs +++ b/ui/packages/consul-ui/app/components/topology-metrics/index.hbs @@ -25,8 +25,10 @@ @hasMetricsProvider={{@hasMetricsProvider}} @noMetricsReason={{this.noMetricsReason}} > - {{#if (and @hasMetricsProvider (not-eq @service.Service.Kind 'ingress-gateway'))}} + {{#if (and @hasMetricsProvider this.mainNotIngressService (not-eq item.Kind 'ingress-gateway'))}} + {{!-- One of the only places in the app where it's acceptable to default to 'default' namespace --}} {{@service.Service.Service}} - {{#if @hasMetricsProvider }} + {{#if @hasMetricsProvider}} - {{#if (not-eq @service.Service.Kind 'ingress-gateway')}} + {{#if this.mainNotIngressService}} - {{#if (and @hasMetricsProvider (not-eq @service.Service.Kind 'ingress-gateway'))}} + {{#if (and @hasMetricsProvider this.mainNotIngressService (not-eq item.Kind 'ingress-gateway'))}} + {{!-- One of the only places in the app where it's acceptable to default to 'default' namespace --}} - Unable to load metrics - - {{@noMetricsReason}} - +{{#if (or @noMetricsReason @error)}} + + {{#if (eq @noMetricsReason 'ingress-gateway')}} + {{t "components.consul.topology-metrics.status.ingress-gateway"}} + {{else if (eq @noMetricsReason 'remote-dc')}} + {{t "components.consul.topology-metrics.status.error"}} + + {{else if @error}} + {{t "components.consul.topology-metrics.status.error"}} + {{/if}} -{{else if @error}} - Unable to load metrics {{else}} - Loading Metrics + {{t "components.consul.topology-metrics.status.loading"}} {{/if}} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/topology-metrics/status/index.scss b/ui/packages/consul-ui/app/components/topology-metrics/status/index.scss index 6d7209aeed..44968d8d81 100644 --- a/ui/packages/consul-ui/app/components/topology-metrics/status/index.scss +++ b/ui/packages/consul-ui/app/components/topology-metrics/status/index.scss @@ -1,5 +1,5 @@ -.topology-metrics-error, -.topology-metrics-loader { +.topology-metrics-status-error, +.topology-metrics-status-loader { font-weight: normal; font-size: 0.875rem; color: $gray-500; @@ -13,6 +13,6 @@ } } -span.topology-metrics-loader::after { +span.topology-metrics-status-loader::after { @extend %with-loading-icon, %as-pseudo; } diff --git a/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ b/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ index bb810f7e74..07108b064a 100644 --- a/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ +++ b/ui/packages/consul-ui/mock-api/v1/internal/ui/service-topology/_ @@ -72,6 +72,9 @@ ${ const allowed = hasPerms ? false : fake.random.boolean(); return ` { +${(Math.random(1) > 0.3) ? ` + "Kind": "${fake.helpers.randomize(['mesh-gateway', 'ingress-gateway', 'terminating-gateway', ''])}", +` : ''} "Name": "${item.Name}", "Datacenter": "${item.Datacenter}", "Namespace": "${item.Namespace}", @@ -98,6 +101,9 @@ ${ const allowed = hasPerms ? false : fake.random.boolean(); return ` { +${(Math.random(1) > 0.3) ? ` + "Kind": "${fake.helpers.randomize(['mesh-gateway', 'ingress-gateway', 'terminating-gateway', ''])}", +` : ''} "Name": "${item.Name}", "Datacenter": "${item.Datacenter}", "Namespace": "${item.Namespace}", diff --git a/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/stats.feature b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/stats.feature index 2b3266ad84..7ac41444f3 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/stats.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/services/show/topology/stats.feature @@ -1,6 +1,6 @@ @setupApplicationTest Feature: dc / services / show / topology / stats - Scenario: Given metrics is disabled,the Topology tab should not display metrics + Scenario: Given metrics is disabled, the Topology tab should not display metrics Given 1 datacenter model with the value "dc1" And 1 node models And 1 service model from yaml @@ -33,4 +33,51 @@ Feature: dc / services / show / topology / stats --- And I see topology on the tabs And I see the "[data-test-topology-metrics-stats]" element + Scenario: Given metrics is enabled, metrics stats are disabled for an ingress gateway Topology + Given 1 datacenter model with the value "dc1" + Given a "prometheus" metrics provider + And 1 node models + And 1 service model from yaml + --- + - Service: + Name: ingress-gateway + Kind: ingress-gateway + ID: ingress-gateway-with-id + --- + When I visit the service page for yaml + --- + dc: dc1 + service: ingress-gateway + --- + And I see topology on the tabs + And I don't see the "[data-test-topology-metrics-stats]" element + And I see the "[data-test-topology-metrics-status]" element + Scenario: Given metrics is enabled, metric stats are disabled for ingress gateway as downstream services + Given 1 datacenter model with the value "dc1" + Given a "prometheus" metrics provider + And 1 node models + And 1 service model from yaml + --- + - Service: + Name: service-0 + ID: service-0-with-id + --- + And 1 topology model from yaml + --- + Upstreams: [] + Downstreams: + - Name: db + Namespace: @namespace + Datacenter: dc1 + Intention: {} + Kind: ingress-gateway + --- + When I visit the service page for yaml + --- + dc: dc1 + service: service-0 + --- + And I see topology on the tabs + And I see the "[data-test-sparkline]" element + And I don't see the "[data-test-topology-metrics-downstream-stats]" element diff --git a/ui/packages/consul-ui/translations/components/consul/en-us.yaml b/ui/packages/consul-ui/translations/components/consul/en-us.yaml index 4bde6dc2e0..fdc946617e 100644 --- a/ui/packages/consul-ui/translations/components/consul/en-us.yaml +++ b/ui/packages/consul-ui/translations/components/consul/en-us.yaml @@ -160,9 +160,13 @@ topology-metrics: header: No traffic body: Add "{upstream}" as an explicit upstream of "{downstream}" or set the "{downstream}" proxy to "transparent" mode to enable traffic. action: Documentation + status: + error: Unable to load metrics + remote-dc: Unable to fetch metrics for a remote datacenter + loading: Loading metrics + ingress-gateway: Viewing metrics for Ingress Gateways is not currently supported in the UI. source: header: This is not a registered Consul service. It’s a routing configuration that routes traffic to real services in Consul. For more information, read our documentation. menu-title: About Routing Configs links: documentation: Documentation -