Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
fef99c9
Display logs with LogsOverview component
kpatticha Aug 21, 2025
98441e9
Merge branch 'main' of github.com:elastic/kibana into discover-add-logs
kpatticha Aug 25, 2025
701f9f1
Remove the observability-logs-overview feature
kpatticha Aug 25, 2025
f708be5
Display trace context log event in trace flyout
kpatticha Aug 25, 2025
efb86df
Default columns
kpatticha Aug 25, 2025
db8848d
Update the query
kpatticha Aug 25, 2025
6cafbde
Fix height
kpatticha Aug 25, 2025
2415a24
Fix types
kpatticha Aug 25, 2025
95103e1
Fix broken mock
kpatticha Aug 25, 2025
b1149b4
Fix storybook
kpatticha Aug 25, 2025
25842fe
fix type
kpatticha Aug 25, 2025
cd0ef0d
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Aug 25, 2025
588761d
Merge branch 'main' of github.com:elastic/kibana into discover-add-logs
kpatticha Aug 26, 2025
5262323
Fix types
kpatticha Aug 26, 2025
9de3cdd
Set max height for section content
kpatticha Aug 26, 2025
2f791c7
Merge branch 'discover-add-logs' of github.com:kpatticha/kibana into …
kpatticha Aug 26, 2025
e943125
Use discover feature
kpatticha Aug 27, 2025
4b916cf
More embeddable types in discover-utils
kpatticha Aug 27, 2025
76c59f8
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Aug 27, 2025
b785a12
Revert "More embeddable types in discover-utils"
kpatticha Aug 27, 2025
12bf80f
Register the log eventts table as feature in discover
kpatticha Aug 27, 2025
c60600d
Merge branch 'discover-add-logs' of github.com:kpatticha/kibana into …
kpatticha Aug 27, 2025
8bb839e
Merge branch 'main' into discover-add-logs
kpatticha Aug 27, 2025
b5c20b1
Clean up
kpatticha Aug 27, 2025
bb1f4d1
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine Aug 27, 2025
d269371
Add a comment
kpatticha Aug 27, 2025
8291611
Merge branch 'discover-add-logs' of github.com:kpatticha/kibana into …
kpatticha Aug 27, 2025
dcd7fd5
Fix eslint
kpatticha Aug 27, 2025
60c2592
Add transactionId and add tests
kpatticha Aug 28, 2025
11469c3
Remove the mock
kpatticha Aug 28, 2025
9b9548f
Update description
kpatticha Aug 28, 2025
a629b9a
Merge branch 'main' into discover-add-logs
kpatticha Aug 28, 2025
9b19edd
Merge branch 'main' of github.com:elastic/kibana into discover-add-logs
kpatticha Aug 29, 2025
7d763ac
Merge branch 'discover-add-logs' of github.com:kpatticha/kibana into …
kpatticha Aug 29, 2025
498f249
Fix types
kpatticha Aug 29, 2025
c02a5ec
Merge branch 'main' into discover-add-logs
kpatticha Sep 1, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions examples/unified_doc_viewer/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"id": "unifiedDocViewerExamples",
"server": false,
"browser": true,
"requiredPlugins": [
"data",
"developerExamples",
"unifiedDocViewer"
]
"requiredPlugins": ["data", "developerExamples", "unifiedDocViewer"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import type { DataTableRecord } from '@kbn/discover-utils';
import type { FunctionComponent, PropsWithChildren } from 'react';
import type { DataGridCellValueElementProps } from '@kbn/unified-data-table';
import type { Query, TimeRange } from '@kbn/es-query';
import type { SpanLinks } from '@kbn/apm-types';
import type { ProcessorEvent } from '@kbn/apm-types-shared';
import type { FeaturesRegistry } from '../../../common';
Expand Down Expand Up @@ -66,6 +67,20 @@ export interface ObservabilityCreateSLOFeature {
}) => React.ReactNode;
}

export interface ObservabilityLogEventsFeature {
id: 'observability-log-events';
render: (props: {
query: Query;
timeRange: TimeRange;
index: string;
displayOptions?: {
solutionNavIdOverride: 'oblt';
enableDocumentViewer: false;
enableFilters: false;
};
}) => JSX.Element;
}

/** **************** Security Solution ****************/

export interface SecuritySolutionCellRendererFeature {
Expand All @@ -91,6 +106,7 @@ export type DiscoverFeature =
| ObservabilityStreamsFeature
| ObservabilityLogsAIAssistantFeature
| ObservabilityCreateSLOFeature
| ObservabilityLogEventsFeature
| ObservabilityTracesSpanLinksFeature
| SecuritySolutionFeature;

Expand Down
8 changes: 2 additions & 6 deletions src/platform/plugins/shared/discover_shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
"compilerOptions": {
"outDir": "target/types"
},
"include": [
"common/**/*",
"public/**/*",
"server/**/*",
"../../../../../typings/**/*",
],
"include": ["common/**/*", "public/**/*", "server/**/*", "../../../../../typings/**/*"],
"exclude": ["target/**/*"],
"kbn_references": [
"@kbn/discover-utils",
"@kbn/core",
"@kbn/unified-data-table",
"@kbn/es-query",
"@kbn/apm-types",
"@kbn/apm-types-shared"
]
Expand Down
20 changes: 4 additions & 16 deletions src/platform/plugins/shared/unified_doc_viewer/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
{
"type": "plugin",
"id": "@kbn/unified-doc-viewer-plugin",
"owner": [
"@elastic/kibana-data-discovery"
],
"owner": ["@elastic/kibana-data-discovery"],
"group": "platform",
"visibility": "shared",
"description": "This plugin contains services reliant on the plugin lifecycle for the unified doc viewer component (see @kbn/unified-doc-viewer).",
"plugin": {
"id": "unifiedDocViewer",
"browser": true,
"server": false,
"requiredPlugins": [
"data",
"fieldFormats",
"share",
"embeddable",
"discoverShared"
],
"optionalPlugins": [
"fieldsMetadata"
],
"requiredBundles": [
"kibanaUtils"
]
"requiredPlugins": ["data", "fieldFormats", "share", "embeddable", "discoverShared"],
"optionalPlugins": ["fieldsMetadata"],
"requiredBundles": ["kibanaUtils"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React, { useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { ContentFrameworkSection } from '../../../../content_framework/section';
import { getUnifiedDocViewerServices } from '../../../../../plugin';
import { useDataSourcesContext } from '../../hooks/use_data_sources';
import { useLogsQuery } from '../../hooks/use_logs_query';

const logsTitle = i18n.translate('unifiedDocViewer.observability.traces.section.logs.title', {
defaultMessage: 'Logs',
});

const logsDescription = i18n.translate(
'unifiedDocViewer.observability.traces.section.logs.description',
{
defaultMessage: 'Correlated logs that occurred during the span',
}
);

export interface TraceContextLogEventsProps {
traceId: string;
spanId?: string;
transactionId?: string;
}
export function TraceContextLogEvents({
traceId,
transactionId,
spanId,
}: TraceContextLogEventsProps) {
const { data: dataService, discoverShared } = getUnifiedDocViewerServices();
const { indexes } = useDataSourcesContext();
const { from, to } = dataService.query.timefilter.timefilter.getTime();

const timeRange = useMemo(() => ({ from, to }), [from, to]);
const query = useLogsQuery({ traceId, spanId, transactionId });

const savedSearchTimeRange = useMemo(
() => ({
from: timeRange.from,
to: timeRange.to,
}),
[timeRange.from, timeRange.to]
);

const LogEvents = discoverShared.features.registry.getById('observability-log-events');

if (!LogEvents || !indexes.logs) {
return null;
}

const LogEventsComponent = LogEvents.render;

return (
<ContentFrameworkSection
title={logsTitle}
description={logsDescription}
id="traceContextLogEvents"
>
<div tabIndex={0} className="eui-yScrollWithShadows" style={{ maxHeight: '400px' }}>
<LogEventsComponent query={query} timeRange={savedSearchTimeRange} index={indexes.logs} />
</div>
</ContentFrameworkSection>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
getTabContentAvailableHeight,
DEFAULT_MARGIN_BOTTOM,
} from '../../../doc_viewer_source/get_height';
import { TraceContextLogEvents } from '../components/trace_context_log_events';

export type SpanOverviewProps = DocViewRenderProps & {
indexes: TraceIndexes;
Expand Down Expand Up @@ -163,6 +164,14 @@ export function SpanOverview({
<EuiSpacer size="m" />
<SpanLinks traceId={traceId} docId={spanId} />
</EuiFlexItem>
<EuiFlexItem>
<EuiSpacer size="m" />
<TraceContextLogEvents
traceId={flattenedDoc[TRACE_ID_FIELD]}
spanId={flattenedDoc[SPAN_ID_FIELD]}
transactionId={transactionId}
/>
</EuiFlexItem>
</EuiFlexGroup>
</FieldActionsProvider>
</RootSpanProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
DEFAULT_MARGIN_BOTTOM,
getTabContentAvailableHeight,
} from '../../../doc_viewer_source/get_height';
import { TraceContextLogEvents } from '../components/trace_context_log_events';
import { SpanLinks } from '../components/span_links';

export type TransactionOverviewProps = DocViewRenderProps & {
Expand Down Expand Up @@ -156,13 +157,16 @@ export function TransactionOverview({
</>
)}
</EuiFlexItem>
<EuiSpacer size="m" />
<SpanLinks
traceId={traceId}
docId={transactionId}
processorEvent={ProcessorEvent.transaction}
/>
<EuiFlexItem />
<EuiFlexItem>
<EuiSpacer size="m" />
<SpanLinks
traceId={traceId}
docId={transactionId}
processorEvent={ProcessorEvent.transaction}
/>
<TraceContextLogEvents traceId={traceId} transactionId={transactionId} />
</EuiFlexItem>
</EuiFlexGroup>
</FieldActionsProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import React from 'react';
import { render, screen } from '@testing-library/react';
import { useLogsQuery } from './use_logs_query';

function TestComponent({
traceId,
spanId,
transactionId,
}: {
traceId: string;
transactionId?: string;
spanId?: string;
}) {
const query = useLogsQuery({ traceId, spanId, transactionId });
return <div data-test-subj="query">{query.query}</div>;
}

describe('useLogsQuery', () => {
it('builds query for traceId ', () => {
render(<TestComponent traceId="trace123" />);
const div = screen.getByTestId('query');
expect(div.textContent).toBe(`(trace.id:"trace123" OR (not trace.id:* AND "trace123"))`);
});

it('builds query for traceId, transactionId and spanId', () => {
render(<TestComponent traceId="trace123" spanId="span456" transactionId="transaction123" />);
const div = screen.getByTestId('query');
expect(div.textContent).toBe(
`(trace.id:"trace123" OR (not trace.id:* AND "trace123")) AND ` +
`(transaction.id:"transaction123" OR (not transaction.id:* AND "transaction123")) AND ` +
`(span.id:"span456" OR (not span.id:* AND "span456"))`
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { useMemo } from 'react';
import { SPAN_ID_FIELD, TRACE_ID_FIELD, TRANSACTION_ID_FIELD } from '@kbn/discover-utils';
export interface GetLogsQueryParams {
traceId: string;
transactionId?: string;
spanId?: string;
}

export function useLogsQuery({ traceId, spanId, transactionId }: GetLogsQueryParams) {
return useMemo(() => {
const queryStrings = [
`(${TRACE_ID_FIELD}:"${traceId}" OR (not ${TRACE_ID_FIELD}:* AND "${traceId}"))`,
];

if (transactionId) {
queryStrings.push(
`(${TRANSACTION_ID_FIELD}:"${transactionId}" OR (not ${TRANSACTION_ID_FIELD}:* AND "${transactionId}"))`
);
}

if (spanId) {
queryStrings.push(
`(${SPAN_ID_FIELD}:"${spanId}" OR (not ${SPAN_ID_FIELD}:* AND "${spanId}"))`
);
}

return {
language: 'kuery',
query: queryStrings.join(' AND '),
};
}, [traceId, spanId, transactionId]);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export type { JsonCodeEditorProps } from './components';
export type { EsDocSearchProps } from './hooks';
export type { UnifiedDocViewerSetup, UnifiedDocViewerStart } from './plugin';

import type { DiscoverSharedPublicStart } from '@kbn/discover-shared-plugin/public';
import type { CoreStart } from '@kbn/core-lifecycle-browser';
import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
import type { DataPublicPluginStart } from '@kbn/data-plugin/public';
Expand All @@ -20,9 +20,7 @@ import type { Storage } from '@kbn/kibana-utils-plugin/public';
import type { IUiSettingsClient } from '@kbn/core-ui-settings-browser';
import type { SharePluginStart } from '@kbn/share-plugin/public';
import type { IToasts } from '@kbn/core/public';
import type { DiscoverSharedPublicStart } from '@kbn/discover-shared-plugin/public';
import type { UnifiedDocViewerStart } from './plugin';

export interface UnifiedDocViewerServices {
analytics: AnalyticsServiceStart;
data: DataPublicPluginStart;
Expand Down
28 changes: 5 additions & 23 deletions x-pack/platform/plugins/private/transform/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
{
"type": "plugin",
"id": "@kbn/transform-plugin",
"owner": [
"@elastic/kibana-management"
],
"owner": ["@elastic/kibana-management"],
"group": "platform",
"visibility": "private",
"description": "This plugin provides access to the transforms features provided by Elastic. Transforms enable you to convert existing Elasticsearch indices into summarized indices, which provide opportunities for new insights and analytics.",
"plugin": {
"id": "transform",
"browser": true,
"server": true,
"configPath": [
"xpack",
"transform"
],
"configPath": ["xpack", "transform"],
"requiredPlugins": [
"data",
"dataViews",
Expand All @@ -33,21 +28,8 @@
"contentManagement",
"fieldsMetadata"
],
"optionalPlugins": [
"dataViewEditor",
"security",
"usageCollection",
"spaces",
"alerting"
],
"requiredBundles": [
"esUiShared",
"discover",
"kibanaUtils",
"kibanaReact"
],
"extraPublicDirs": [
"common"
]
"optionalPlugins": ["dataViewEditor", "security", "usageCollection", "spaces", "alerting"],
"requiredBundles": ["esUiShared", "discover", "kibanaUtils", "kibanaReact"],
"extraPublicDirs": ["common"]
}
}
Loading