mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Improve live tailing errors and fix Explore's logs container type errors (#30517)
* If error - catch and show, if no logs - return null * Refactor LogsContainer to use ConnectedProps * Fix typescript error * Remove no logs check * Include review feedback * Add SplitOpen type to createSpanLink and TraceView
This commit is contained in:
@@ -20,12 +20,13 @@ import { TraceViewData, Trace, TraceSpan, TraceKeyValuePair, TraceLink } from '@
|
||||
import { createSpanLinkFactory } from './createSpanLink';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { StoreState } from 'app/types';
|
||||
import { SplitOpen } from 'app/types/explore';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import { TraceToLogsData } from 'app/core/components/TraceToLogsSettings';
|
||||
|
||||
type Props = {
|
||||
trace?: TraceViewData;
|
||||
splitOpenFn: (options: { datasourceUid: string; query: any }) => void;
|
||||
splitOpenFn: SplitOpen;
|
||||
};
|
||||
|
||||
export function TraceView(props: Props) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { DataLink, dateTime, Field, mapInternalLinkToExplore, TimeRange, TraceSpan } from '@grafana/data';
|
||||
import { getTemplateSrv } from '@grafana/runtime';
|
||||
import { Icon } from '@grafana/ui';
|
||||
import { SplitOpen } from 'app/types/explore';
|
||||
import { TraceToLogsOptions } from 'app/core/components/TraceToLogsSettings';
|
||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||
import React from 'react';
|
||||
@@ -11,10 +12,7 @@ import { LokiQuery } from '../../../plugins/datasource/loki/types';
|
||||
* the trace view won't create any links and to capture the datasource and split function making it easier to memoize
|
||||
* with useMemo.
|
||||
*/
|
||||
export function createSpanLinkFactory(
|
||||
splitOpenFn: (options: { datasourceUid: string; query: any }) => void,
|
||||
traceToLogsOptions?: TraceToLogsOptions
|
||||
) {
|
||||
export function createSpanLinkFactory(splitOpenFn: SplitOpen, traceToLogsOptions?: TraceToLogsOptions) {
|
||||
// We should return if dataSourceUid is undefined otherwise getInstanceSettings would return testDataSource.
|
||||
if (!traceToLogsOptions?.datasourceUid) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user