Unify frontend monitoring (#80075)

* Unify frontend monitoring

* Add missing mock

* Add missing mock

* Keep source:sandbox

* Create separate logger for plugins/sql package

* chore: rename "logAlertingError" to "logError"

* Use internal Faro logging for debugging instead of redundant browser logging

* Post-merge fix

* Add more docs about debug levels

* Unify logger names

* Update packages/grafana-runtime/src/utils/logging.ts

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>

* Update packages/grafana-runtime/src/utils/logging.ts

Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>

---------

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
Co-authored-by: Ivan Ortega Alba <ivanortegaalba@gmail.com>
This commit is contained in:
Piotr Jamróz
2024-02-01 15:08:40 +01:00
committed by GitHub
co-authored by Ivan Ortega Alba Gilles De Mey
parent 7c2622a4f1
commit 572c182a81
19 changed files with 113 additions and 59 deletions
@@ -16,6 +16,9 @@ jest.mock('@grafana/runtime', () => {
},
},
logDebug: jest.fn(),
createMonitoringLogger: jest.fn().mockReturnValue({
logDebug: jest.fn(),
}),
};
});
@@ -1,9 +1,10 @@
import { useEffect } from 'react';
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
import { logDebug, config } from '@grafana/runtime';
import { config } from '@grafana/runtime';
import { SQLOptions } from '../../types';
import { sqlPluginLogger } from '../../utils/logging';
/**
* 1. Moves the database field from the options object to jsonData.database and empties the database field.
@@ -20,7 +21,7 @@ export function useMigrateDatabaseFields<T extends SQLOptions, S = {}>({
// Migrate the database field from the column into the jsonData object
if (options.database) {
logDebug(`Migrating from options.database with value ${options.database} for ${options.name}`);
sqlPluginLogger.logDebug(`Migrating from options.database with value ${options.database} for ${options.name}`);
newOptions.database = '';
newOptions.jsonData = { ...jsonData, database: options.database };
optionsUpdated = true;
@@ -35,7 +36,7 @@ export function useMigrateDatabaseFields<T extends SQLOptions, S = {}>({
) {
const { maxOpenConns, maxIdleConns } = config.sqlConnectionLimits;
logDebug(
sqlPluginLogger.logDebug(
`Setting default max open connections to ${maxOpenConns} and setting max idle connection to ${maxIdleConns}`
);