Skip to content

Commit

Permalink
[APM] Unconditional callout regarding migration for Getting Started G…
Browse files Browse the repository at this point in the history
…uide (elastic#30800)

* Add unconditional callout in tutorial

* Limit status checks to 7.x data only

* Use correct apm indices, instead of index pattern title

* Add support for iconType
  • Loading branch information
sorenlouv authored and jasonrhodes committed Feb 12, 2019
1 parent 34dad98 commit b4ae56a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ const statusCheckSchema = Joi.object({
success: Joi.string(),
error: Joi.string(),
esHitsCheck: Joi.object({
index: Joi.string().required(),
index: Joi.alternatives()
.try(Joi.string(), Joi.array().items(Joi.string()))
.required(),
query: Joi.object().required(),
}).required(),
});
Expand All @@ -70,6 +72,11 @@ const instructionVariantSchema = Joi.object({

const instructionSetSchema = Joi.object({
title: Joi.string(),
callOut: Joi.object({
title: Joi.string().required(),
message: Joi.string(),
iconType: Joi.string()
}),
// Variants (OSes, languages, etc.) for which tutorial instructions are specified.
instructionVariants: Joi.array().items(instructionVariantSchema).required(),
statusCheck: statusCheckSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ class InstructionSetUi extends React.Component {
);
};

renderCallOut = () => {
if(!this.props.callOut) {
return null;
}

return <EuiCallOut title={this.props.callOut.title} children={this.props.callOut.message} iconType={this.props.callOut.iconType} />;
}

render() {
let paramsForm;
if (this.props.params && this.state.isParamFormVisible) {
Expand All @@ -270,6 +278,8 @@ class InstructionSetUi extends React.Component {

{this.renderHeader()}

{this.renderCallOut()}

{paramsForm}

<EuiTabs>
Expand Down Expand Up @@ -307,6 +317,7 @@ const statusCheckConfigShape = PropTypes.shape({

InstructionSetUi.propTypes = {
title: PropTypes.string.isRequired,
callOut: PropTypes.object,
instructionVariants: PropTypes.arrayOf(instructionVariantShape).isRequired,
statusCheckConfig: statusCheckConfigShape,
statusCheckState: PropTypes.oneOf([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ class TutorialUi extends React.Component {
return (
<InstructionSet
title={instructionSet.title}
callOut={instructionSet.callOut}
instructionVariants={instructionSet.instructionVariants}
statusCheckConfig={instructionSet.statusCheck}
statusCheckState={this.state.statusCheckStates[index]}
Expand Down
41 changes: 27 additions & 14 deletions src/legacy/core_plugins/kibana/server/tutorials/apm/envs/on_prem.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
createJavaAgentInstructions,
} from '../instructions/apm_agent_instructions';

export function onPremInstructions(apmIndexPattern) {
export function onPremInstructions(config) {
const EDIT_CONFIG = createEditConfig();
const START_SERVER_UNIX = createStartServerUnix();
const START_SERVER_UNIX_SYSV = createStartServerUnixSysv();
Expand All @@ -50,6 +50,16 @@ export function onPremInstructions(apmIndexPattern) {
title: i18n.translate('kbn.server.tutorials.apm.apmServer.title', {
defaultMessage: 'APM Server',
}),
callOut: {
title: i18n.translate('kbn.server.tutorials.apm.apmServer.callOut.title', {
defaultMessage: 'Important: Updating to 7.0 or higher',
}),
message: i18n.translate('kbn.server.tutorials.apm.apmServer.callOut.message', {
defaultMessage: `Please make sure your APM Server is updated to 7.0 or higher. \
You can also migrate your 6.x data with the migration assistant found in Kibana's management section.`,
}),
iconType: 'alert'
},
instructionVariants: [
{
id: INSTRUCTION_VARIANT.OSX,
Expand Down Expand Up @@ -83,17 +93,17 @@ export function onPremInstructions(apmIndexPattern) {
defaultMessage: 'You have correctly setup APM Server',
}),
error: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.errorMessage', {
defaultMessage: 'APM Server has still not connected to Elasticsearch',
defaultMessage:
'No APM Server detected. Please make sure it is running and you have updated to 7.0 or higher.',
}),
esHitsCheck: {
index: apmIndexPattern,
index: config.get('apm_oss.onboardingIndices'),
query: {
bool: {
filter: {
exists: {
field: 'observer.listening',
},
},
filter: [
{ term: { 'processor.event': 'onboarding' } },
{ range: { 'observer.version_major': { gte: 7 } } },
],
},
},
},
Expand Down Expand Up @@ -155,14 +165,17 @@ export function onPremInstructions(apmIndexPattern) {
defaultMessage: 'No data has been received from agents yet',
}),
esHitsCheck: {
index: apmIndexPattern,
index: [
config.get('apm_oss.errorIndices'),
config.get('apm_oss.transactionIndices'),
config.get('apm_oss.metricsIndices'),
config.get('apm_oss.sourcemapIndices'),
],
query: {
bool: {
should: [
{ term: { 'processor.name': 'error' } },
{ term: { 'processor.name': 'transaction' } },
{ term: { 'processor.name': 'metric' } },
{ term: { 'processor.name': 'sourcemap' } },
filter: [
{ terms: { 'processor.event': ['error', 'transaction', 'metric', 'sourcemap'] } },
{ range: { 'observer.version_major': { gte: 7 } } },
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ It allows you to monitor the performance of thousands of applications in real ti
}),
euiIconType: 'apmApp',
artifacts: artifacts,
onPrem: onPremInstructions(apmIndexPatternTitle),
onPrem: onPremInstructions(config),
elasticCloud: createElasticCloudInstructions(config),
previewImagePath: '/plugins/kibana/home/tutorial_resources/apm/apm.png',
savedObjects: getSavedObjects(apmIndexPatternTitle),
Expand Down

0 comments on commit b4ae56a

Please sign in to comment.