Sandbox: Improve logging of sandbox lifecycle for monitoring (#79297)

* Sandbox: Log a plugin loading inside the sandbox

* Improve tracking of general sandbox errors

* Fix import
This commit is contained in:
Esteban Beltran
2023-12-12 16:28:56 +01:00
committed by GitHub
parent 6659ed8722
commit 7e68e3f49e
2 changed files with 35 additions and 7 deletions

View File

@ -3,7 +3,12 @@ import React from 'react';
import { PluginSignatureType, PluginType } from '@grafana/data';
import { LogContext } from '@grafana/faro-web-sdk';
import { logWarning as logWarningRuntime, logError as logErrorRuntime, config } from '@grafana/runtime';
import {
logWarning as logWarningRuntime,
logError as logErrorRuntime,
logInfo as logInfoRuntime,
config,
} from '@grafana/runtime';
import { getPluginSettings } from '../pluginSettings';
@ -41,6 +46,15 @@ export function logError(error: Error, context?: LogContext) {
logErrorRuntime(error, context);
}
export function logInfo(message: string, context?: LogContext) {
context = {
...context,
source: 'sandbox',
monitorOnly: String(monitorOnly),
};
logInfoRuntime(message, context);
}
export async function isFrontendSandboxSupported({
isAngular,
pluginId,