[Obs UX] Enable Synthetics on Serverless (#171339)

## Summary

Resolves https://github.com/elastic/synthetics-dev/issues/290.

~Creating this PR as a place to experiment with Synthetics running
against the Serverless platform. Main goals are to find areas of the
codebase that require revision and get as much of Synthetics functioning
as possible without access to public locations.~

This adds the necessary config and other features to make Synthetics
workable as part of the oblt serverless project. Notably, we aren't
including the `xpack.uptime.enabled` flag here, because we are not ready
to expose the plugin to production users yet. We're going to enable the
plugin on a per-env basis using other means to start, and when we are
ready to expose the plugin generally in prod, we will add that flag.

Also adds nav and fixes a few other things that were broken for
serverless specifically.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces—unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes—Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
Justin Kambic 2024-01-18 12:09:40 -05:00 committed by GitHub
parent 98960f2eb3
commit b8cad98b08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 61 additions and 8 deletions

View file

@ -34,6 +34,10 @@ xpack.observability.createO11yGenericFeatureId: true
## APM Serverless Onboarding flow
xpack.apm.serverlessOnboarding: true
# Synthetics mTLS cert locations
xpack.uptime.service.tls.certificate: /mnt/elastic-internal/http-certs/tls.crt
xpack.uptime.service.tls.key: /mnt/elastic-internal/http-certs/tls.key
# Fleet specific configuration
xpack.fleet.internal.registry.capabilities: ['apm', 'observability']
xpack.fleet.internal.registry.kibanaVersionCheckEnabled: false
@ -46,10 +50,6 @@ xpack.fleet.internal.registry.excludePackages: [
'beaconing',
'osquery_manager',
# synthetics is not enabled yet
'synthetics',
'synthetics_dashboards',
# Removed in 8.11 integrations
'cisco',
'microsoft',

View file

@ -16,4 +16,6 @@ export const METRICS_APP_ID = 'metrics';
export const APM_APP_ID = 'apm';
export const SYNTHETICS_APP_ID = 'synthetics';
export const OBSERVABILITY_ONBOARDING_APP_ID = 'observabilityOnboarding';

View file

@ -13,6 +13,7 @@ import {
OBSERVABILITY_LOG_EXPLORER_APP_ID,
OBSERVABILITY_ONBOARDING_APP_ID,
OBSERVABILITY_OVERVIEW_APP_ID,
SYNTHETICS_APP_ID,
} from './constants';
type LogsApp = typeof LOGS_APP_ID;
@ -20,6 +21,7 @@ type ObservabilityLogExplorerApp = typeof OBSERVABILITY_LOG_EXPLORER_APP_ID;
type ObservabilityOverviewApp = typeof OBSERVABILITY_OVERVIEW_APP_ID;
type MetricsApp = typeof METRICS_APP_ID;
type ApmApp = typeof APM_APP_ID;
type SyntheticsApp = typeof SYNTHETICS_APP_ID;
type ObservabilityOnboardingApp = typeof OBSERVABILITY_ONBOARDING_APP_ID;
export type AppId =
@ -28,7 +30,8 @@ export type AppId =
| ObservabilityOverviewApp
| ObservabilityOnboardingApp
| ApmApp
| MetricsApp;
| MetricsApp
| SyntheticsApp;
export type LogsLinkId = 'log-categories' | 'settings' | 'anomalies' | 'stream';
@ -51,11 +54,19 @@ export type ApmLinkId =
| 'settings'
| 'storage-explorer';
export type LinkId = LogsLinkId | ObservabilityOverviewLinkId | MetricsLinkId | ApmLinkId;
export type SyntheticsLinkId = 'overview' | 'management';
export type LinkId =
| LogsLinkId
| ObservabilityOverviewLinkId
| MetricsLinkId
| ApmLinkId
| SyntheticsLinkId;
export type DeepLinkId =
| AppId
| `${LogsApp}:${LogsLinkId}`
| `${ObservabilityOverviewApp}:${ObservabilityOverviewLinkId}`
| `${MetricsApp}:${MetricsLinkId}`
| `${ApmApp}:${ApmLinkId}`;
| `${ApmApp}:${ApmLinkId}`
| `${SyntheticsApp}:${SyntheticsLinkId}`;

View file

@ -178,6 +178,27 @@ export const navigationTree: NavigationTreeDefinition = {
},
],
},
{
id: 'synthetics',
title: i18n.translate('xpack.serverlessObservability.nav.synthetics', {
defaultMessage: 'Synthetics',
}),
renderAs: 'accordion',
children: [
{
link: 'synthetics:overview',
getIsActive: ({ pathNameSerialized, prepend }) => {
return pathNameSerialized.startsWith(prepend('/app/synthetics'));
},
},
{
link: 'synthetics:management',
getIsActive: ({ pathNameSerialized, prepend }) => {
return pathNameSerialized.startsWith(prepend('/app/synthetics/monitors'));
},
},
],
},
],
},
],

View file

@ -99,6 +99,7 @@ export async function getJourneyScreenshot(
let backoff = initialBackoff;
while (response?.status !== 200) {
const imgRequest = new Request(imgSrc);
imgRequest.headers.set('x-elastic-internal-origin', 'Kibana');
if (retryCount > maxRetry) break;

View file

@ -11,6 +11,7 @@ import {
Plugin,
PluginInitializerContext,
AppMountParameters,
AppNavLinkStatus,
} from '@kbn/core/public';
import { from } from 'rxjs';
import { map } from 'rxjs/operators';
@ -146,7 +147,24 @@ export class UptimePlugin
title: PLUGIN.SYNTHETICS,
category: DEFAULT_APP_CATEGORIES.observability,
keywords: appKeywords,
deepLinks: [],
deepLinks: [
{
id: 'overview',
title: i18n.translate('xpack.synthetics.overviewPage.linkText', {
defaultMessage: 'Overview',
}),
path: '/',
navLinkStatus: AppNavLinkStatus.visible,
},
{
id: 'management',
title: i18n.translate('xpack.synthetics.managementPage.linkText', {
defaultMessage: 'Management',
}),
path: '/monitors',
navLinkStatus: AppNavLinkStatus.visible,
},
],
mount: async (params: AppMountParameters) => {
const [coreStart, corePlugins] = await core.getStartServices();