Skip to content

Commit

Permalink
Merge branch 'main' into feature-fleet-server-per-policy
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 6, 2022
2 parents da02744 + fe20722 commit 53e5362
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -79,6 +41,7 @@ describe('Event Annotation Service', () => {
function: 'manual_point_event_annotation',
arguments: {
id: ['myEvent'],
isHidden: [false],
time: ['2022'],
label: ['Hello'],
color: ['#f04e98'],
Expand Down Expand Up @@ -115,6 +78,7 @@ describe('Event Annotation Service', () => {
function: 'manual_range_event_annotation',
arguments: {
id: ['myEvent'],
isHidden: [false],
time: ['2021'],
endTime: ['2022'],
label: ['Hello'],
Expand Down Expand Up @@ -149,6 +113,7 @@ describe('Event Annotation Service', () => {
function: 'query_point_event_annotation',
arguments: {
id: ['myEvent'],
isHidden: [false],
timeField: ['@timestamp'],
label: ['Hello'],
color: ['#f04e98'],
Expand Down Expand Up @@ -221,6 +186,7 @@ describe('Event Annotation Service', () => {
function: 'manual_point_event_annotation',
arguments: {
id: ['myEvent'],
isHidden: [false],
time: ['2022'],
label: ['Hello'],
color: ['#f04e98'],
Expand All @@ -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'],
Expand All @@ -257,6 +224,7 @@ describe('Event Annotation Service', () => {
function: 'query_point_event_annotation',
arguments: {
id: ['myEvent'],
isHidden: [false],
timeField: ['@timestamp'],
label: ['Hello'],
color: ['#f04e98'],
Expand Down Expand Up @@ -320,6 +288,7 @@ describe('Event Annotation Service', () => {
function: 'query_point_event_annotation',
arguments: {
id: ['myEvent'],
isHidden: [false],
timeField: ['@timestamp'],
label: ['Hello'],
color: ['#f04e98'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand All @@ -50,6 +49,7 @@ export function getEventAnnotationService(): EventAnnotationServiceType {
label: [label || defaultAnnotationLabel],
color: [color || defaultAnnotationRangeColor],
outside: [Boolean(outside)],
isHidden: [Boolean(annotation.isHidden)],
},
},
],
Expand All @@ -71,6 +71,7 @@ export function getEventAnnotationService(): EventAnnotationServiceType {
lineStyle: [lineStyle || 'solid'],
icon: hasIcon(icon) ? [icon] : ['triangle'],
textVisibility: [textVisibility || false],
isHidden: [Boolean(annotation.isHidden)],
},
},
],
Expand Down Expand Up @@ -112,6 +113,7 @@ export function getEventAnnotationService(): EventAnnotationServiceType {
filter: filter ? [queryToAst(filter)] : [],
extraFields: extraFields || [],
ignoreGlobalFilters: [Boolean(ignoreGlobalFilters)],
isHidden: [Boolean(annotation.isHidden)],
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/profiling/common/profiling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export interface StackFrameMetadata {
// StackTrace.Type
FrameType: FrameType;

// StackFrame.LineNumber?
// StackTrace.AddressOrLine
AddressOrLine: number;
// StackFrame.FunctionName
FunctionName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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,
Expand All @@ -117,30 +141,7 @@ export function FlamegraphInformationWindow({ onClose, frame, totalSamples, tota
<FlamegraphFrameInformationPanel onClose={onClose}>
<EuiFlexGroup direction="column">
<EuiFlexItem>
<KeyValueList
rows={[
{
label: i18n.translate(
'xpack.profiling.flameGraphInformationWindow.executableLabel',
{ defaultMessage: 'Executable' }
),
value: exeFileName || NOT_AVAILABLE_LABEL,
},
{
label: i18n.translate('xpack.profiling.flameGraphInformationWindow.functionLabel', {
defaultMessage: 'Function',
}),
value: functionName || NOT_AVAILABLE_LABEL,
},
{
label: i18n.translate(
'xpack.profiling.flameGraphInformationWindow.sourceFileLabel',
{ defaultMessage: 'Source file' }
),
value: sourceFileName || NOT_AVAILABLE_LABEL,
},
]}
/>
<KeyValueList rows={informationRows} />
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup direction="column">
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
6 changes: 5 additions & 1 deletion x-pack/plugins/profiling/public/components/flamegraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,13 @@ export const FlameGraph: React.FC<FlameGraphProps> = ({
const selected: undefined | React.ComponentProps<typeof FlamegraphInformationWindow>['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],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 53e5362

Please sign in to comment.