Chore: Removes some unneeded console logging and changes logs to errors (#26235)

pull/26241/head
kay delaney 5 years ago committed by GitHub
parent 718d6fb25d
commit 1391575853
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      packages/grafana-data/src/dataframe/ArrowDataFrame.ts
  2. 2
      packages/grafana-data/src/text/sanitize.ts
  3. 2
      packages/grafana-data/src/transformations/matchers/nameMatcher.ts
  4. 2
      packages/grafana-ui/src/components/Gauge/Gauge.tsx
  5. 2
      packages/grafana-ui/src/components/Graph/Graph.tsx
  6. 1
      packages/grafana-ui/src/components/Monaco/CodeEditor.tsx
  7. 1
      packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.story.internal.tsx
  8. 4
      packages/jaeger-ui-components/src/common/UiFindInput.tsx
  9. 2
      public/app/core/components/Login/LoginCtrl.tsx
  10. 2
      public/app/core/components/TransformersUI/FilterByNameTransformerEditor.tsx
  11. 1
      public/app/core/components/scroll/scroll.ts
  12. 2
      public/app/core/controllers/signup_ctrl.ts
  13. 11
      public/app/core/live/live_srv.ts
  14. 2
      public/app/core/services/alert_srv.ts
  15. 2
      public/app/core/services/bridge_srv.ts
  16. 2
      public/app/core/services/echo/backends/PerformanceBackend.ts
  17. 2
      public/app/core/utils/UserProvider.tsx
  18. 6
      public/app/core/utils/emitter.ts
  19. 1
      public/app/features/admin/ldap/LdapSyncInfo.tsx
  20. 2
      public/app/features/admin/state/actions.ts
  21. 2
      public/app/features/annotations/annotations_srv.ts
  22. 2
      public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts
  23. 2
      public/app/features/dashboard/components/Inspector/InspectJSONTab.tsx
  24. 2
      public/app/features/dashboard/dashgrid/PanelChrome.tsx
  25. 2
      public/app/features/dashboard/services/DashboardLoaderSrv.ts
  26. 2
      public/app/features/dashboard/state/PanelQueryRunner.ts
  27. 6
      public/app/features/dashboard/state/initDashboard.ts
  28. 2
      public/app/features/dashboard/state/runRequest.ts
  29. 2
      public/app/features/dashboard/utils/panel.ts
  30. 2
      public/app/features/datasources/state/actions.ts
  31. 4
      public/app/features/explore/QueryRow.tsx
  32. 2
      public/app/features/explore/state/actions.ts
  33. 2
      public/app/features/manage-dashboards/components/UploadDashboard/uploadDashboardDirective.ts
  34. 2
      public/app/features/plugins/plugin_component.ts
  35. 2
      public/app/features/variables/state/actions.ts
  36. 1
      public/app/plugins/datasource/dashboard/runSharedRequest.ts
  37. 2
      public/app/plugins/datasource/elasticsearch/datasource.ts
  38. 1
      public/app/plugins/datasource/grafana-azure-monitor-datasource/editor/KustoQueryField.tsx
  39. 4
      public/app/plugins/datasource/grafana-azure-monitor-datasource/query_ctrl.ts
  40. 2
      public/app/plugins/datasource/graphite/datasource.ts
  41. 2
      public/app/plugins/datasource/graphite/graphite_query.ts
  42. 6
      public/app/plugins/datasource/influxdb/datasource.ts
  43. 2
      public/app/plugins/datasource/influxdb/query_ctrl.ts
  44. 2
      public/app/plugins/datasource/mssql/datasource.ts
  45. 2
      public/app/plugins/datasource/mysql/datasource.ts
  46. 2
      public/app/plugins/datasource/postgres/datasource.ts
  47. 2
      public/app/plugins/datasource/prometheus/result_transformer.ts
  48. 2
      public/app/plugins/panel/graph/graph.ts
  49. 1
      public/app/plugins/panel/graph/module.ts
  50. 2
      public/app/plugins/panel/heatmap/heatmap_data_converter.ts
  51. 2
      public/app/routes/GrafanaCtrl.ts

@ -75,7 +75,7 @@ export function arrowTableToDataFrame(table: Table): ArrowDataFrame {
break;
}
default:
console.log('UNKNOWN Type:', schema);
console.error('UNKNOWN Type:', schema);
}
fields.push({

@ -22,7 +22,7 @@ export function sanitize(unsanitizedString: string): string {
try {
return sanitizeXSS.process(unsanitizedString);
} catch (error) {
console.log('String could not be sanitized', unsanitizedString);
console.error('String could not be sanitized', unsanitizedString);
return unsanitizedString;
}
}

@ -99,7 +99,7 @@ const patternToRegex = (pattern?: string): RegExp | undefined => {
try {
return stringToJsRegex(pattern);
} catch (error) {
console.log(error);
console.error(error);
return undefined;
}
};

@ -180,7 +180,7 @@ export class Gauge extends PureComponent<Props> {
try {
$.plot(this.canvasElement, [plotSeries], options);
} catch (err) {
console.log('Gauge rendering error', err, options, value);
console.error('Gauge rendering error', err, options, value);
}
}

@ -355,7 +355,7 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
flotOptions
);
} catch (err) {
console.log('Graph rendering error', err, flotOptions, series);
console.error('Graph rendering error', err, flotOptions, series);
throw new Error('Error rendering panel');
}
}

@ -13,7 +13,6 @@ class UnthemedCodeEditor extends React.PureComponent<Props> {
componentWillUnmount() {
if (this.completionCancel) {
console.log('dispose of the custom completion stuff');
this.completionCancel.dispose();
}
}

@ -18,7 +18,6 @@ export const basic = () => {
height={'90vh'}
text={'a,b,c\n1,2,3'}
onSeriesParsed={(data: DataFrame[], text: string) => {
console.log('Data', data, text);
action('Data')(data, text);
}}
/>

@ -38,10 +38,6 @@ export default class UiFindInput extends React.PureComponent<Props> {
this.props.onChange('');
};
componentWillUnmount(): void {
console.log('unomuet');
}
render() {
const { allowClear, inputProps, value } = this.props;

@ -69,7 +69,7 @@ export class LoginCtrl extends PureComponent<Props, State> {
.then(() => {
this.toGrafana();
})
.catch((err: any) => console.log(err));
.catch((err: any) => console.error(err));
}
const resetModel = {

@ -85,7 +85,7 @@ export class FilterByNameTransformerEditor extends React.PureComponent<
}
}
} catch (error) {
console.log(error);
console.error(error);
}
}

@ -19,7 +19,6 @@ export function geminiScrollbar() {
let scrollRoot = elem.parent();
const scroller = elem;
console.log('scroll');
if (attrs.grafanaScrollbar && attrs.grafanaScrollbar === 'scrollonroot') {
scrollRoot = scroller;
}

@ -15,7 +15,7 @@ export class SignUpCtrl {
// validate email is semi ok
if (params.email && !params.email.match(/^\S+@\S+$/)) {
console.log('invalid email');
console.error('invalid email');
return;
}

@ -27,11 +27,9 @@ export class LiveSrv {
}
this.initPromise = new Promise((resolve, reject) => {
console.log('Live: connecting...');
this.conn = new WebSocket(this.getWebSocketUrl());
this.conn.onclose = (evt: any) => {
console.log('Live: websocket onclose', evt);
reject({ message: 'Connection closed' });
this.initPromise = null;
@ -45,11 +43,9 @@ export class LiveSrv {
this.conn.onerror = (evt: any) => {
this.initPromise = null;
reject({ message: 'Connection error' });
console.log('Live: websocket error', evt);
};
this.conn.onopen = (evt: any) => {
console.log('opened');
this.initPromise = null;
resolve(this.conn);
};
@ -62,7 +58,7 @@ export class LiveSrv {
message = JSON.parse(message);
if (!message.stream) {
console.log('Error: stream message without stream!', message);
console.error('Error: stream message without stream!', message);
return;
}
@ -81,8 +77,6 @@ export class LiveSrv {
return;
}
console.log('LiveSrv: Reconnecting');
this.getConnection().then((conn: any) => {
_.each(this.observers, (value, key) => {
this.send({ action: 'subscribe', stream: key });
@ -103,7 +97,6 @@ export class LiveSrv {
}
removeObserver(stream: any, observer: any) {
console.log('unsubscribe', stream);
delete this.observers[stream];
this.getConnection().then((conn: any) => {
@ -112,8 +105,6 @@ export class LiveSrv {
}
subscribe(streamName: string) {
console.log('LiveSrv.subscribe: ' + streamName);
return Observable.create((observer: any) => {
this.addObserver(streamName, observer);

@ -4,7 +4,7 @@ export class AlertSrv {
constructor() {}
set() {
console.log('old depricated alert srv being used');
console.warn('old deprecated alert srv being used');
}
}

@ -80,8 +80,6 @@ export class BridgeSrv {
this.$location.replace();
}
});
console.log('store updating angular $location.url', url);
}
// Check for template variable changes on a dashboard

@ -34,7 +34,7 @@ export class PerformanceBackend implements EchoBackend<PerformanceEvent, Perform
metrics: this.buffer,
};
// Currently we don have API for sending the metrics hence loging to console in dev environment
// Currently we don't have an API for sending the metrics hence logging to console in dev environment
if (process.env.NODE_ENV === 'development') {
console.log('PerformanceBackend flushing:', result);
}

@ -172,7 +172,7 @@ export class UserProvider extends PureComponent<Props, State> {
await getBackendSrv()
.put('/api/user', payload)
.then(this.loadUser)
.catch(e => console.log(e))
.catch(e => console.error(e))
.finally(() => {
this.setState({ loadingStates: { ...this.state.loadingStates, updateUserProfile: false } });
});

@ -23,7 +23,7 @@ export class Emitter {
emit<T>(event: AppEvent<T>, payload: T): void;
emit<T>(event: AppEvent<T> | string, payload?: T | any): void {
if (typeof event === 'string') {
console.log(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
console.warn(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
this.emitter.emit(event, payload);
} else {
this.emitter.emit(event.name, payload);
@ -47,7 +47,7 @@ export class Emitter {
on<T>(event: AppEvent<T>, handler: (payload: T) => void, scope?: any): void;
on<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void, scope?: any) {
if (typeof event === 'string') {
console.log(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
console.warn(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
this.emitter.on(event, handler);
if (scope) {
@ -83,7 +83,7 @@ export class Emitter {
off<T>(event: AppEvent<T>, handler: (payload: T) => void): void;
off<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void) {
if (typeof event === 'string') {
console.log(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
console.warn(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
this.emitter.off(event, handler);
return;
}

@ -19,7 +19,6 @@ export class LdapSyncInfo extends PureComponent<Props, State> {
};
handleSyncClick = () => {
console.log('Bulk-sync now');
this.setState({ isSyncing: !this.state.isSyncing });
};

@ -37,7 +37,7 @@ export function loadAdminUserPage(userId: number): ThunkResult<void> {
}
dispatch(userAdminPageLoadedAction(true));
} catch (error) {
console.log(error);
console.error(error);
const userError = {
title: error.data.message,

@ -62,7 +62,7 @@ export class AnnotationsSrv {
if (!err.message && err.data && err.data.message) {
err.message = err.data.message;
}
console.log('AnnotationSrv.query error', err);
console.error('AnnotationSrv.query error', err);
appEvents.emit(AppEvents.alertError, ['Annotation Query Failed', err.message || err]);
return [];
});

@ -204,7 +204,7 @@ export class DashboardExporter {
return newObj;
})
.catch(err => {
console.log('Export failed:', err);
console.error('Export failed:', err);
return {
error: err,
};

@ -109,7 +109,7 @@ export class InspectJSONTab extends PureComponent<Props, State> {
appEvents.emit(AppEvents.alertSuccess, ['Panel model updated']);
}
} catch (err) {
console.log('Error applyign updates', err);
console.error('Error applying updates', err);
appEvents.emit(AppEvents.alertError, ['Invalid JSON text']);
}

@ -171,7 +171,6 @@ export class PanelChrome extends PureComponent<Props, State> {
onRefresh = () => {
const { panel, isInView, width } = this.props;
if (!isInView) {
console.log('Refresh when panel is visible', panel.id);
this.setState({ refreshWhenInView: true });
return;
}
@ -181,7 +180,6 @@ export class PanelChrome extends PureComponent<Props, State> {
// Issue Query
if (this.wantsQueryExecution) {
if (width < 0) {
console.log('Refresh skippted, no width yet... wait till we know');
return;
}

@ -90,7 +90,7 @@ export class DashboardLoaderSrv {
};
},
(err: any) => {
console.log('Script dashboard error ' + err);
console.error('Script dashboard error ' + err);
this.$rootScope.appEvent(AppEvents.alertError, [
'Script Error',
'Please make sure it exists and returns a valid dashboard',

@ -177,7 +177,7 @@ export class PanelQueryRunner {
this.pipeToSubject(runRequest(ds, request));
} catch (err) {
console.log('PanelQueryRunner Error', err);
console.error('PanelQueryRunner Error', err);
}
}

@ -117,7 +117,7 @@ async function fetchDashboard(
}
} catch (err) {
dispatch(dashboardInitFailed({ message: 'Failed to fetch dashboard', error: err }));
console.log(err);
console.error(err);
return null;
}
}
@ -161,7 +161,7 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
dashboard = new DashboardModel(dashDTO.dashboard, dashDTO.meta);
} catch (err) {
dispatch(dashboardInitFailed({ message: 'Failed create dashboard model', error: err }));
console.log(err);
console.error(err);
return;
}
@ -216,7 +216,7 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
keybindingSrv.setupDashboardBindings(args.$scope, dashboard);
} catch (err) {
dispatch(notifyApp(createErrorNotification('Dashboard init failed', err)));
console.log(err);
console.error(err);
}
if (storeState.dashboard.modifiedQueries) {

@ -116,7 +116,7 @@ export function runRequest(datasource: DataSourceApi, request: DataQueryRequest)
}),
// handle errors
catchError(err => {
console.log('runRequest.catchError', err);
console.error('runRequest.catchError', err);
return of({
...state.panelData,
state: LoadingState.Error,

@ -66,7 +66,7 @@ export const refreshPanel = (panel: PanelModel) => {
};
export const toggleLegend = (panel: PanelModel) => {
console.log('Toggle legend is not implemented yet');
console.warn('Toggle legend is not implemented yet');
// We need to set panel.legend defaults first
// panel.legend.show = !panel.legend.show;
refreshPanel(panel);

@ -67,7 +67,7 @@ export const initDataSourceSettings = (
dispatch(initDataSourceSettingsSucceeded(importedPlugin));
} catch (err) {
console.log('Failed to import plugin module', err);
console.error('Failed to import plugin module', err);
dispatch(initDataSourceSettingsFailed(err));
}
};

@ -76,10 +76,6 @@ export class QueryRow extends PureComponent<QueryRowProps, QueryRowState> {
}
};
componentWillUnmount() {
console.log('QueryRow will unmount');
}
onClickToggleDisabled = () => {
const { exploreId, index, query } = this.props;
const newQuery = {

@ -372,7 +372,7 @@ export const loadDatasource = (exploreId: ExploreId, instance: DataSourceApi, or
try {
instance.init();
} catch (err) {
console.log(err);
console.error(err);
}
}

@ -30,7 +30,7 @@ export function uploadDashboardDirective(timer: any, $location: ILocationService
try {
dash = JSON.parse(e.target.result);
} catch (err) {
console.log(err);
console.error(err);
appEvents.emit(AppEvents.alertError, [
'Import failed',
'JSON -> JS Serialization failed: ' + err.message,

@ -266,7 +266,7 @@ function pluginDirectiveLoader(
registerPluginComponent(scope, elem, attrs, componentInfo);
})
.catch((err: any) => {
console.log('Plugin component error', err);
console.error('Plugin component error', err);
});
},
};

@ -561,7 +561,7 @@ export const initVariablesTransaction = (dashboardUid: string, dashboard: Dashbo
dispatch(variablesCompleteTransaction({ uid: dashboardUid }));
} catch (err) {
dispatch(notifyApp(createErrorNotification('Templating init failed', err)));
console.log(err);
console.error(err);
}
};

@ -55,7 +55,6 @@ export function runSharedRequest(options: QueryRunnerOptions): Observable<PanelD
}
return () => {
console.log('runSharedRequest unsubscribe');
subscription.unsubscribe();
};
});

@ -315,7 +315,7 @@ export class ElasticDatasource extends DataSourceApi<ElasticsearchQuery, Elastic
return { status: 'success', message: 'Index OK. Time field name OK.' };
},
(err: any) => {
console.log(err);
console.error(err);
if (err.data && err.data.error) {
let message = angular.toJson(err.data.error);
if (err.data.error.reason) {

@ -135,7 +135,6 @@ export default class KustoQueryField extends QueryField {
} else if (modelPrefix.match(/(database\(\"(\w+)\"\)\.(.+\b)?$)/i)) {
typeaheadContext = 'context-database-table';
const db = this.getDBFromDatabaseFunction(modelPrefix);
console.log(db);
suggestionGroups = this.getTableSuggestions(db);
prefix = prefix.replace('.', '');

@ -467,8 +467,6 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
this.replace(this.target.azureMonitor.metricName)
)
.then((metadata: any) => {
console.log('Update metadata', metadata);
this.target.azureMonitor.aggregation = metadata.primaryAggType;
this.target.azureMonitor.timeGrain = 'auto';
this.target.azureMonitor.allowedTimeGrainsMs = this.convertTimeGrainsToMs(metadata.supportedTimeGrains || []);
@ -527,7 +525,6 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
}
azureMonitorAddDimensionFilter() {
console.log('Add dimension', this.target.azureMonitor);
this.target.azureMonitor.dimensionFilters.push({
dimension: '',
operator: 'eq',
@ -538,7 +535,6 @@ export class AzureMonitorQueryCtrl extends QueryCtrl {
azureMonitorRemoveDimensionFilter(index: number) {
this.target.azureMonitor.dimensionFilters.splice(index, 1);
this.refresh();
console.log('Remove dimension', index, this.target.azureMonitor);
}
/* Azure Log Analytics */

@ -581,7 +581,7 @@ export class GraphiteDatasource extends DataSourceApi<GraphiteQuery, GraphiteOpt
return this.funcDefs;
})
.catch((err: any) => {
console.log('Fetching graphite functions error', err);
console.error('Fetching graphite functions error', err);
this.funcDefs = gfunc.getFuncDefs(this.graphiteVersion);
return this.funcDefs;
});

@ -54,7 +54,7 @@ export default class GraphiteQuery {
try {
this.parseTargetRecursive(astNode, null);
} catch (err) {
console.log('error parsing target:', err.message);
console.error('error parsing target:', err.message);
this.error = err.message;
this.target.textEditor = true;
}

@ -321,18 +321,18 @@ export default class InfluxDatasource extends DataSourceWithBackend<InfluxQuery,
.toPromise()
.then((res: DataQueryResponse) => {
if (!res || !res.data || res.state !== LoadingState.Done) {
console.log('InfluxDB Error', res);
console.error('InfluxDB Error', res);
return { status: 'error', message: 'Error reading InfluxDB' };
}
const first = res.data[0];
if (first && first.length) {
return { status: 'success', message: `${first.length} buckets found` };
}
console.log('InfluxDB Error', res);
console.error('InfluxDB Error', res);
return { status: 'error', message: 'Error reading buckets' };
})
.catch((err: any) => {
console.log('InfluxDB Error', err);
console.error('InfluxDB Error', err);
return { status: 'error', message: err.message };
});
}

@ -263,7 +263,7 @@ export class InfluxQueryCtrl extends QueryCtrl {
try {
this.target.query = this.queryModel.render(false);
} catch (err) {
console.log('query render error');
console.error('query render error');
}
this.target.rawQuery = !this.target.rawQuery;
}

@ -172,7 +172,7 @@ export class MssqlDatasource {
return { status: 'success', message: 'Database Connection OK' };
})
.catch((err: any) => {
console.log(err);
console.error(err);
if (err.data && err.data.message) {
return { status: 'error', message: err.data.message };
} else {

@ -190,7 +190,7 @@ export class MysqlDatasource {
return { status: 'success', message: 'Database Connection OK' };
})
.catch((err: any) => {
console.log(err);
console.error(err);
if (err.data && err.data.message) {
return { status: 'error', message: err.data.message };
} else {

@ -178,7 +178,7 @@ export class PostgresDatasource {
return { status: 'success', message: 'Database Connection OK' };
})
.catch((err: any) => {
console.log(err);
console.error(err);
if (err.data && err.data.message) {
return { status: 'error', message: err.data.message };
} else {

@ -226,7 +226,7 @@ function sortSeriesByLabel(s1: TimeSeries, s2: TimeSeries): number {
le1 = parseHistogramLabel(s1.target);
le2 = parseHistogramLabel(s2.target);
} catch (err) {
console.log(err);
console.error(err);
return 0;
}

@ -530,7 +530,7 @@ class GraphElement {
delete this.ctrl.error;
}
} catch (e) {
console.log('flotcharts error', e);
console.error('flotcharts error', e);
this.ctrl.error = e.message || 'Render Error';
this.ctrl.renderError = true;
}

@ -253,7 +253,6 @@ export class GraphCtrl extends MetricsPanelCtrl {
tip: 'Data exists, but is not timeseries',
actionText: 'Switch to table view',
action: () => {
console.log('Change from graph to table');
dispatch(changePanelPlugin(this.panel, 'table'));
},
};

@ -59,7 +59,7 @@ function sortSeriesByLabel(s1: { label: string }, s2: { label: string }) {
label1 = parseHistogramLabel(s1.label);
label2 = parseHistogramLabel(s2.label);
} catch (err) {
console.log(err.message || err);
console.error(err.message || err);
return 0;
}

@ -101,7 +101,7 @@ export class GrafanaCtrl {
let callerScope = this;
if (callerScope.$id === 1 && !localScope) {
console.log('warning rootScope onAppEvent called without localscope');
console.warn('warning rootScope onAppEvent called without localscope');
}
if (localScope) {
callerScope = localScope;

Loading…
Cancel
Save