Skip to content

Commit

Permalink
Merge branch 'master' into client-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Jun 18, 2020
2 parents 1b8ef95 + f27162a commit a0a7a44
Show file tree
Hide file tree
Showing 111 changed files with 4,875 additions and 3,323 deletions.
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@
"@kbn/test-subj-selector": "0.2.1",
"@kbn/ui-framework": "1.0.0",
"@kbn/ui-shared-deps": "1.0.0",
"@types/tar": "^4.0.3",
"JSONStream": "1.3.5",
"abortcontroller-polyfill": "^1.4.0",
"accept": "3.0.2",
Expand Down Expand Up @@ -390,9 +389,10 @@
"@types/styled-components": "^5.1.0",
"@types/supertest": "^2.0.5",
"@types/supertest-as-promised": "^2.0.38",
"@types/tar": "^4.0.3",
"@types/testing-library__dom": "^6.10.0",
"@types/testing-library__react": "^9.1.2",
"@types/testing-library__react-hooks": "^3.1.0",
"@types/testing-library__dom": "^6.10.0",
"@types/type-detect": "^4.0.1",
"@types/uuid": "^3.4.4",
"@types/vinyl-fs": "^2.4.11",
Expand Down Expand Up @@ -486,12 +486,10 @@
"prettier": "^2.0.5",
"proxyquire": "1.8.0",
"react-popper-tooltip": "^2.10.1",
"react-textarea-autosize": "^7.1.2",
"regenerate": "^1.4.0",
"sass-lint": "^1.12.1",
"selenium-webdriver": "^4.0.0-alpha.7",
"simple-git": "1.116.0",
"simplebar-react": "^2.1.0",
"sinon": "^7.4.2",
"strip-ansi": "^3.0.1",
"supertest": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ kibana_vars=(
xpack.security.session.lifespan
xpack.security.loginAssistanceMessage
xpack.security.loginHelp
xpack.spaces.enabled
xpack.spaces.maxSpaces
telemetry.allowChangingOptInStatus
telemetry.enabled
telemetry.optIn
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/dashboard/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export {
export { DashboardConstants, createDashboardEditUrl } from './dashboard_constants';

export { DashboardStart, DashboardUrlGenerator } from './plugin';
export { DASHBOARD_APP_URL_GENERATOR } from './url_generator';
export { DASHBOARD_APP_URL_GENERATOR, createDashboardUrlGenerator } from './url_generator';
export { addEmbeddableToDashboardUrl } from './url_utils/url_helper';
export { SavedObjectDashboard } from './saved_dashboards';
export { SavedDashboardPanel } from './types';

export function plugin(initializerContext: PluginInitializerContext) {
return new DashboardPlugin(initializerContext);
Expand Down
7 changes: 7 additions & 0 deletions src/plugins/dashboard/public/url_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
import { setStateToKbnUrl } from '../../kibana_utils/public';
import { UrlGeneratorsDefinition, UrlGeneratorState } from '../../share/public';
import { SavedObjectLoader } from '../../saved_objects/public';
import { ViewMode } from '../../embeddable/public';

export const STATE_STORAGE_KEY = '_a';
export const GLOBAL_STATE_STORAGE_KEY = '_g';
Expand Down Expand Up @@ -73,6 +74,11 @@ export type DashboardAppLinkGeneratorState = UrlGeneratorState<{
* true is default
*/
preserveSavedFilters?: boolean;

/**
* View mode of the dashboard.
*/
viewMode?: ViewMode;
}>;

export const createDashboardUrlGenerator = (
Expand Down Expand Up @@ -123,6 +129,7 @@ export const createDashboardUrlGenerator = (
cleanEmptyKeys({
query: state.query,
filters: filters?.filter((f) => !esFilters.isFilterPinned(f)),
viewMode: state.viewMode,
}),
{ useHash },
`${appBasePath}#/${hash}`
Expand Down
3 changes: 3 additions & 0 deletions test/accessibility/services/a11y/a11y.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ export function A11yProvider({ getService }: FtrProviderContext) {
'color-contrast': {
enabled: false,
},
bypass: {
enabled: false, // disabled because it's too flaky
},
},
};

Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/dashboard/dashboard_snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default function ({ getService, getPageObjects, updateBaselines }) {
const dashboardPanelActions = getService('dashboardPanelActions');
const dashboardAddPanel = getService('dashboardAddPanel');

describe('dashboard snapshots', function describeIndexTests() {
// FLAKY: https://github.com/elastic/kibana/issues/52854
describe.skip('dashboard snapshots', function describeIndexTests() {
before(async function () {
await esArchiver.load('dashboard/current/kibana');
await kibanaServer.uiSettings.replace({
Expand Down
2 changes: 1 addition & 1 deletion vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def withGcsArtifactUpload(workerName, closure) {
def uploadPrefix = "kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/${workerName}"
def ARTIFACT_PATTERNS = [
'target/kibana-*',
'target/kibana-siem/**/*.png',
'target/kibana-security-solution/**/*.png',
'target/junit/**/*',
'test/**/screenshots/**/*.png',
'test/functional/failure_debug/html/*.html',
Expand Down
1 change: 1 addition & 0 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@types/d3-shape": "^1.3.1",
"@types/d3-time": "^1.0.10",
"@types/d3-time-format": "^2.1.1",
"@types/dragselect": "^1.13.1",
"@types/elasticsearch": "^5.0.33",
"@types/fancy-log": "^1.3.1",
"@types/file-saver": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
import {
EuiFlexGroup,
EuiFlexItem,
EuiTitle,
EuiButtonEmpty,
} from '@elastic/eui';
import React from 'react';
import { i18n } from '@kbn/i18n';
import { ApmHeader } from '../../shared/ApmHeader';
import { ServiceDetailTabs } from './ServiceDetailTabs';
import { ServiceIntegrations } from './ServiceIntegrations';
Expand Down Expand Up @@ -33,6 +39,12 @@ export function ServiceDetails({ tab }: Props) {
const isAlertingAvailable =
isAlertingPluginEnabled && (canReadAlerts || canSaveAlerts);

const { core } = useApmPluginContext();

const ADD_DATA_LABEL = i18n.translate('xpack.apm.addDataButtonLabel', {
defaultMessage: 'Add data',
});

return (
<div>
<ApmHeader>
Expand All @@ -53,6 +65,16 @@ export function ServiceDetails({ tab }: Props) {
/>
</EuiFlexItem>
)}
<EuiFlexItem grow={false}>
<EuiButtonEmpty
href={core.http.basePath.prepend('/app/home#/tutorial/apm')}
size="s"
color="primary"
iconType="plusInCircle"
>
{ADD_DATA_LABEL}
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
</ApmHeader>

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ import { useApmPluginContext } from '../../../hooks/useApmPluginContext';
const SETUP_INSTRUCTIONS_LABEL = i18n.translate(
'xpack.apm.setupInstructionsButtonLabel',
{
defaultMessage: 'Setup Instructions',
defaultMessage: 'Setup instructions',
}
);

const ADD_DATA_LABEL = i18n.translate('xpack.apm.addDataButtonLabel', {
defaultMessage: 'Add data',
});

// renders a filled button or a link as a kibana link to setup instructions
export function SetupInstructionsLink({
buttonFill = false,
Expand All @@ -30,8 +34,8 @@ export function SetupInstructionsLink({
{SETUP_INSTRUCTIONS_LABEL}
</EuiButton>
) : (
<EuiButtonEmpty size="s" color="primary" iconType="help">
{SETUP_INSTRUCTIONS_LABEL}
<EuiButtonEmpty size="s" color="primary" iconType="plusInCircle">
{ADD_DATA_LABEL}
</EuiButtonEmpty>
)}
</EuiLink>
Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/apm/server/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ export const APM_FEATURE = {
},
},
};

export const APM_SERVICE_MAPS_FEATURE_NAME = 'APM service maps';
export const APM_SERVICE_MAPS_LICENSE_TYPE = 'platinum';
39 changes: 28 additions & 11 deletions x-pack/plugins/apm/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { Observable, combineLatest } from 'rxjs';
import { map, take } from 'rxjs/operators';
import { ObservabilityPluginSetup } from '../../observability/server';
import { SecurityPluginSetup } from '../../security/public';
import { SecurityPluginSetup } from '../../security/server';
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/server';
import { TaskManagerSetupContract } from '../../task_manager/server';
import { AlertingPlugin } from '../../alerts/server';
Expand All @@ -28,11 +28,19 @@ import { APMConfig, mergeConfigs, APMXPackConfig } from '.';
import { HomeServerPluginSetup } from '../../../../src/plugins/home/server';
import { CloudSetup } from '../../cloud/server';
import { getInternalSavedObjectsClient } from './lib/helpers/get_internal_saved_objects_client';
import { LicensingPluginSetup } from '../../licensing/public';
import {
LicensingPluginSetup,
LicensingPluginStart,
} from '../../licensing/server';
import { registerApmAlerts } from './lib/alerts/register_apm_alerts';
import { createApmTelemetry } from './lib/apm_telemetry';

import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
import { APM_FEATURE } from './feature';
import {
APM_FEATURE,
APM_SERVICE_MAPS_FEATURE_NAME,
APM_SERVICE_MAPS_LICENSE_TYPE,
} from './feature';
import { apmIndices, apmTelemetry } from './saved_objects';
import { createElasticCloudInstructions } from './tutorial/elastic_cloud';
import { MlPluginSetup } from '../../ml/server';
Expand Down Expand Up @@ -120,16 +128,25 @@ export class APMPlugin implements Plugin<APMPluginSetup> {
elasticCloud: createElasticCloudInstructions(plugins.cloud),
};
});

plugins.features.registerFeature(APM_FEATURE);
plugins.licensing.featureUsage.register(
APM_SERVICE_MAPS_FEATURE_NAME,
APM_SERVICE_MAPS_LICENSE_TYPE
);

createApmApi().init(core, {
config$: mergedConfig$,
logger: this.logger!,
plugins: {
observability: plugins.observability,
security: plugins.security,
ml: plugins.ml,
},
core.getStartServices().then(([_coreStart, pluginsStart]) => {
createApmApi().init(core, {
config$: mergedConfig$,
logger: this.logger!,
plugins: {
licensing: (pluginsStart as { licensing: LicensingPluginStart })
.licensing,
observability: plugins.observability,
security: plugins.security,
ml: plugins.ml,
},
});
});

return {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/apm/server/routes/create_api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { CoreSetup, Logger } from 'src/core/server';
import { Params } from '../typings';
import { BehaviorSubject } from 'rxjs';
import { APMConfig } from '../..';
import { LicensingPluginStart } from '../../../../licensing/server';

const getCoreMock = () => {
const get = jest.fn();
Expand Down Expand Up @@ -40,7 +41,7 @@ const getCoreMock = () => {
logger: ({
error: jest.fn(),
} as unknown) as Logger,
plugins: {},
plugins: { licensing: {} as LicensingPluginStart },
},
};
};
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/apm/server/routes/service_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getServiceMap } from '../lib/service_map/get_service_map';
import { getServiceMapServiceNodeInfo } from '../lib/service_map/get_service_map_service_node_info';
import { createRoute } from './create_route';
import { rangeRt } from './default_api_types';
import { APM_SERVICE_MAPS_FEATURE_NAME } from '../feature';

export const serviceMapRoute = createRoute(() => ({
path: '/api/apm/service-map',
Expand All @@ -35,6 +36,10 @@ export const serviceMapRoute = createRoute(() => ({
throw Boom.forbidden(invalidLicenseMessage);
}

context.plugins.licensing.featureUsage.notifyUsage(
APM_SERVICE_MAPS_FEATURE_NAME
);

const setup = await setupRequest(context, request);
const {
query: { serviceName, environment },
Expand Down
5 changes: 4 additions & 1 deletion x-pack/plugins/apm/server/routes/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import {
import { PickByValue, Optional } from 'utility-types';
import { Observable } from 'rxjs';
import { Server } from 'hapi';
import { LicensingPluginStart } from '../../../licensing/server';
import { ObservabilityPluginSetup } from '../../../observability/server';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { FetchOptions } from '../../public/services/rest/callApi';
import { SecurityPluginSetup } from '../../../security/public';
import { SecurityPluginSetup } from '../../../security/server';
import { MlPluginSetup } from '../../../ml/server';
import { APMConfig } from '..';

Expand Down Expand Up @@ -66,6 +67,7 @@ export type APMRequestHandlerContext<
config: APMConfig;
logger: Logger;
plugins: {
licensing: LicensingPluginStart;
observability?: ObservabilityPluginSetup;
security?: SecurityPluginSetup;
ml?: MlPluginSetup;
Expand Down Expand Up @@ -114,6 +116,7 @@ export interface ServerAPI<TRouteState extends RouteState> {
config$: Observable<APMConfig>;
logger: Logger;
plugins: {
licensing: LicensingPluginStart;
observability?: ObservabilityPluginSetup;
security?: SecurityPluginSetup;
ml?: MlPluginSetup;
Expand Down
18 changes: 17 additions & 1 deletion x-pack/plugins/infra/public/pages/logs/page_content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { Route, Switch } from 'react-router-dom';
Expand Down Expand Up @@ -32,6 +32,8 @@ export const LogsPageContent: React.FunctionComponent = () => {

const { initialize } = useLogSourceContext();

const kibana = useKibana();

useMount(() => {
initialize();
});
Expand Down Expand Up @@ -88,6 +90,16 @@ export const LogsPageContent: React.FunctionComponent = () => {
<EuiFlexItem grow={false}>
<AlertDropdown />
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
href={kibana.services?.application?.getUrlForApp('/home#/tutorial_directory/logging')}
size="s"
color="primary"
iconType="plusInCircle"
>
{ADD_DATA_LABEL}
</EuiButtonEmpty>
</EuiFlexItem>
</EuiFlexGroup>
</AppNavigation>
<Switch>
Expand Down Expand Up @@ -123,3 +135,7 @@ const settingsTabTitle = i18n.translate('xpack.infra.logs.index.settingsTabTitle
});

const feedbackLinkUrl = 'https://discuss.elastic.co/c/logs';

const ADD_DATA_LABEL = i18n.translate('xpack.infra.logsHeaderAddDataButtonLabel', {
defaultMessage: 'Add data',
});
Loading

0 comments on commit a0a7a44

Please sign in to comment.