Skip to content

Commit

Permalink
Merge branch 'master' into 2021_10_05-upgrade_ech_v37
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 11, 2021
2 parents 48c5ae1 + 7c5c566 commit 27edb83
Show file tree
Hide file tree
Showing 141 changed files with 3,637 additions and 1,369 deletions.
48 changes: 31 additions & 17 deletions docs/settings/apm-settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,57 +40,71 @@ Changing these settings may disable features of the APM App.

[cols="2*<"]
|===
| `xpack.apm.enabled`
| `xpack.apm.enabled` {ess-icon}
| deprecated:[7.16.0,"In 8.0 and later, this setting will no longer be supported."]
Set to `false` to disable the APM app. Defaults to `true`.

| `xpack.apm.maxServiceEnvironments`
| `xpack.apm.maxServiceEnvironments` {ess-icon}
| Maximum number of unique service environments recognized by the UI. Defaults to `100`.

| `xpack.apm.serviceMapFingerprintBucketSize`
| `xpack.apm.serviceMapFingerprintBucketSize` {ess-icon}
| Maximum number of unique transaction combinations sampled for generating service map focused on a specific service. Defaults to `100`.

| `xpack.apm.serviceMapFingerprintGlobalBucketSize`
| `xpack.apm.serviceMapFingerprintGlobalBucketSize` {ess-icon}
| Maximum number of unique transaction combinations sampled for generating the global service map. Defaults to `100`.

| `xpack.apm.serviceMapEnabled` {ess-icon}
| Set to `false` to disable service maps. Defaults to `true`.

| `xpack.apm.serviceMapTraceIdBucketSize` {ess-icon}
| Maximum number of trace IDs sampled for generating service map focused on a specific service. Defaults to `65`.

| `xpack.apm.serviceMapTraceIdGlobalBucketSize` {ess-icon}
| Maximum number of trace IDs sampled for generating the global service map. Defaults to `6`.

| `xpack.apm.serviceMapMaxTracesPerRequest` {ess-icon}
| Maximum number of traces per request for generating the global service map. Defaults to `50`.

| `xpack.apm.ui.enabled` {ess-icon}
| Set to `false` to hide the APM app from the main menu. Defaults to `true`.

| `xpack.apm.ui.transactionGroupBucketSize`
| `xpack.apm.ui.transactionGroupBucketSize` {ess-icon}
| Number of top transaction groups displayed in the APM app. Defaults to `1000`.

| `xpack.apm.ui.maxTraceItems` {ess-icon}
| Maximum number of child items displayed when viewing trace details. Defaults to `1000`.

| `xpack.observability.annotations.index`
| `xpack.observability.annotations.index` {ess-icon}
| Index name where Observability annotations are stored. Defaults to `observability-annotations`.

| `xpack.apm.searchAggregatedTransactions`
| `xpack.apm.searchAggregatedTransactions` {ess-icon}
| experimental[] Enables Transaction histogram metrics. Defaults to `never` and aggregated transactions are not used. When set to `auto`, the UI will use metric indices over transaction indices for transactions if aggregated transactions are found. When set to `always`, additional configuration in APM Server is required.
See {apm-server-ref-v}/transaction-metrics.html[Configure transaction metrics] for more information.

| `apm_oss.indexPattern` {ess-icon}
| The index pattern used for integrations with Machine Learning and Query Bar.
It must match all apm indices. Defaults to `apm-*`.
| `xpack.apm.metricsInterval` {ess-icon}
| Sets a `fixed_interval` for date histograms in metrics aggregations. Defaults to `30`.

| `xpack.apm.agent.migrations.enabled` {ess-icon}
| Set to `false` to disable cloud APM migrations. Defaults to `true`.

| `apm_oss.errorIndices` {ess-icon}
| `xpack.apm.errorIndices` {ess-icon}
| Matcher for all {apm-server-ref}/error-indices.html[error indices]. Defaults to `apm-*`.

| `apm_oss.onboardingIndices`
| `xpack.apm.onboardingIndices` {ess-icon}
| Matcher for all onboarding indices. Defaults to `apm-*`.

| `apm_oss.spanIndices` {ess-icon}
| `xpack.apm.spanIndices` {ess-icon}
| Matcher for all {apm-server-ref}/span-indices.html[span indices]. Defaults to `apm-*`.

| `apm_oss.transactionIndices` {ess-icon}
| `xpack.apm.transactionIndices` {ess-icon}
| Matcher for all {apm-server-ref}/transaction-indices.html[transaction indices]. Defaults to `apm-*`.

| `apm_oss.metricsIndices`
| `xpack.apm.metricsIndices` {ess-icon}
| Matcher for all {apm-server-ref}/metricset-indices.html[metrics indices]. Defaults to `apm-*`.

| `apm_oss.sourcemapIndices`
| `xpack.apm.sourcemapIndices` {ess-icon}
| Matcher for all {apm-server-ref}/sourcemap-indices.html[source map indices]. Defaults to `apm-*`.

|===

// end::general-apm-settings[]
// end::general-apm-settings[]
6 changes: 5 additions & 1 deletion packages/kbn-storybook/src/lib/run_storybook_cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ export function runStorybookCli({ configDir, name }: { configDir: string; name:
async ({ flags, log }) => {
log.debug('Global config:\n', constants);

const staticDir = [UiSharedDepsNpm.distDir, UiSharedDepsSrc.distDir];
const staticDir = [
UiSharedDepsNpm.distDir,
UiSharedDepsSrc.distDir,
'src/plugins/kibana_react/public/assets:plugins/kibanaReact/assets',
];
const config: Record<string, any> = {
configDir,
mode: flags.site ? 'static' : 'dev',
Expand Down
153 changes: 73 additions & 80 deletions src/core/server/status/get_summary_status.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,93 +81,86 @@ describe('getSummaryStatus', () => {
});

describe('summary', () => {
describe('when a single service is at highest level', () => {
it('returns all information about that single service', () => {
expect(
getSummaryStatus(
Object.entries({
s1: degraded,
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
meta: {
custom: { data: 'here' },
},
it('returns correct summary when a single service is affected', () => {
expect(
getSummaryStatus(
Object.entries({
s1: degraded,
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
meta: {
custom: { data: 'here' },
},
})
)
).toEqual({
level: ServiceStatusLevels.unavailable,
summary: '[s2]: Lorem ipsum',
detail: 'See the status page for more information',
meta: {
affectedServices: ['s2'],
},
});
},
})
)
).toEqual({
level: ServiceStatusLevels.unavailable,
summary: '1 service is unavailable: s2',
detail: 'See the status page for more information',
meta: {
affectedServices: ['s2'],
},
});
});

it('allows the single service to override the detail and documentationUrl fields', () => {
expect(
getSummaryStatus(
Object.entries({
s1: degraded,
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
custom: { data: 'here' },
},
it('returns correct summary when multiple services are affected', () => {
expect(
getSummaryStatus(
Object.entries({
s1: degraded,
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
custom: { data: 'here' },
},
},
s3: {
level: ServiceStatusLevels.unavailable,
summary: 'Proin mattis',
detail: 'Nunc quis nulla at mi lobortis pretium.',
documentationUrl: 'http://helpmenow.com/problem2',
meta: {
other: { data: 'over there' },
},
})
)
).toEqual({
level: ServiceStatusLevels.unavailable,
summary: '[s2]: Lorem ipsum',
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
affectedServices: ['s2'],
},
});
},
})
)
).toEqual({
level: ServiceStatusLevels.unavailable,
summary: '2 services are unavailable: s2, s3',
detail: 'See the status page for more information',
meta: {
affectedServices: ['s2', 's3'],
},
});
});

describe('when multiple services is at highest level', () => {
it('returns aggregated information about the affected services', () => {
expect(
getSummaryStatus(
Object.entries({
s1: degraded,
s2: {
level: ServiceStatusLevels.unavailable,
summary: 'Lorem ipsum',
detail: 'Vivamus pulvinar sem ac luctus ultrices.',
documentationUrl: 'http://helpmenow.com/problem1',
meta: {
custom: { data: 'here' },
},
},
s3: {
level: ServiceStatusLevels.unavailable,
summary: 'Proin mattis',
detail: 'Nunc quis nulla at mi lobortis pretium.',
documentationUrl: 'http://helpmenow.com/problem2',
meta: {
other: { data: 'over there' },
},
},
})
)
).toEqual({
level: ServiceStatusLevels.unavailable,
summary: '[2] services are unavailable',
detail: 'See the status page for more information',
meta: {
affectedServices: ['s2', 's3'],
},
});
it('returns correct summary more than `maxServices` services are affected', () => {
expect(
getSummaryStatus(
Object.entries({
s1: degraded,
s2: available,
s3: degraded,
s4: degraded,
s5: degraded,
s6: available,
s7: degraded,
}),
{ maxServices: 3 }
)
).toEqual({
level: ServiceStatusLevels.degraded,
summary: '5 services are degraded: s1, s3, s4 and 2 other(s)',
detail: 'See the status page for more information',
meta: {
affectedServices: ['s1', 's3', 's4', 's5', 's7'],
},
});
});
});
Expand Down
40 changes: 25 additions & 15 deletions src/core/server/status/get_summary_status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import { ServiceStatus, ServiceStatusLevels, ServiceStatusLevel } from './types'

/**
* Returns a single {@link ServiceStatus} that summarizes the most severe status level from a group of statuses.
* @param statuses
*/
export const getSummaryStatus = (
statuses: Array<[string, ServiceStatus]>,
{ allAvailableSummary = `All services are available` }: { allAvailableSummary?: string } = {}
{
allAvailableSummary = `All services are available`,
maxServices = 3,
}: { allAvailableSummary?: string; maxServices?: number } = {}
): ServiceStatus => {
const { highestLevel, highestStatuses } = highestLevelSummary(statuses);

Expand All @@ -23,30 +25,38 @@ export const getSummaryStatus = (
level: ServiceStatusLevels.available,
summary: allAvailableSummary,
};
} else if (highestStatuses.length === 1) {
const [serviceName, status] = highestStatuses[0]! as [string, ServiceStatus];
return {
...status,
summary: `[${serviceName}]: ${status.summary!}`,
// TODO: include URL to status page
detail: status.detail ?? `See the status page for more information`,
meta: {
affectedServices: [serviceName],
},
};
} else {
const affectedServices = highestStatuses.map(([serviceName]) => serviceName);
return {
level: highestLevel,
summary: `[${highestStatuses.length}] services are ${highestLevel.toString()}`,
summary: getSummaryContent(affectedServices, highestLevel, maxServices),
// TODO: include URL to status page
detail: `See the status page for more information`,
meta: {
affectedServices: highestStatuses.map(([serviceName]) => serviceName),
affectedServices,
},
};
}
};

const getSummaryContent = (
affectedServices: string[],
statusLevel: ServiceStatusLevel,
maxServices: number
): string => {
const serviceCount = affectedServices.length;
if (serviceCount === 1) {
return `1 service is ${statusLevel.toString()}: ${affectedServices[0]}`;
} else if (serviceCount > maxServices) {
const exceedingCount = serviceCount - maxServices;
return `${serviceCount} services are ${statusLevel.toString()}: ${affectedServices
.slice(0, maxServices)
.join(', ')} and ${exceedingCount} other(s)`;
} else {
return `${serviceCount} services are ${statusLevel.toString()}: ${affectedServices.join(', ')}`;
}
};

type StatusPair = [string, ServiceStatus];

const highestLevelSummary = (
Expand Down
Loading

0 comments on commit 27edb83

Please sign in to comment.