Skip to content

Commit a7ff3b3

Browse files
Merge branch 'master' into apm-rum
2 parents 1b27050 + b7ff35d commit a7ff3b3

File tree

60 files changed

+777
-695
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+777
-695
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@
109109
/x-pack/legacy/plugins/alerting @elastic/kibana-alerting-services
110110
/x-pack/legacy/plugins/actions @elastic/kibana-alerting-services
111111
/x-pack/legacy/plugins/task_manager @elastic/kibana-alerting-services
112+
/x-pack/test/alerting_api_integration @elastic/kibana-alerting-services
113+
/x-pack/test/plugin_api_integration/plugins/task_manager @elastic/kibana-alerting-services
114+
/x-pack/test/plugin_api_integration/test_suites/task_manager @elastic/kibana-alerting-services
112115

113116
# Design
114117
**/*.scss @elastic/kibana-design

x-pack/legacy/plugins/monitoring/public/components/logs/__snapshots__/reason.test.js.snap

Lines changed: 31 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/monitoring/public/components/logs/reason.js

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { EuiCallOut, EuiLink } from '@elastic/eui';
99
import { i18n } from '@kbn/i18n';
1010
import { FormattedMessage } from '@kbn/i18n/react';
1111
import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links';
12+
import { Monospace } from '../metricbeat_migration/instruction_steps/components/monospace/monospace';
1213

1314
export const Reason = ({ reason }) => {
1415
let title = i18n.translate('xpack.monitoring.logs.reason.defaultTitle', {
@@ -91,6 +92,29 @@ export const Reason = ({ reason }) => {
9192
}}
9293
/>
9394
);
95+
} else if (false === reason.usingStructuredLogs) {
96+
title = i18n.translate('xpack.monitoring.logs.reason.notUsingStructuredLogsTitle', {
97+
defaultMessage: 'No structured logs found',
98+
});
99+
message = (
100+
<FormattedMessage
101+
id="xpack.monitoring.logs.reason.notUsingStructuredLogsMessage"
102+
defaultMessage="Check if the {varPaths} setting {link}."
103+
values={{
104+
varPaths: <Monospace>var.paths</Monospace>,
105+
link: (
106+
<EuiLink
107+
target="_blank"
108+
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
109+
>
110+
{i18n.translate('xpack.monitoring.logs.reason.notUsingStructuredLogsLink', {
111+
defaultMessage: 'points to JSON logs',
112+
})}
113+
</EuiLink>
114+
),
115+
}}
116+
/>
117+
);
94118
} else if (false === reason.clusterExists) {
95119
title = i18n.translate('xpack.monitoring.logs.reason.noClusterTitle', {
96120
defaultMessage: 'No logs for this cluster',
@@ -103,7 +127,7 @@ export const Reason = ({ reason }) => {
103127
link: (
104128
<EuiLink
105129
target="_blank"
106-
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation.html`}
130+
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
107131
>
108132
{i18n.translate('xpack.monitoring.logs.reason.noClusterLink', {
109133
defaultMessage: 'setup',
@@ -125,7 +149,7 @@ export const Reason = ({ reason }) => {
125149
link: (
126150
<EuiLink
127151
target="_blank"
128-
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation.html`}
152+
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
129153
>
130154
{i18n.translate('xpack.monitoring.logs.reason.noNodeLink', {
131155
defaultMessage: 'setup',
@@ -147,7 +171,7 @@ export const Reason = ({ reason }) => {
147171
link: (
148172
<EuiLink
149173
target="_blank"
150-
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-installation.html`}
174+
href={`${ELASTIC_WEBSITE_URL}guide/en/beats/filebeat/${DOC_LINK_VERSION}/filebeat-module-elasticsearch.html`}
151175
>
152176
{i18n.translate('xpack.monitoring.logs.reason.noIndexLink', {
153177
defaultMessage: 'setup',

x-pack/legacy/plugins/monitoring/public/components/logs/reason.test.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ describe('Logs', () => {
2929
expect(component).toMatchSnapshot();
3030
});
3131

32+
it('should render with a no structured logs reason', () => {
33+
const component = shallow(
34+
<Reason reason={{ indexPatternExists: true, typeExists: true, usingStructuredLogs: false }} />
35+
);
36+
expect(component).toMatchSnapshot();
37+
});
38+
3239
it('should render with a no cluster found reason', () => {
3340
const component = shallow(
3441
<Reason reason={{ indexPatternExists: true, typeExists: true, clusterExists: false }} />

x-pack/legacy/plugins/monitoring/server/lib/logs/detect_reason.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ async function doesFilebeatIndexExist(
1616
const filter = [createTimeFilter({ start, end, metric })];
1717

1818
const typeFilter = { term: { 'service.type': 'elasticsearch' } };
19+
const structuredLogsFilter = { exists: { field: 'elasticsearch.cluster' } };
1920
const clusterFilter = { term: { 'elasticsearch.cluster.uuid': clusterUuid } };
2021
const nodeFilter = { term: { 'elasticsearch.node.id': nodeUuid } };
2122
const indexFilter = { term: { 'elasticsearch.index.name': indexUuid } };
@@ -44,6 +45,14 @@ async function doesFilebeatIndexExist(
4445
},
4546
};
4647

48+
const usingStructuredLogsQuery = {
49+
query: {
50+
bool: {
51+
filter: [...filter, typeFilter, structuredLogsFilter],
52+
},
53+
},
54+
};
55+
4756
const clusterExistsQuery = {
4857
query: {
4958
bool: {
@@ -81,6 +90,8 @@ async function doesFilebeatIndexExist(
8190
{ ...defaultParams, ...typeExistsAtAnyTimeQuery },
8291
{ index: filebeatIndexPattern },
8392
{ ...defaultParams, ...typeExistsQuery },
93+
{ index: filebeatIndexPattern },
94+
{ ...defaultParams, ...usingStructuredLogsQuery },
8495
];
8596

8697
if (clusterUuid) {
@@ -102,6 +113,7 @@ async function doesFilebeatIndexExist(
102113
indexPatternExistsInTimeRangeResponse,
103114
typeExistsAtAnyTimeResponse,
104115
typeExistsResponse,
116+
usingStructuredLogsResponse,
105117
clusterExistsResponse,
106118
nodeExistsResponse,
107119
indexExistsResponse,
@@ -114,6 +126,7 @@ async function doesFilebeatIndexExist(
114126
get(indexPatternExistsInTimeRangeResponse, 'hits.total.value', 0) > 0,
115127
typeExistsAtAnyTime: get(typeExistsAtAnyTimeResponse, 'hits.total.value', 0) > 0,
116128
typeExists: get(typeExistsResponse, 'hits.total.value', 0) > 0,
129+
usingStructuredLogs: get(usingStructuredLogsResponse, 'hits.total.value', 0) > 0,
117130
clusterExists: clusterUuid ? get(clusterExistsResponse, 'hits.total.value', 0) > 0 : null,
118131
nodeExists: nodeUuid ? get(nodeExistsResponse, 'hits.total.value', 0) > 0 : null,
119132
indexExists: indexUuid ? get(indexExistsResponse, 'hits.total.value', 0) > 0 : null,

x-pack/legacy/plugins/uptime/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ export const uptime = (kibana: any) =>
3636
init(server: KibanaServer) {
3737
const initializerContext = {} as PluginInitializerContext;
3838
const { savedObjects } = server;
39-
const { elasticsearch, xpack_main } = server.plugins;
39+
const { xpack_main } = server.plugins;
4040
const { usageCollection } = server.newPlatform.setup.plugins;
4141

4242
plugin(initializerContext).setup(
4343
{
4444
route: server.newPlatform.setup.core.http.createRouter(),
4545
},
4646
{
47-
elasticsearch,
4847
savedObjects,
4948
usageCollection,
5049
xpack: xpack_main,

x-pack/legacy/plugins/uptime/server/graphql/monitor_states/resolvers.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export const createMonitorStatesResolvers: CreateUMGraphQLResolvers = (
3939
return {
4040
Query: {
4141
async getMonitorStates(
42-
resolver,
42+
_resolver,
4343
{ dateRangeStart, dateRangeEnd, filters, pagination, statusFilter },
44-
{ req }
44+
{ APICaller }
4545
): Promise<MonitorSummaryResult> {
4646
const decodedPagination = pagination
4747
? JSON.parse(decodeURIComponent(pagination))
@@ -50,15 +50,18 @@ export const createMonitorStatesResolvers: CreateUMGraphQLResolvers = (
5050
totalSummaryCount,
5151
{ summaries, nextPagePagination, prevPagePagination },
5252
] = await Promise.all([
53-
libs.pings.getDocCount(req),
54-
libs.monitorStates.getMonitorStates(
55-
req,
53+
libs.pings.getDocCount({ callES: APICaller }),
54+
libs.monitorStates.getMonitorStates({
55+
callES: APICaller,
5656
dateRangeStart,
5757
dateRangeEnd,
58-
decodedPagination,
58+
pagination: decodedPagination,
5959
filters,
60-
statusFilter
61-
),
60+
// this is added to make typescript happy,
61+
// this sort of reassignment used to be further downstream but I've moved it here
62+
// because this code is going to be decomissioned soon
63+
statusFilter: statusFilter || undefined,
64+
}),
6265
]);
6366
return {
6467
summaries,
@@ -67,8 +70,8 @@ export const createMonitorStatesResolvers: CreateUMGraphQLResolvers = (
6770
totalSummaryCount,
6871
};
6972
},
70-
async getStatesIndexStatus(resolver, {}, { req }): Promise<StatesIndexStatus> {
71-
return await libs.monitorStates.statesIndexExists(req);
73+
async getStatesIndexStatus(_resolver, {}, { APICaller }): Promise<StatesIndexStatus> {
74+
return await libs.monitorStates.statesIndexExists({ callES: APICaller });
7275
},
7376
},
7477
};

x-pack/legacy/plugins/uptime/server/graphql/monitors/resolvers.ts

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,54 +71,62 @@ export const createMonitorsResolvers: CreateUMGraphQLResolvers = (
7171
} => ({
7272
Query: {
7373
async getSnapshotHistogram(
74-
resolver,
74+
_resolver,
7575
{ dateRangeStart, dateRangeEnd, filters, monitorId, statusFilter },
76-
{ req }
76+
{ APICaller }
7777
): Promise<HistogramResult> {
78-
return await libs.pings.getPingHistogram(
79-
req,
78+
return await libs.pings.getPingHistogram({
79+
callES: APICaller,
8080
dateRangeStart,
8181
dateRangeEnd,
8282
filters,
8383
monitorId,
84-
statusFilter
85-
);
84+
statusFilter,
85+
});
8686
},
8787
async getMonitorChartsData(
88-
resolver,
88+
_resolver,
8989
{ monitorId, dateRangeStart, dateRangeEnd, location },
90-
{ req }
90+
{ APICaller }
9191
): Promise<MonitorChart> {
92-
return await libs.monitors.getMonitorChartsData(
93-
req,
92+
return await libs.monitors.getMonitorChartsData({
93+
callES: APICaller,
9494
monitorId,
9595
dateRangeStart,
9696
dateRangeEnd,
97-
location
98-
);
97+
location,
98+
});
9999
},
100100
async getLatestMonitors(
101-
resolver,
101+
_resolver,
102102
{ dateRangeStart, dateRangeEnd, monitorId, location },
103-
{ req }
103+
{ APICaller }
104104
): Promise<Ping[]> {
105-
return await libs.pings.getLatestMonitorDocs(
106-
req,
105+
return await libs.pings.getLatestMonitorDocs({
106+
callES: APICaller,
107107
dateRangeStart,
108108
dateRangeEnd,
109109
monitorId,
110-
location
111-
);
110+
location,
111+
});
112112
},
113-
async getFilterBar(resolver, { dateRangeStart, dateRangeEnd }, { req }): Promise<FilterBar> {
114-
return await libs.monitors.getFilterBar(req, dateRangeStart, dateRangeEnd);
113+
async getFilterBar(
114+
_resolver,
115+
{ dateRangeStart, dateRangeEnd },
116+
{ APICaller }
117+
): Promise<FilterBar> {
118+
return await libs.monitors.getFilterBar({
119+
callES: APICaller,
120+
dateRangeStart,
121+
dateRangeEnd,
122+
});
115123
},
116124
async getMonitorPageTitle(
117-
resolver: any,
125+
_resolver: any,
118126
{ monitorId },
119-
{ req }
127+
{ APICaller }
120128
): Promise<MonitorPageTitle | null> {
121-
return await libs.monitors.getMonitorPageTitle(req, monitorId);
129+
return await libs.monitors.getMonitorPageTitle({ callES: APICaller, monitorId });
122130
},
123131
},
124132
});

x-pack/legacy/plugins/uptime/server/graphql/pings/resolvers.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ export const createPingsResolvers: CreateUMGraphQLResolvers = (
3434
} => ({
3535
Query: {
3636
async allPings(
37-
resolver,
37+
_resolver,
3838
{ monitorId, sort, size, status, dateRangeStart, dateRangeEnd, location },
39-
{ req }
39+
{ APICaller }
4040
): Promise<PingResults> {
41-
return await libs.pings.getAll(
42-
req,
41+
return await libs.pings.getAll({
42+
callES: APICaller,
4343
dateRangeStart,
4444
dateRangeEnd,
4545
monitorId,
4646
status,
4747
sort,
4848
size,
49-
location
50-
);
49+
location,
50+
});
5151
},
52-
async getDocCount(resolver, args, { req }): Promise<DocCount> {
53-
return libs.pings.getDocCount(req);
52+
async getDocCount(_resolver, _args, { APICaller }): Promise<DocCount> {
53+
return libs.pings.getDocCount({ callES: APICaller });
5454
},
5555
},
5656
});

0 commit comments

Comments
 (0)