Skip to content

Commit

Permalink
Merge branch 'master' into fix-monitoring-types
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed Apr 2, 2020
2 parents 08e77d8 + a729b3b commit f7e7cd0
Show file tree
Hide file tree
Showing 118 changed files with 1,391 additions and 1,110 deletions.
9 changes: 0 additions & 9 deletions .github/paths-labeller.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
---
- "Team:AppArch":
- "src/plugins/bfetch/**/*.*"
- "src/plugins/dashboard_embeddable_container/**/*.*"
- "src/plugins/data/**/*.*"
- "src/plugins/embeddable/**/*.*"
- "src/plugins/expressions/**/*.*"
- "src/plugins/inspector/**/*.*"
- "src/plugins/ui_actions/**/*.*"
- "src/plugins/visualizations/**/*.*"
- "Feature:Embedding":
- "src/plugins/embeddable/**/*.*"
- "src/plugins/dashboard_embeddable_container/**/*.*"
Expand Down
9 changes: 9 additions & 0 deletions docs/migration/migrate_8_0.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,13 @@ access level.
been deprecated with warnings that have been logged throughout 7.x. Please use Kibana UI to re-generate the
POST URL snippets if you depend on these for automated PDF reports.

[float]
=== Configurations starting with `xpack.telemetry` are no longer valid

*Details:*
The `xpack.` prefix has been removed for all telemetry configurations.

*Impact:*
For any configurations beginning with `xpack.telemetry`, remove the `xpack` prefix. Use {kibana-ref}/telemetry-settings-kbn.html#telemetry-general-settings[`telemetry.enabled`] instead.

// end::notable-breaking-changes[]
38 changes: 38 additions & 0 deletions docs/settings/telemetry-settings.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[[telemetry-settings-kbn]]
=== Telemetry settings in Kibana
++++
<titleabbrev>Telemetry settings</titleabbrev>
++++

By default, Usage Collection (also known as Telemetry) is enabled. This
helps us learn about the {kib} features that our users are most interested in, so we
can focus our efforts on making them even better.

You can control whether this data is sent from the {kib} servers, or if it should be sent
from the user's browser, in case a firewall is blocking the connections from the server. Additionally, you can decide to completely disable this feature either in the config file or in {kib} via *Management > Kibana > Advanced Settings > Usage Data*.

See our https://www.elastic.co/legal/privacy-statement[Privacy Statement] to learn more.

[float]
[[telemetry-general-settings]]
==== General telemetry settings

`telemetry.enabled`:: *Default: true*.
Set to `true` to send cluster statistics to Elastic. Reporting your
cluster statistics helps us improve your user experience. Your data is never
shared with anyone. Set to `false` to disable statistics reporting from any
browser connected to the {kib} instance.

`telemetry.sendUsageFrom`:: *Default: 'browser'*.
Set to `'server'` to report the cluster statistics from the {kib} server.
If the server fails to connect to our endpoint at https://telemetry.elastic.co/, it assumes
it is behind a firewall and falls back to `'browser'` to send it from users' browsers
when they are navigating through {kib}.

`telemetry.optIn`:: *Default: true*.
Set to `true` to automatically opt into reporting cluster statistics. You can also opt out through
*Advanced Settings* in {kib}.

`telemetry.allowChangingOptInStatus`:: *Default: true*.
Set to `true` to allow overwriting the `telemetry.optIn` setting via the {kib} UI.
Note: When `false`, `telemetry.optIn` must be `true`. To disable telemetry and not allow users to change that parameter, use `telemetry.enabled`.
1 change: 1 addition & 0 deletions docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,4 @@ include::{docdir}/settings/reporting-settings.asciidoc[]
include::secure-settings.asciidoc[]
include::{docdir}/settings/security-settings.asciidoc[]
include::{docdir}/settings/spaces-settings.asciidoc[]
include::{docdir}/settings/telemetry-settings.asciidoc[]
1 change: 0 additions & 1 deletion kibana.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import * as LegacyKibanaServer from './src/legacy/server/kbn_server';
*/
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace Legacy {
export type IndexPatternsService = LegacyKibanaServer.IndexPatternsService;
export type KibanaConfig = LegacyKibanaServer.KibanaConfig;
export type Request = LegacyKibanaServer.Request;
export type ResponseToolkit = LegacyKibanaServer.ResponseToolkit;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"babel-plugin-istanbul": "^5.2.0",
"backport": "5.1.2",
"backport": "5.1.3",
"chai": "3.5.0",
"chance": "1.0.18",
"cheerio": "0.22.0",
Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions src/core/server/config/deprecation/core_deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,6 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
renameFromRoot('optimize.lazyHost', 'optimize.watchHost'),
renameFromRoot('optimize.lazyPrebuild', 'optimize.watchPrebuild'),
renameFromRoot('optimize.lazyProxyTimeout', 'optimize.watchProxyTimeout'),
renameFromRoot('xpack.xpack_main.telemetry.config', 'telemetry.config'),
renameFromRoot('xpack.xpack_main.telemetry.url', 'telemetry.url'),
renameFromRoot('xpack.xpack_main.telemetry.enabled', 'telemetry.enabled'),
renameFromRoot('xpack.telemetry.enabled', 'telemetry.enabled'),
renameFromRoot('xpack.telemetry.config', 'telemetry.config'),
renameFromRoot('xpack.telemetry.banner', 'telemetry.banner'),
renameFromRoot('xpack.telemetry.url', 'telemetry.url'),
// Monitoring renames
// TODO: Remove these from here once the monitoring plugin is migrated to NP
renameFromRoot('xpack.monitoring.enabled', 'monitoring.enabled'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { IAggConfigs, IAggConfig } from 'src/plugins/data/public';
import { DefaultEditorAggGroup, DefaultEditorAggGroupProps } from './agg_group';
import { DefaultEditorAgg } from './agg';
import { DefaultEditorAggAdd } from './agg_add';
import { Schema } from '../schemas';
import { ISchemas, Schemas } from '../schemas';
import { EditorVisState } from './sidebar/state/reducers';

jest.mock('@elastic/eui', () => ({
Expand All @@ -47,6 +47,7 @@ jest.mock('./agg_add', () => ({
describe('DefaultEditorAgg component', () => {
let defaultProps: DefaultEditorAggGroupProps;
let aggs: IAggConfigs;
let schemas: ISchemas;
let setTouched: jest.Mock;
let setValidity: jest.Mock;
let reorderAggs: jest.Mock;
Expand All @@ -55,6 +56,18 @@ describe('DefaultEditorAgg component', () => {
setTouched = jest.fn();
setValidity = jest.fn();
reorderAggs = jest.fn();
schemas = new Schemas([
{
name: 'metrics',
group: 'metrics',
max: 1,
},
{
name: 'buckets',
group: 'buckets',
max: 1,
},
]);

aggs = {
aggs: [
Expand Down Expand Up @@ -95,18 +108,7 @@ describe('DefaultEditorAgg component', () => {
state: {
data: { aggs },
} as EditorVisState,
schemas: [
{
name: 'metrics',
group: 'metrics',
max: 1,
} as Schema,
{
name: 'buckets',
group: 'buckets',
max: 1,
} as Schema,
],
schemas: schemas.metrics,
setTouched,
setValidity,
reorderAggs,
Expand All @@ -133,6 +135,7 @@ describe('DefaultEditorAgg component', () => {

it('should last bucket has truthy isLastBucket prop', () => {
defaultProps.groupName = 'buckets';
defaultProps.schemas = schemas.buckets;
const comp = mount(<DefaultEditorAggGroup {...defaultProps} />);
const lastAgg = comp.find(DefaultEditorAgg).last();

Expand All @@ -154,6 +157,8 @@ describe('DefaultEditorAgg component', () => {

it('should show add button when schemas count is less than max', () => {
defaultProps.groupName = 'buckets';
defaultProps.schemas = schemas.buckets;
defaultProps.schemas[0].max = 2;
const comp = shallow(<DefaultEditorAggGroup {...defaultProps} />);

expect(comp.find(DefaultEditorAggAdd).exists()).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
getEnabledMetricAggsCount,
} from './agg_group_helper';
import { aggGroupReducer, initAggsState, AGGS_ACTION_KEYS } from './agg_group_state';
import { Schema, getSchemasByGroup } from '../schemas';
import { Schema } from '../schemas';
import { TimeRange } from '../../../../../plugins/data/public';

export interface DefaultEditorAggGroupProps extends DefaultEditorAggCommonProps {
Expand Down Expand Up @@ -73,7 +73,7 @@ function DefaultEditorAggGroup({
}: DefaultEditorAggGroupProps) {
const groupNameLabel = (search.aggs.aggGroupNamesMap() as any)[groupName];
// e.g. buckets can have no aggs
const schemaNames = getSchemasByGroup(schemas, groupName).map(s => s.name);
const schemaNames = schemas.map(s => s.name);
const group: IAggConfig[] = useMemo(
() =>
state.data.aggs!.aggs.filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import { DefaultEditorAggCommonProps } from '../agg_common_props';
import { SidebarTitle } from './sidebar_title';
import { PersistedState } from '../../../../../../plugins/visualizations/public';
import { SavedSearch } from '../../../../../../plugins/discover/public';
import { AggGroupNames } from '../../../../../../plugins/data/public';
import { getSchemasByGroup } from '../../schemas';
import { Schema } from '../../schemas';
import { TimeRange } from '../../../../../../plugins/data/public';

interface DefaultEditorSideBarProps {
Expand Down Expand Up @@ -66,9 +65,7 @@ function DefaultEditorSideBar({
const responseAggs = useMemo(() => (state.data.aggs ? state.data.aggs.getResponseAggs() : []), [
state.data.aggs,
]);
const metricSchemas = getSchemasByGroup(vis.type.schemas.all || [], AggGroupNames.Metrics).map(
s => s.name
);
const metricSchemas = (vis.type.schemas.metrics || []).map((s: Schema) => s.name);
const metricAggs = useMemo(
() => responseAggs.filter(agg => metricSchemas.includes(get(agg, 'schema'))),
[responseAggs, metricSchemas]
Expand Down
30 changes: 8 additions & 22 deletions src/legacy/core_plugins/vis_default_editor/public/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
* under the License.
*/

import _ from 'lodash';
import _, { defaults } from 'lodash';

import { Optional } from '@kbn/utility-types';

import { IndexedArray } from 'ui/indexed_array';
import { AggGroupNames, AggParam, IAggGroupNames } from '../../../../plugins/data/public';

export interface ISchemas {
Expand All @@ -45,9 +44,10 @@ export interface Schema {
aggSettings?: any;
}

export class Schemas {
// @ts-ignore
all: IndexedArray<Schema>;
export class Schemas implements ISchemas {
all: Schema[] = [];
[AggGroupNames.Buckets]: Schema[] = [];
[AggGroupNames.Metrics]: Schema[] = [];

constructor(
schemas: Array<
Expand All @@ -70,7 +70,7 @@ export class Schemas {
] as AggParam[];
}

_.defaults(schema, {
defaults(schema, {
min: 0,
max: Infinity,
group: AggGroupNames.Buckets,
Expand All @@ -83,22 +83,12 @@ export class Schemas {
return schema as Schema;
})
.tap((fullSchemas: Schema[]) => {
this.all = new IndexedArray({
index: ['name'],
group: ['group'],
immutable: true,
initialSet: fullSchemas,
});
this.all = fullSchemas;
})
.groupBy('group')
.forOwn((group, groupName) => {
// @ts-ignore
this[groupName] = new IndexedArray({
index: ['name'],
immutable: true,
// @ts-ignore
initialSet: group,
});
this[groupName] = group;
})
.commit();
}
Expand All @@ -107,7 +97,3 @@ export class Schemas {
export const getSchemaByName = (schemas: Schema[], schemaName?: string) => {
return schemas.find(s => s.name === schemaName) || ({} as Schema);
};

export const getSchemasByGroup = (schemas: Schema[], schemaGroup?: string) => {
return schemas.filter(s => s.group === schemaGroup);
};
25 changes: 0 additions & 25 deletions src/legacy/server/index_patterns/index.ts

This file was deleted.

56 changes: 0 additions & 56 deletions src/legacy/server/index_patterns/mixin.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/legacy/server/kbn_server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import { LegacyConfig, ILegacyService, ILegacyInternals } from '../../core/serve
import { ApmOssPlugin } from '../core_plugins/apm_oss';
import { CallClusterWithRequest, ElasticsearchPlugin } from '../core_plugins/elasticsearch';
import { UsageCollectionSetup } from '../../plugins/usage_collection/server';
import { IndexPatternsServiceFactory } from './index_patterns';
import { Capabilities } from '../../core/server';
import { UiSettingsServiceFactoryOptions } from '../../legacy/ui/ui_settings/ui_settings_service_factory';
import { HomeServerPluginSetup } from '../../plugins/home/server';
Expand All @@ -68,7 +67,6 @@ declare module 'hapi' {

interface Server {
config: () => KibanaConfig;
indexPatternsServiceFactory: IndexPatternsServiceFactory;
savedObjects: SavedObjectsLegacyService;
injectUiAppVars: (pluginName: string, getAppVars: () => { [key: string]: any }) => void;
getHiddenUiAppById(appId: string): UiApp;
Expand Down Expand Up @@ -175,5 +173,4 @@ export default class KbnServer {
export { Server, Request, ResponseToolkit } from 'hapi';

// Re-export commonly accessed api types.
export { IndexPatternsFetcher as IndexPatternsService } from './index_patterns';
export { SavedObjectsLegacyService, SavedObjectsClient } from 'src/core/server';
Loading

0 comments on commit f7e7cd0

Please sign in to comment.