Skip to content

Commit 2d15e38

Browse files
Merge branch 'master' into reporting/move-class-ts-typedefs
2 parents d4fd2a3 + 1b1a0f4 commit 2d15e38

File tree

36 files changed

+1418
-135
lines changed

36 files changed

+1418
-135
lines changed

src/cli/cluster/run_kbn_optimizer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export function runKbnOptimizer(opts: Record<string, any>, config: LegacyConfig)
3535
repoRoot: REPO_ROOT,
3636
watch: true,
3737
includeCoreBundle: true,
38+
cache: !!opts.cache,
3839
oss: !!opts.oss,
3940
examples: !!opts.runExamples,
4041
pluginPaths: config.get('plugins.paths'),

src/cli/serve/serve.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ export default function(program) {
218218
"Don't put a proxy in front of the dev server, which adds a random basePath"
219219
)
220220
.option('--no-watch', 'Prevents automatic restarts of the server in --dev mode')
221+
.option('--no-cache', 'Disable the kbn/optimizer cache')
221222
.option('--no-dev-config', 'Prevents loading the kibana.dev.yml file in --dev mode');
222223
}
223224

src/core/public/application/ui/app_container.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ export const AppContainer: FunctionComponent<Props> = ({
8787
})) || null;
8888
} catch (e) {
8989
// TODO: add error UI
90+
// eslint-disable-next-line no-console
91+
console.error(e);
9092
} finally {
9193
setShowSpinner(false);
9294
setIsMounting(false);

x-pack/plugins/apm/common/agent_name.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,16 @@ export function isJavaAgentName(
4141
): agentName is 'java' {
4242
return agentName === 'java';
4343
}
44+
45+
/**
46+
* "Normalizes" and agent name by:
47+
*
48+
* * Converting to lowercase
49+
* * Converting "rum-js" to "js-base"
50+
*
51+
* This helps dealing with some older agent versions
52+
*/
53+
export function getNormalizedAgentName(agentName?: string) {
54+
const lowercased = agentName && agentName.toLowerCase();
55+
return isRumAgentName(lowercased) ? 'js-base' : lowercased;
56+
}

x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.stories.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ storiesOf('app/ServiceMap/Cytoscape', module)
186186
'agent.name': 'dotnet'
187187
}
188188
},
189+
{
190+
data: {
191+
id: 'dotNet',
192+
'service.name': 'dotNet service',
193+
'agent.name': 'dotNet'
194+
}
195+
},
189196
{
190197
data: {
191198
id: 'go',

x-pack/plugins/apm/public/components/app/ServiceMap/icons.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
import cytoscape from 'cytoscape';
8-
import { isRumAgentName } from '../../../../common/agent_name';
8+
import { getNormalizedAgentName } from '../../../../common/agent_name';
99
import {
1010
AGENT_NAME,
1111
SPAN_SUBTYPE,
@@ -87,8 +87,7 @@ const agentIcons: { [key: string]: string } = {
8787
};
8888

8989
function getAgentIcon(agentName?: string) {
90-
// RUM can have multiple names. Normalize it
91-
const normalizedAgentName = isRumAgentName(agentName) ? 'js-base' : agentName;
90+
const normalizedAgentName = getNormalizedAgentName(agentName);
9291
return normalizedAgentName && agentIcons[normalizedAgentName];
9392
}
9493

x-pack/plugins/endpoint/common/models/event.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
76
import { LegacyEndpointEvent, ResolverEvent } from '../types';
87

98
export function isLegacyEvent(event: ResolverEvent): event is LegacyEndpointEvent {
@@ -46,3 +45,23 @@ export function parentEntityId(event: ResolverEvent): string | undefined {
4645
}
4746
return event.process.parent?.entity_id;
4847
}
48+
49+
export function eventType(event: ResolverEvent): string {
50+
// Returning "Process" as a catch-all here because it seems pretty general
51+
let eventCategoryToReturn: string = 'Process';
52+
if (isLegacyEvent(event)) {
53+
const legacyFullType = event.endgame.event_type_full;
54+
if (legacyFullType) {
55+
return legacyFullType;
56+
}
57+
} else {
58+
const eventCategories = event.event.category;
59+
const eventCategory =
60+
typeof eventCategories === 'string' ? eventCategories : eventCategories[0] || '';
61+
62+
if (eventCategory) {
63+
eventCategoryToReturn = eventCategory;
64+
}
65+
}
66+
return eventCategoryToReturn;
67+
}

x-pack/plugins/endpoint/public/embeddables/resolver/store/actions.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ interface AppRequestedResolverData {
4444
readonly type: 'appRequestedResolverData';
4545
}
4646

47+
/**
48+
* The action dispatched when the app requests related event data for one or more
49+
* subjects (whose ids should be included as an array @ `payload`)
50+
*/
51+
interface UserRequestedRelatedEventData {
52+
readonly type: 'userRequestedRelatedEventData';
53+
readonly payload: ResolverEvent;
54+
}
55+
4756
/**
4857
* When the user switches the "active descendant" of the Resolver.
4958
* The "active descendant" (from the point of view of the parent element)
@@ -77,11 +86,36 @@ interface UserSelectedResolverNode {
7786
};
7887
}
7988

89+
/**
90+
* This action should dispatch to indicate that the user chose to
91+
* focus on examining the related events of a particular ResolverEvent.
92+
* Optionally, this can be bound by a category of related events (e.g. 'file' or 'dns')
93+
*/
94+
interface UserSelectedRelatedEventCategory {
95+
readonly type: 'userSelectedRelatedEventCategory';
96+
readonly payload: {
97+
subject: ResolverEvent;
98+
category?: string;
99+
};
100+
}
101+
102+
/**
103+
* This action should dispatch to indicate that the user chose to focus
104+
* on examining alerts related to a particular ResolverEvent
105+
*/
106+
interface UserSelectedRelatedAlerts {
107+
readonly type: 'userSelectedRelatedAlerts';
108+
readonly payload: ResolverEvent;
109+
}
110+
80111
export type ResolverAction =
81112
| CameraAction
82113
| DataAction
83114
| UserBroughtProcessIntoView
84115
| UserChangedSelectedEvent
85116
| AppRequestedResolverData
86117
| UserFocusedOnResolverNode
87-
| UserSelectedResolverNode;
118+
| UserSelectedResolverNode
119+
| UserRequestedRelatedEventData
120+
| UserSelectedRelatedEventCategory
121+
| UserSelectedRelatedAlerts;

x-pack/plugins/endpoint/public/embeddables/resolver/store/data/action.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { ResolverEvent } from '../../../../../common/types';
8+
import { RelatedEventDataEntry } from '../../types';
89

910
interface ServerReturnedResolverData {
1011
readonly type: 'serverReturnedResolverData';
@@ -15,4 +16,24 @@ interface ServerFailedToReturnResolverData {
1516
readonly type: 'serverFailedToReturnResolverData';
1617
}
1718

18-
export type DataAction = ServerReturnedResolverData | ServerFailedToReturnResolverData;
19+
/**
20+
* Will occur when a request for related event data is fulfilled by the API.
21+
*/
22+
interface ServerReturnedRelatedEventData {
23+
readonly type: 'serverReturnedRelatedEventData';
24+
readonly payload: Map<ResolverEvent, RelatedEventDataEntry>;
25+
}
26+
27+
/**
28+
* Will occur when a request for related event data is unsuccessful.
29+
*/
30+
interface ServerFailedToReturnRelatedEventData {
31+
readonly type: 'serverFailedToReturnRelatedEventData';
32+
readonly payload: ResolverEvent;
33+
}
34+
35+
export type DataAction =
36+
| ServerReturnedResolverData
37+
| ServerFailedToReturnResolverData
38+
| ServerReturnedRelatedEventData
39+
| ServerFailedToReturnRelatedEventData;

x-pack/plugins/endpoint/public/embeddables/resolver/store/data/reducer.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function initialState(): DataState {
1212
results: [],
1313
isLoading: false,
1414
hasError: false,
15+
resultsEnrichedWithRelatedEventInfo: new Map(),
1516
};
1617
}
1718

@@ -23,6 +24,26 @@ export const dataReducer: Reducer<DataState, ResolverAction> = (state = initialS
2324
isLoading: false,
2425
hasError: false,
2526
};
27+
} else if (action.type === 'userRequestedRelatedEventData') {
28+
const resolverEvent = action.payload;
29+
const currentStatsMap = new Map(state.resultsEnrichedWithRelatedEventInfo);
30+
/**
31+
* Set the waiting indicator for this event to indicate that related event results are pending.
32+
* It will be replaced by the actual results from the API when they are returned.
33+
*/
34+
currentStatsMap.set(resolverEvent, 'waitingForRelatedEventData');
35+
return { ...state, resultsEnrichedWithRelatedEventInfo: currentStatsMap };
36+
} else if (action.type === 'serverFailedToReturnRelatedEventData') {
37+
const currentStatsMap = new Map(state.resultsEnrichedWithRelatedEventInfo);
38+
const resolverEvent = action.payload;
39+
currentStatsMap.set(resolverEvent, 'error');
40+
return { ...state, resultsEnrichedWithRelatedEventInfo: currentStatsMap };
41+
} else if (action.type === 'serverReturnedRelatedEventData') {
42+
const relatedDataEntries = new Map([
43+
...state.resultsEnrichedWithRelatedEventInfo,
44+
...action.payload,
45+
]);
46+
return { ...state, resultsEnrichedWithRelatedEventInfo: relatedDataEntries };
2647
} else if (action.type === 'appRequestedResolverData') {
2748
return {
2849
...state,

0 commit comments

Comments
 (0)