Skip to content

Commit

Permalink
Merge branch 'master' into tsvb-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Apr 7, 2020
2 parents 633e0e0 + 5e1708f commit ef41763
Show file tree
Hide file tree
Showing 331 changed files with 41,436 additions and 20,233 deletions.
31 changes: 5 additions & 26 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,29 +552,6 @@ module.exports = {
},
},

/**
* Graph overrides
*/
{
files: ['x-pack/legacy/plugins/graph/**/*.js'],
globals: {
angular: true,
$: true,
},
rules: {
'block-scoped-var': 'off',
camelcase: 'off',
eqeqeq: 'off',
'guard-for-in': 'off',
'new-cap': 'off',
'no-loop-func': 'off',
'no-redeclare': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'one-var': 'off',
},
},

/**
* ML overrides
*/
Expand Down Expand Up @@ -771,7 +748,7 @@ module.exports = {
* Lens overrides
*/
{
files: ['x-pack/legacy/plugins/lens/**/*.ts', 'x-pack/legacy/plugins/lens/**/*.tsx'],
files: ['x-pack/legacy/plugins/lens/**/*.{ts,tsx}', 'x-pack/plugins/lens/**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
},
Expand Down Expand Up @@ -885,8 +862,10 @@ module.exports = {
* TSVB overrides
*/
{
files: ['src/legacy/core_plugins/metrics/**/*.js'],
excludedFiles: 'src/legacy/core_plugins/metrics/index.js',
files: [
'src/plugins/vis_type_timeseries/**/*.{js,ts,tsx}',
'src/legacy/core_plugins/vis_type_timeseries/**/*.{js,ts,tsx}',
],
rules: {
'import/no-default-export': 'error',
},
Expand Down
Binary file added docs/apm/images/service-maps-java.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/apm/images/service-maps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions docs/apm/service-maps.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[[service-maps]]
=== Service maps

beta::[]

A service map is a real-time diagram of the interactions occurring in your application’s architecture.
It allows you to easily visualize data flow and high-level statistics, like average transaction duration,
requests per minute, errors per minute, and metrics, allowing you to quickly assess the status of your services.

Our beta offering creates two types of service maps:

* Global: All services and connections are shown.
* Service-specific: Selecting a specific service will highlight it's connections.

[role="screenshot"]
image::apm/images/service-maps.png[Example view of service maps in the APM app in Kibana]

[float]
[[visualize-your-architecture]]
=== Visualize your architecture

Select the **Service Map** tab to get started.
By default, all services and connections are shown.
Whether your onboarding a new engineer, or just trying to grasp the big picture,
click around, zoom in and out, and begin to visualize how your services are connected.

If there's a specific service that interests you, select that service to highlight its connections.
Clicking **Focus map** will refocus the map on that specific service and lock the connection highlighting.
From here, select **Service Details**, or click on the **Transaction** tab to jump to the Transaction overview.
You can also use the tabs at the top of the page to easily jump to the **Errors** or **Metrics** overview.

While it's not possible to query in service maps, it is possible to filter by environment.
This can be useful if you have two or more services, in separate environments, but with the same name.
Use the environment drop down to only see the data you're interested in, like `dev` or `production`.

[role="screenshot"]
image::apm/images/service-maps-java.png[Example view of service maps with Java highlighted in the APM app in Kibana]

[float]
[[service-maps-legend]]
=== Legend

Nodes appear on the map in one of two shapes:

* **Circle**: Instrumented services. Interior icons are based on the language of the agent used.
* **Diamond**: Databases, external, and messaging. Interior icons represent the generic type,
with specific icons for known entities, like Elasticsearch.
Type and subtype are based on `span.type`, and `span.subtype`.
2 changes: 2 additions & 0 deletions docs/apm/using-the-apm-ui.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ include::transactions.asciidoc[]

include::spans.asciidoc[]

include::service-maps.asciidoc[]

include::errors.asciidoc[]

include::metrics.asciidoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ search: {
intervalOptions: ({
display: string;
val: string;
enabled(agg: import("./search/aggs/buckets/_bucket_agg_type").IBucketAggConfig): boolean | "" | undefined;
enabled(agg: import("./search/aggs/buckets/bucket_agg_type").IBucketAggConfig): boolean | "" | undefined;
} | {
display: string;
val: string;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.4.0",
"@elastic/request-crypto": "^1.0.2",
"@elastic/request-crypto": "1.1.2",
"@elastic/ui-ace": "0.2.3",
"@hapi/good-squeeze": "5.2.1",
"@hapi/wreck": "^15.0.2",
Expand Down
8 changes: 7 additions & 1 deletion src/legacy/ui/public/new_platform/new_platform.karma_mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ const mockCoreStart = {
get: sinon.fake.returns(''),
},
},
notifications: {
toasts: {},
},
i18n: {},
overlays: {},
savedObjects: {
Expand Down Expand Up @@ -164,8 +167,11 @@ const mockAggTypesRegistry = () => {
const registrySetup = registry.setup();
const aggTypes = getAggTypes({
uiSettings: mockCoreSetup.uiSettings,
notifications: mockCoreStart.notifications,
query: querySetup,
getInternalStartServices: () => ({
fieldFormats: getFieldFormatsRegistry(mockCoreStart),
notifications: mockCoreStart.notifications,
}),
});
aggTypes.buckets.forEach(type => registrySetup.registerBucket(type));
aggTypes.metrics.forEach(type => registrySetup.registerMetric(type));
Expand Down
17 changes: 4 additions & 13 deletions src/plugins/data/common/field_formats/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,14 @@
* under the License.
*/

import { FieldFormat, IFieldFormatsRegistry } from '.';

const fieldFormatMock = ({
convert: jest.fn(),
getConverterFor: jest.fn(),
getParamDefaults: jest.fn(),
param: jest.fn(),
params: jest.fn(),
toJSON: jest.fn(),
type: jest.fn(),
setupContentType: jest.fn(),
} as unknown) as FieldFormat;
import { IFieldFormatsRegistry } from '.';

export const fieldFormatsMock: IFieldFormatsRegistry = {
getByFieldType: jest.fn(),
getDefaultConfig: jest.fn(),
getDefaultInstance: jest.fn().mockImplementation(() => fieldFormatMock) as any,
getDefaultInstance: jest.fn().mockImplementation(() => ({
getConverterFor: jest.fn().mockImplementation(() => (t: string) => t),
})) as any,
getDefaultInstanceCacheResolver: jest.fn(),
getDefaultInstancePlain: jest.fn(),
getDefaultType: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,25 @@
* under the License.
*/

declare module '@elastic/node-crypto';
import { FieldFormatsStart, FieldFormatsSetup, FieldFormatsService } from '.';
import { fieldFormatsMock } from '../../common/field_formats/mocks';

type FieldFormatsServiceClientContract = PublicMethodsOf<FieldFormatsService>;

const createSetupContractMock = () => fieldFormatsMock as FieldFormatsSetup;
const createStartContractMock = () => fieldFormatsMock as FieldFormatsStart;

const createMock = () => {
const mocked: jest.Mocked<FieldFormatsServiceClientContract> = {
setup: jest.fn().mockReturnValue(createSetupContractMock()),
start: jest.fn().mockReturnValue(createStartContractMock()),
};

return mocked;
};

export const fieldFormatsServiceMock = {
create: createMock,
createSetupContract: createSetupContractMock,
createStartContract: createStartContractMock,
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class IndexPatternsApiClient {
query,
})
.catch((resp: any) => {
if (resp.body.statusCode === 404 && resp.body.statuscode === 'no_matching_indices') {
if (resp.body.statusCode === 404 && resp.body.attributes?.code === 'no_matching_indices') {
throw new IndexPatternMissingIndices(resp.body.message);
}

Expand Down
8 changes: 4 additions & 4 deletions src/plugins/data/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
* under the License.
*/

import { Plugin, DataPublicPluginSetup, DataPublicPluginStart, IndexPatternsContract } from '.';
import { fieldFormatsMock } from '../common/field_formats/mocks';
import { Plugin, IndexPatternsContract } from '.';
import { fieldFormatsServiceMock } from './field_formats/mocks';
import { searchSetupMock, searchStartMock } from './search/mocks';
import { queryServiceMock } from './query/mocks';

Expand All @@ -36,7 +36,7 @@ const createSetupContract = (): Setup => {
return {
autocomplete: autocompleteMock,
search: searchSetupMock,
fieldFormats: fieldFormatsMock as DataPublicPluginSetup['fieldFormats'],
fieldFormats: fieldFormatsServiceMock.createSetupContract(),
query: querySetupMock,
};
};
Expand All @@ -49,7 +49,7 @@ const createStartContract = (): Start => {
},
autocomplete: autocompleteMock,
search: searchStartMock,
fieldFormats: fieldFormatsMock as DataPublicPluginStart['fieldFormats'],
fieldFormats: fieldFormatsServiceMock.createStartContract(),
query: queryStartMock,
ui: {
IndexPatternSelect: jest.fn(),
Expand Down
9 changes: 9 additions & 0 deletions src/plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
DataPublicPluginStart,
DataSetupDependencies,
DataStartDependencies,
GetInternalStartServicesFn,
} from './types';
import { AutocompleteService } from './autocomplete';
import { SearchService } from './search/search_service';
Expand All @@ -47,6 +48,8 @@ import {
setQueryService,
setSearchService,
setUiSettings,
getFieldFormats,
getNotifications,
} from './services';
import { createSearchBar } from './ui/search_bar/create_search_bar';
import { esaggs } from './search/expressions';
Expand Down Expand Up @@ -100,6 +103,11 @@ export class DataPublicPlugin implements Plugin<DataPublicPluginSetup, DataPubli

expressions.registerFunction(esaggs);

const getInternalStartServices: GetInternalStartServicesFn = () => ({
fieldFormats: getFieldFormats(),
notifications: getNotifications(),
});

const queryService = this.queryService.setup({
uiSettings: core.uiSettings,
storage: this.storage,
Expand All @@ -122,6 +130,7 @@ export class DataPublicPlugin implements Plugin<DataPublicPluginSetup, DataPubli
return {
autocomplete: this.autocomplete.setup(core),
search: this.searchService.setup(core, {
getInternalStartServices,
packageInfo: this.packageInfo,
query: queryService,
}),
Expand Down
20 changes: 10 additions & 10 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Assign } from '@kbn/utility-types';
import { Breadcrumb } from '@elastic/eui';
import { Component } from 'react';
import { CoreSetup } from 'src/core/public';
import { CoreStart } from 'kibana/public';
import { CoreStart as CoreStart_2 } from 'src/core/public';
import { CoreStart } from 'src/core/public';
import { CoreStart as CoreStart_2 } from 'kibana/public';
import { EuiButtonEmptyProps } from '@elastic/eui';
import { EuiComboBoxProps } from '@elastic/eui';
import { EuiConfirmModalProps } from '@elastic/eui';
Expand Down Expand Up @@ -632,21 +632,21 @@ export type IAggType = AggType;
// Warning: (ae-missing-release-tag) "IDataPluginServices" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface IDataPluginServices extends Partial<CoreStart_2> {
export interface IDataPluginServices extends Partial<CoreStart> {
// (undocumented)
appName: string;
// (undocumented)
data: DataPublicPluginStart;
// (undocumented)
http: CoreStart_2['http'];
http: CoreStart['http'];
// (undocumented)
notifications: CoreStart_2['notifications'];
notifications: CoreStart['notifications'];
// (undocumented)
savedObjects: CoreStart_2['savedObjects'];
savedObjects: CoreStart['savedObjects'];
// (undocumented)
storage: IStorageWrapper;
// (undocumented)
uiSettings: CoreStart_2['uiSettings'];
uiSettings: CoreStart['uiSettings'];
}

// Warning: (ae-missing-release-tag) "IEsSearchRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Expand Down Expand Up @@ -1094,7 +1094,7 @@ export type ISearch<T extends TStrategyTypes = typeof DEFAULT_SEARCH_STRATEGY> =
// @public (undocumented)
export interface ISearchContext {
// (undocumented)
core: CoreStart;
core: CoreStart_2;
// (undocumented)
getSearchStrategy: <T extends TStrategyTypes>(name: T) => TSearchStrategyProvider<T>;
}
Expand Down Expand Up @@ -1307,7 +1307,7 @@ export class Plugin implements Plugin_2<DataPublicPluginSetup, DataPublicPluginS
// Warning: (ae-forgotten-export) The symbol "DataStartDependencies" needs to be exported by the entry point index.d.ts
//
// (undocumented)
start(core: CoreStart_2, { uiActions }: DataStartDependencies): DataPublicPluginStart;
start(core: CoreStart, { uiActions }: DataStartDependencies): DataPublicPluginStart;
// (undocumented)
stop(): void;
}
Expand Down Expand Up @@ -1533,7 +1533,7 @@ export const search: {
intervalOptions: ({
display: string;
val: string;
enabled(agg: import("./search/aggs/buckets/_bucket_agg_type").IBucketAggConfig): boolean | "" | undefined;
enabled(agg: import("./search/aggs/buckets/bucket_agg_type").IBucketAggConfig): boolean | "" | undefined;
} | {
display: string;
val: string;
Expand Down
15 changes: 0 additions & 15 deletions src/plugins/data/public/search/aggs/agg_config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import { AggTypesRegistryStart } from './agg_types_registry';
import { mockDataServices, mockAggTypesRegistry } from './test_helpers';
import { Field as IndexPatternField, IndexPattern } from '../../index_patterns';
import { stubIndexPatternWithFields } from '../../../public/stubs';
import { dataPluginMock } from '../../../public/mocks';
import { setFieldFormats } from '../../../public/services';

describe('AggConfig', () => {
let indexPattern: IndexPattern;
Expand Down Expand Up @@ -400,13 +398,6 @@ describe('AggConfig', () => {

describe('#fieldFormatter - custom getFormat handler', () => {
it('returns formatter from getFormat handler', () => {
setFieldFormats({
...dataPluginMock.createStartContract().fieldFormats,
getDefaultInstance: jest.fn().mockImplementation(() => ({
getConverterFor: jest.fn().mockImplementation(() => (t: string) => t),
})) as any,
});

const ac = new AggConfigs(indexPattern, [], { typesRegistry });
const configStates = {
enabled: true,
Expand All @@ -429,12 +420,6 @@ describe('AggConfig', () => {
let aggConfig: AggConfig;

beforeEach(() => {
setFieldFormats({
...dataPluginMock.createStartContract().fieldFormats,
getDefaultInstance: jest.fn().mockImplementation(() => ({
getConverterFor: (t?: string) => t || identity,
})) as any,
});
indexPattern.fields.getByName = name =>
({
format: {
Expand Down
Loading

0 comments on commit ef41763

Please sign in to comment.