Skip to content
Snippets Groups Projects
Commit b5ada8ea authored by Jose Ivan Vargas Lopez's avatar Jose Ivan Vargas Lopez Committed by Phil Hughes
Browse files

Resolve "Prometheus service page shows error"

parent ba90f023
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -81,7 +81,11 @@ export default class PrometheusMetrics {
loadActiveMetrics() {
this.showMonitoringMetricsPanelState(PANEL_STATE.LOADING);
backOff((next, stop) => {
$.getJSON(this.activeMetricsEndpoint)
$.ajax({
url: this.activeMetricsEndpoint,
dataType: 'json',
global: false,
})
.done((res) => {
if (res && res.success) {
stop(res);
Loading
Loading
---
title: Fix flash errors showing up on a non configured prometheus integration
merge_request: 35652
author:
type: fixed
Loading
Loading
@@ -109,12 +109,16 @@ describe('PrometheusMetrics', () => {
 
it('should show loader animation while response is being loaded and hide it when request is complete', (done) => {
const deferred = $.Deferred();
spyOn($, 'getJSON').and.returnValue(deferred.promise());
spyOn($, 'ajax').and.returnValue(deferred.promise());
 
prometheusMetrics.loadActiveMetrics();
 
expect(prometheusMetrics.$monitoredMetricsLoading.hasClass('hidden')).toBeFalsy();
expect($.getJSON).toHaveBeenCalledWith(prometheusMetrics.activeMetricsEndpoint);
expect($.ajax).toHaveBeenCalledWith({
url: prometheusMetrics.activeMetricsEndpoint,
dataType: 'json',
global: false,
});
 
deferred.resolve({ data: metrics, success: true });
 
Loading
Loading
@@ -126,7 +130,7 @@ describe('PrometheusMetrics', () => {
 
it('should show empty state if response failed to load', (done) => {
const deferred = $.Deferred();
spyOn($, 'getJSON').and.returnValue(deferred.promise());
spyOn($, 'ajax').and.returnValue(deferred.promise());
spyOn(prometheusMetrics, 'populateActiveMetrics');
 
prometheusMetrics.loadActiveMetrics();
Loading
Loading
@@ -142,7 +146,7 @@ describe('PrometheusMetrics', () => {
 
it('should populate metrics list once response is loaded', (done) => {
const deferred = $.Deferred();
spyOn($, 'getJSON').and.returnValue(deferred.promise());
spyOn($, 'ajax').and.returnValue(deferred.promise());
spyOn(prometheusMetrics, 'populateActiveMetrics');
 
prometheusMetrics.loadActiveMetrics();
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment