Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

701 B
Raw Blame
import type {
	DashboardtypesPanelSpecDTO,
	DashboardtypesTextPanelSpecDTO,
} from 'api/generated/services/sigNoz.schemas';

/**
 * The spec with a new authored body. Two localized casts: the plugin-spec union
 * can't be narrowed by a dynamic kind, and a bare literal resolves against the
 * wrong arm of `plugin` on the way back in.
 */
export function withPanelText(
	spec: DashboardtypesPanelSpecDTO,
	text: string,
): DashboardtypesPanelSpecDTO {
	const pluginSpec: DashboardtypesTextPanelSpecDTO = {
		...(spec.plugin.spec as DashboardtypesTextPanelSpecDTO),
		text,
	};
	return {
		...spec,
		plugin: {
			...spec.plugin,
			spec: pluginSpec,
		} as DashboardtypesPanelSpecDTO['plugin'],
	};
}