diff --git a/src/plugins/event_annotation/common/event_annotation_group/index.ts b/src/plugins/event_annotation/common/event_annotation_group/index.ts index 7cc71e980eefd..e088d6878de7c 100644 --- a/src/plugins/event_annotation/common/event_annotation_group/index.ts +++ b/src/plugins/event_annotation/common/event_annotation_group/index.ts @@ -60,7 +60,7 @@ export function eventAnnotationGroup(): ExpressionFunctionDefinition< fn: (input, args) => { return { type: 'event_annotation_group', - annotations: args.annotations, + annotations: args.annotations.filter((annotation) => !annotation.isHidden), dataView: args.dataView, }; }, diff --git a/src/plugins/event_annotation/public/event_annotation_service/service.test.ts b/src/plugins/event_annotation/public/event_annotation_service/service.test.ts index 5abed8ba618ba..c5df7045fc4dc 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/service.test.ts +++ b/src/plugins/event_annotation/public/event_annotation_service/service.test.ts @@ -19,44 +19,6 @@ describe('Event Annotation Service', () => { expect(eventAnnotationService.toExpression([])).toEqual([]); }); - it('should skip hidden annotations', () => { - expect( - eventAnnotationService.toExpression([ - { - id: 'myEvent', - type: 'manual', - key: { - type: 'point_in_time', - timestamp: '2022', - }, - label: 'Hello', - isHidden: true, - }, - { - id: 'myRangeEvent', - type: 'manual', - key: { - type: 'range', - timestamp: '2021', - endTimestamp: '2022', - }, - label: 'Hello Range', - isHidden: true, - }, - { - id: 'myEvent', - type: 'query', - timeField: '@timestamp', - key: { - type: 'point_in_time', - }, - label: 'Hello Range', - isHidden: true, - filter: { type: 'kibana_query', query: '', language: 'kuery' }, - }, - ]) - ).toEqual([]); - }); it('should process manual point annotations', () => { expect( eventAnnotationService.toExpression([ @@ -79,6 +41,7 @@ describe('Event Annotation Service', () => { function: 'manual_point_event_annotation', arguments: { id: ['myEvent'], + isHidden: [false], time: ['2022'], label: ['Hello'], color: ['#f04e98'], @@ -115,6 +78,7 @@ describe('Event Annotation Service', () => { function: 'manual_range_event_annotation', arguments: { id: ['myEvent'], + isHidden: [false], time: ['2021'], endTime: ['2022'], label: ['Hello'], @@ -149,6 +113,7 @@ describe('Event Annotation Service', () => { function: 'query_point_event_annotation', arguments: { id: ['myEvent'], + isHidden: [false], timeField: ['@timestamp'], label: ['Hello'], color: ['#f04e98'], @@ -221,6 +186,7 @@ describe('Event Annotation Service', () => { function: 'manual_point_event_annotation', arguments: { id: ['myEvent'], + isHidden: [false], time: ['2022'], label: ['Hello'], color: ['#f04e98'], @@ -240,6 +206,7 @@ describe('Event Annotation Service', () => { function: 'manual_range_event_annotation', arguments: { id: ['myRangeEvent'], + isHidden: [false], time: ['2021'], endTime: ['2022'], label: ['Hello Range'], @@ -257,6 +224,7 @@ describe('Event Annotation Service', () => { function: 'query_point_event_annotation', arguments: { id: ['myEvent'], + isHidden: [false], timeField: ['@timestamp'], label: ['Hello'], color: ['#f04e98'], @@ -320,6 +288,7 @@ describe('Event Annotation Service', () => { function: 'query_point_event_annotation', arguments: { id: ['myEvent'], + isHidden: [false], timeField: ['@timestamp'], label: ['Hello'], color: ['#f04e98'], diff --git a/src/plugins/event_annotation/public/event_annotation_service/service.tsx b/src/plugins/event_annotation/public/event_annotation_service/service.tsx index bb8c8d0d62ebd..3722c4d3557bb 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/service.tsx +++ b/src/plugins/event_annotation/public/event_annotation_service/service.tsx @@ -25,9 +25,8 @@ export function hasIcon(icon: string | undefined): icon is string { export function getEventAnnotationService(): EventAnnotationServiceType { const annotationsToExpression = (annotations: EventAnnotationConfig[]) => { - const visibleAnnotations = annotations.filter(({ isHidden }) => !isHidden); const [queryBasedAnnotations, manualBasedAnnotations] = partition( - visibleAnnotations, + annotations, isQueryAnnotationConfig ); @@ -50,6 +49,7 @@ export function getEventAnnotationService(): EventAnnotationServiceType { label: [label || defaultAnnotationLabel], color: [color || defaultAnnotationRangeColor], outside: [Boolean(outside)], + isHidden: [Boolean(annotation.isHidden)], }, }, ], @@ -71,6 +71,7 @@ export function getEventAnnotationService(): EventAnnotationServiceType { lineStyle: [lineStyle || 'solid'], icon: hasIcon(icon) ? [icon] : ['triangle'], textVisibility: [textVisibility || false], + isHidden: [Boolean(annotation.isHidden)], }, }, ], @@ -112,6 +113,7 @@ export function getEventAnnotationService(): EventAnnotationServiceType { filter: filter ? [queryToAst(filter)] : [], extraFields: extraFields || [], ignoreGlobalFilters: [Boolean(ignoreGlobalFilters)], + isHidden: [Boolean(annotation.isHidden)], }, }, ], diff --git a/test/interpreter_functional/test_suites/run_pipeline/event_annotation/fetch_event_annotations.ts b/test/interpreter_functional/test_suites/run_pipeline/event_annotation/fetch_event_annotations.ts index 7616583de2e66..bf33c24f0239d 100644 --- a/test/interpreter_functional/test_suites/run_pipeline/event_annotation/fetch_event_annotations.ts +++ b/test/interpreter_functional/test_suites/run_pipeline/event_annotation/fetch_event_annotations.ts @@ -18,8 +18,7 @@ export default function ({ }: FtrProviderContext & { updateBaselines: boolean }) { let expectExpression: ExpectExpression; - // Failing: See https://github.com/elastic/kibana/issues/140113 - describe.skip('fetch event annotation tests', () => { + describe('fetch event annotation tests', () => { before(() => { expectExpression = expectExpressionProvider({ getService, updateBaselines }); }); diff --git a/x-pack/plugins/profiling/common/profiling.ts b/x-pack/plugins/profiling/common/profiling.ts index f9d882e97c286..73c0e908ea27c 100644 --- a/x-pack/plugins/profiling/common/profiling.ts +++ b/x-pack/plugins/profiling/common/profiling.ts @@ -95,7 +95,7 @@ export interface StackFrameMetadata { // StackTrace.Type FrameType: FrameType; - // StackFrame.LineNumber? + // StackTrace.AddressOrLine AddressOrLine: number; // StackFrame.FunctionName FunctionName: string; diff --git a/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx b/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx index ba33c196b453a..9ab65fee6cf27 100644 --- a/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx +++ b/x-pack/plugins/profiling/public/components/flame_graphs_view/flamegraph_information_window.tsx @@ -15,14 +15,18 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import React from 'react'; -import { NOT_AVAILABLE_LABEL } from '../../../common'; import { getImpactRows } from './get_impact_rows'; +import { getInformationRows } from './get_information_rows'; interface Props { frame?: { + fileID: string; + frameType: number; exeFileName: string; + addressOrLine: number; functionName: string; sourceFileName: string; + sourceLine: number; countInclusive: number; countExclusive: number; }; @@ -104,7 +108,27 @@ export function FlamegraphInformationWindow({ onClose, frame, totalSamples, tota ); } - const { exeFileName, functionName, sourceFileName, countInclusive, countExclusive } = frame; + const { + fileID, + frameType, + exeFileName, + addressOrLine, + functionName, + sourceFileName, + sourceLine, + countInclusive, + countExclusive, + } = frame; + + const informationRows = getInformationRows({ + fileID, + frameType, + exeFileName, + addressOrLine, + functionName, + sourceFileName, + sourceLine, + }); const impactRows = getImpactRows({ countInclusive, @@ -117,30 +141,7 @@ export function FlamegraphInformationWindow({ onClose, frame, totalSamples, tota - + diff --git a/x-pack/plugins/profiling/public/components/flame_graphs_view/get_information_rows.ts b/x-pack/plugins/profiling/public/components/flame_graphs_view/get_information_rows.ts new file mode 100644 index 0000000000000..d142b3ffd1b58 --- /dev/null +++ b/x-pack/plugins/profiling/public/components/flame_graphs_view/get_information_rows.ts @@ -0,0 +1,65 @@ +/* + * 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; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { i18n } from '@kbn/i18n'; +import { NOT_AVAILABLE_LABEL } from '../../../common'; +import { describeFrameType } from '../../../common/profiling'; + +export function getInformationRows({ + fileID, + frameType, + exeFileName, + addressOrLine, + functionName, + sourceFileName, + sourceLine, +}: { + fileID: string; + frameType: number; + exeFileName: string; + addressOrLine: number; + functionName: string; + sourceFileName: string; + sourceLine: number; +}) { + const executable = fileID === '' && addressOrLine === 0 ? 'root' : exeFileName; + const sourceLineNumber = sourceLine > 0 ? `#${sourceLine}` : ''; + + const informationRows = []; + + if (executable) { + informationRows.push({ + label: i18n.translate('xpack.profiling.flameGraphInformationWindow.executableLabel', { + defaultMessage: 'Executable', + }), + value: executable, + }); + } else { + informationRows.push({ + label: i18n.translate('xpack.profiling.flameGraphInformationWindow.frameTypeLabel', { + defaultMessage: 'Frame type', + }), + value: describeFrameType(frameType), + }); + } + + informationRows.push({ + label: i18n.translate('xpack.profiling.flameGraphInformationWindow.functionLabel', { + defaultMessage: 'Function', + }), + value: functionName || NOT_AVAILABLE_LABEL, + }); + + informationRows.push({ + label: i18n.translate('xpack.profiling.flameGraphInformationWindow.sourceFileLabel', { + defaultMessage: 'Source file', + }), + value: sourceFileName ? `${sourceFileName}${sourceLineNumber}` : NOT_AVAILABLE_LABEL, + }); + + return informationRows; +} diff --git a/x-pack/plugins/profiling/public/components/flamegraph.tsx b/x-pack/plugins/profiling/public/components/flamegraph.tsx index adb93418d2ec1..4b6ed5a3b8e01 100644 --- a/x-pack/plugins/profiling/public/components/flamegraph.tsx +++ b/x-pack/plugins/profiling/public/components/flamegraph.tsx @@ -188,9 +188,13 @@ export const FlameGraph: React.FC = ({ const selected: undefined | React.ComponentProps['frame'] = primaryFlamegraph && highlightedVmIndex !== undefined ? { + fileID: primaryFlamegraph.FileID[highlightedVmIndex], + frameType: primaryFlamegraph.FrameType[highlightedVmIndex], exeFileName: primaryFlamegraph.ExeFilename[highlightedVmIndex], - sourceFileName: primaryFlamegraph.SourceFilename[highlightedVmIndex], + addressOrLine: primaryFlamegraph.AddressOrLine[highlightedVmIndex], functionName: primaryFlamegraph.FunctionName[highlightedVmIndex], + sourceFileName: primaryFlamegraph.SourceFilename[highlightedVmIndex], + sourceLine: primaryFlamegraph.SourceLine[highlightedVmIndex], countInclusive: primaryFlamegraph.CountInclusive[highlightedVmIndex], countExclusive: primaryFlamegraph.CountExclusive[highlightedVmIndex], } diff --git a/x-pack/test/functional/apps/dashboard/group3/drilldowns/dashboard_to_dashboard_drilldown.ts b/x-pack/test/functional/apps/dashboard/group3/drilldowns/dashboard_to_dashboard_drilldown.ts index 3b1f9c2065180..45b5a43b61bb6 100644 --- a/x-pack/test/functional/apps/dashboard/group3/drilldowns/dashboard_to_dashboard_drilldown.ts +++ b/x-pack/test/functional/apps/dashboard/group3/drilldowns/dashboard_to_dashboard_drilldown.ts @@ -37,7 +37,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const spaces = getService('spaces'); const elasticChart = getService('elasticChart'); - describe('Dashboard to dashboard drilldown', function () { + // Failing: See https://github.com/elastic/kibana/issues/142913 + describe.skip('Dashboard to dashboard drilldown', function () { describe('Create & use drilldowns', () => { before(async () => { log.debug('Dashboard Drilldowns:initTests');