Skip to content

Commit 3ab1490

Browse files
author
Aaron Caldwell
committed
Merge branch '7.5' of github.com:elastic/kibana into backport/7.5/pr-52834
2 parents 793adf6 + 494ebf1 commit 3ab1490

7 files changed

Lines changed: 127 additions & 65 deletions

File tree

docs/settings/monitoring-settings.asciidoc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ Specifies the password that {kib} uses for authentication when it retrieves data
5454
from the monitoring cluster. If not set, {kib} uses the value of the
5555
`elasticsearch.password` setting.
5656

57-
`telemetry.enabled`::
58-
Set to `true` (default) to send cluster statistics to Elastic. Reporting your
59-
cluster statistics helps us improve your user experience. Your data is never
60-
shared with anyone. Set to `false` to disable statistics reporting from any
61-
browser connected to the {kib} instance. You can also opt out through the
62-
*Advanced Settings* in {kib}.
63-
6457
`xpack.monitoring.elasticsearch.pingTimeout`::
6558
Specifies the time in milliseconds to wait for {es} to respond to internal
6659
health checks. By default, it matches the `elasticsearch.pingTimeout` setting,

docs/setup/settings.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,11 @@ cannot be `false` at the same time.
356356
To enable telemetry and prevent users from disabling it,
357357
set `telemetry.allowChangingOptInStatus` to `false` and `telemetry.optIn` to `true`.
358358

359+
`telemetry.enabled`:: *Default: true* Reporting your cluster statistics helps
360+
us improve your user experience. Your data is never shared with anyone. Set to
361+
`false` to disable telemetry capabilities entirely. You can alternatively opt
362+
out through the *Advanced Settings* in {kib}.
363+
359364
`vega.enableExternalUrls:`:: *Default: false* Set this value to true to allow Vega to use any URL to access external data sources and images. If false, Vega can only get data from Elasticsearch.
360365

361366
`xpack.license_management.enabled`:: *Default: true* Set this value to false to
76.5 KB
Loading

docs/spaces/index.asciidoc

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
[[xpack-spaces]]
33
== Spaces
44

5-
Spaces enable you to organize your dashboards and other saved
6-
objects into meaningful categories. Once inside a space, you see only
7-
the dashboards and saved objects that belong to that space.
5+
Spaces enable you to organize your dashboards and other saved
6+
objects into meaningful categories. Once inside a space, you see only
7+
the dashboards and saved objects that belong to that space.
88

9-
{kib} creates a default space for you.
10-
After you create your own
11-
spaces, you're asked to choose a space when you log in to Kibana. You can change your
9+
{kib} creates a default space for you.
10+
After you create your own
11+
spaces, you're asked to choose a space when you log in to Kibana. You can change your
1212
current space at any time by using the menu in the upper left.
1313

1414
[role="screenshot"]
@@ -29,24 +29,24 @@ Kibana supports spaces in several ways. You can:
2929
[[spaces-managing]]
3030
=== View, create, and delete spaces
3131

32-
Go to **Management > Spaces** for an overview of your spaces. This view provides actions
32+
Go to **Management > Spaces** for an overview of your spaces. This view provides actions
3333
for you to create, edit, and delete spaces.
3434

3535
[role="screenshot"]
3636
image::spaces/images/space-management.png["Space management"]
3737

3838
[float]
39-
==== Create or edit a space
39+
==== Create or edit a space
4040

41-
You can create as many spaces as you like. Click *Create a space* and provide a name,
42-
URL identifier, optional description.
41+
You can create as many spaces as you like. Click *Create a space* and provide a name,
42+
URL identifier, optional description.
4343

44-
The URL identifier is a short text string that becomes part of the
45-
{kib} URL when you are inside that space. {kib} suggests a URL identifier based
44+
The URL identifier is a short text string that becomes part of the
45+
{kib} URL when you are inside that space. {kib} suggests a URL identifier based
4646
on the name of your space, but you can customize the identifier to your liking.
4747
You cannot change the space identifier once you create the space.
4848

49-
{kib} also has an <<spaces-api, API>>
49+
{kib} also has an <<spaces-api, API>>
5050
if you prefer to create spaces programatically.
5151

5252
[role="screenshot"]
@@ -55,22 +55,22 @@ image::spaces/images/edit-space.png["Space management"]
5555
[float]
5656
==== Delete a space
5757

58-
Deleting a space permanently removes the space and all of its contents.
58+
Deleting a space permanently removes the space and all of its contents.
5959
Find the space on the *Spaces* overview page and click the trash icon in the Actions column.
6060
You can't delete the default space, but you can customize it to your liking.
6161

6262
[float]
6363
[[spaces-control-feature-visibility]]
6464
=== Control feature access based on user needs
6565

66-
You have control over which features are visible in each space.
67-
For example, you might hide Dev Tools
66+
You have control over which features are visible in each space.
67+
For example, you might hide Dev Tools
6868
in your "Executive" space or show Stack Monitoring only in your "Admin" space.
6969
You can define which features to show or hide when you add or edit a space.
7070

71-
Controlling feature
72-
visibility is not a security feature. To secure access
73-
to specific features on a per-user basis, you must configure
71+
Controlling feature
72+
visibility is not a security feature. To secure access
73+
to specific features on a per-user basis, you must configure
7474
<<xpack-security-authorization, Kibana Security>>.
7575

7676
[role="screenshot"]
@@ -80,10 +80,10 @@ image::spaces/images/edit-space-feature-visibility.png["Controlling features vis
8080
[[spaces-control-user-access]]
8181
=== Control feature access based on user privileges
8282

83-
When using Kibana with security, you can configure applications and features
84-
based on your users’ privileges. This means different roles can have access
85-
to different features in the same space.
86-
Power users might have privileges to create and edit visualizations and dashboards,
83+
When using Kibana with security, you can configure applications and features
84+
based on your users’ privileges. This means different roles can have access
85+
to different features in the same space.
86+
Power users might have privileges to create and edit visualizations and dashboards,
8787
while analysts or executives might have Dashboard and Canvas with read-only privileges.
8888
See <<adding_kibana_privileges>> for details.
8989

@@ -106,7 +106,7 @@ interface.
106106
. Import your saved objects.
107107
. (Optional) Delete objects in the export space that you no longer need.
108108

109-
{kib} also has beta <<saved-objects-api-import, import>> and
109+
{kib} also has beta <<saved-objects-api-import, import>> and
110110
<<saved-objects-api-export, export>> APIs if you want to automate this process.
111111

112112
[float]
@@ -115,17 +115,22 @@ interface.
115115

116116
You can create a custom experience for users by configuring the {kib} landing page on a per-space basis.
117117
The landing page can route users to a specific dashboard, application, or saved object as they enter each space.
118-
To configure the landing page, use the `defaultRoute` setting in <<kibana-general-settings, Management > Advanced settings>>.
118+
119+
To configure the landing page, use the default route setting in <<kibana-general-settings, Management > Advanced settings>>.
120+
For example, you might set the default route to `/app/kibana#/dashboards`.
121+
122+
[role="screenshot"]
123+
image::spaces/images/spaces-configure-landing-page.png["Configure space-level landing page"]
124+
119125

120126
[float]
121127
[[spaces-delete-started]]
122128
=== Disable and version updates
123129

124-
Spaces are automatically enabled in {kib}. If you don't want use this feature,
130+
Spaces are automatically enabled in {kib}. If you don't want use this feature,
125131
you can disable it
126-
by setting `xpack.spaces.enabled` to `false` in your
132+
by setting `xpack.spaces.enabled` to `false` in your
127133
`kibana.yml` configuration file.
128134

129-
If you are upgrading your
130-
version of {kib}, the default space will contain all of your existing saved objects.
131-
135+
If you are upgrading your
136+
version of {kib}, the default space will contain all of your existing saved objects.

x-pack/legacy/plugins/license_management/public/register_route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
setHttpClient,
1515
TelemetryOptInProvider,
1616
} from './lib/telemetry';
17+
import { npStart } from 'ui/new_platform';
1718
import { I18nContext } from 'ui/i18n';
1819
import chrome from 'ui/chrome';
1920

@@ -63,7 +64,7 @@ const manageAngularLifecycle = ($scope, $route, elem) => {
6364
});
6465
};
6566
const initializeTelemetry = $injector => {
66-
const telemetryEnabled = $injector.get('telemetryEnabled');
67+
const telemetryEnabled = npStart.core.injectedMetadata.getInjectedVar('telemetryEnabled');
6768
const Private = $injector.get('Private');
6869
const telemetryOptInProvider = Private(TelemetryOptInProvider);
6970
setTelemetryOptInService(telemetryOptInProvider);

x-pack/legacy/plugins/monitoring/server/kibana_monitoring/__tests__/bulk_uploader.js

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ describe('BulkUploader', () => {
209209
}, CHECK_DELAY);
210210
});
211211

212-
it('refetches UsageCollectors if uploading to local cluster was not successful', done => {
212+
it('stops refetching UsageCollectors if uploading to local cluster was not successful', async () => {
213213
const usageCollectorFetch = sinon
214214
.stub()
215215
.returns({ type: 'type_usage_collector_test', result: { testData: 12345 } });
@@ -227,12 +227,52 @@ describe('BulkUploader', () => {
227227

228228
uploader._onPayload = async () => ({ took: 0, ignored: true, errors: false });
229229

230-
uploader.start(collectors);
231-
setTimeout(() => {
232-
uploader.stop();
233-
expect(usageCollectorFetch.callCount).to.be.greaterThan(1);
234-
done();
235-
}, CHECK_DELAY);
230+
await uploader._fetchAndUpload(uploader.filterCollectorSet(collectors));
231+
await uploader._fetchAndUpload(uploader.filterCollectorSet(collectors));
232+
await uploader._fetchAndUpload(uploader.filterCollectorSet(collectors));
233+
234+
expect(uploader._holdSendingUsage).to.eql(true);
235+
expect(usageCollectorFetch.callCount).to.eql(1);
236+
});
237+
238+
it('fetches UsageCollectors once uploading to local cluster is successful again', async () => {
239+
const usageCollectorFetch = sinon
240+
.stub()
241+
.returns({ type: 'type_usage_collector_test', result: { usageData: 12345 } });
242+
243+
const statsCollectorFetch = sinon
244+
.stub()
245+
.returns({ type: 'type_stats_collector_test', result: { statsData: 12345 } });
246+
247+
const collectors = new MockCollectorSet(server, [
248+
{
249+
fetch: statsCollectorFetch,
250+
isReady: () => true,
251+
formatForBulkUpload: result => result,
252+
isUsageCollector: false,
253+
},
254+
{
255+
fetch: usageCollectorFetch,
256+
isReady: () => true,
257+
formatForBulkUpload: result => result,
258+
isUsageCollector: true,
259+
},
260+
]);
261+
262+
const uploader = new BulkUploader({ ...server, interval: FETCH_INTERVAL });
263+
let bulkIgnored = true;
264+
uploader._onPayload = async () => ({ took: 0, ignored: bulkIgnored, errors: false });
265+
266+
await uploader._fetchAndUpload(uploader.filterCollectorSet(collectors));
267+
expect(uploader._holdSendingUsage).to.eql(true);
268+
269+
bulkIgnored = false;
270+
await uploader._fetchAndUpload(uploader.filterCollectorSet(collectors));
271+
await uploader._fetchAndUpload(uploader.filterCollectorSet(collectors));
272+
273+
expect(uploader._holdSendingUsage).to.eql(false);
274+
expect(usageCollectorFetch.callCount).to.eql(2);
275+
expect(statsCollectorFetch.callCount).to.eql(3);
236276
});
237277

238278
it('calls UsageCollectors if last reported exceeds during a _usageInterval', done => {

x-pack/legacy/plugins/monitoring/server/kibana_monitoring/bulk_uploader.js

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,14 @@ export class BulkUploader {
4040
}
4141

4242
this._timer = null;
43+
// Hold sending and fetching usage until monitoring.bulk is successful. This means that we
44+
// send usage data on the second tick. But would save a lot of bandwidth fetching usage on
45+
// every tick when ES is failing or monitoring is disabled.
46+
this._holdSendingUsage = false;
4347
this._interval = interval;
4448
this._lastFetchUsageTime = null;
49+
// Limit sending and fetching usage to once per day once usage is successfully stored
50+
// into the monitoring indices.
4551
this._usageInterval = TELEMETRY_COLLECTION_INTERVAL;
4652

4753
this._log = {
@@ -65,38 +71,45 @@ export class BulkUploader {
6571
});
6672
}
6773

74+
filterCollectorSet(usageCollection) {
75+
const successfulUploadInLastDay =
76+
this._lastFetchUsageTime && this._lastFetchUsageTime + this._usageInterval > Date.now();
77+
78+
return usageCollection.getFilteredCollectorSet(c => {
79+
// this is internal bulk upload, so filter out API-only collectors
80+
if (c.ignoreForInternalUploader) {
81+
return false;
82+
}
83+
// Only collect usage data at the same interval as telemetry would (default to once a day)
84+
if (usageCollection.isUsageCollector(c)) {
85+
if (this._holdSendingUsage) {
86+
return false;
87+
}
88+
if (successfulUploadInLastDay) {
89+
return false;
90+
}
91+
}
92+
93+
return true;
94+
});
95+
}
96+
6897
/*
6998
* Start the interval timer
7099
* @param {CollectorSet} collectorSet object to use for initial the fetch/upload and fetch/uploading on interval
71100
* @return undefined
72101
*/
73102
start(collectorSet) {
74103
this._log.info('Starting monitoring stats collection');
75-
const filterCollectorSet = _collectorSet => {
76-
const successfulUploadInLastDay =
77-
this._lastFetchUsageTime && this._lastFetchUsageTime + this._usageInterval > Date.now();
78-
79-
return _collectorSet.getFilteredCollectorSet(c => {
80-
// this is internal bulk upload, so filter out API-only collectors
81-
if (c.ignoreForInternalUploader) {
82-
return false;
83-
}
84-
// Only collect usage data at the same interval as telemetry would (default to once a day)
85-
if (successfulUploadInLastDay && _collectorSet.isUsageCollector(c)) {
86-
return false;
87-
}
88-
return true;
89-
});
90-
};
91104

92105
if (this._timer) {
93106
clearInterval(this._timer);
94107
} else {
95-
this._fetchAndUpload(filterCollectorSet(collectorSet)); // initial fetch
108+
this._fetchAndUpload(this.filterCollectorSet(collectorSet)); // initial fetch
96109
}
97110

98111
this._timer = setInterval(() => {
99-
this._fetchAndUpload(filterCollectorSet(collectorSet));
112+
this._fetchAndUpload(this.filterCollectorSet(collectorSet));
100113
}, this._interval);
101114
}
102115

@@ -146,12 +159,17 @@ export class BulkUploader {
146159
const sendSuccessful = !result.ignored && !result.errors;
147160
if (!sendSuccessful && hasUsageCollectors) {
148161
this._lastFetchUsageTime = null;
162+
this._holdSendingUsage = true;
149163
this._log.debug(
150164
'Resetting lastFetchWithUsage because uploading to the cluster was not successful.'
151165
);
152166
}
153-
if (sendSuccessful && hasUsageCollectors) {
154-
this._lastFetchUsageTime = Date.now();
167+
168+
if (sendSuccessful) {
169+
this._holdSendingUsage = false;
170+
if (hasUsageCollectors) {
171+
this._lastFetchUsageTime = Date.now();
172+
}
155173
}
156174
this._log.debug(`Uploaded bulk stats payload to the local cluster`);
157175
} catch (err) {

0 commit comments

Comments
 (0)