-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update paths and licenses * localization collector in oss * node-crypto typings in oss * update telemetry i18n labels * update translation rc files * remove duplicate components in home for telemetry * update tests * finalize collection + move csp collector to oss * self review * use apm instead of beats * xpack collection * fix collection tests * remove space specific settings * mock npSetup and npStart * disable banner in tests * remove commented mock * monitoring np telemetry fixes * replace telemetryOptedIn in oss instead of xpack_main * fix telemetry OptIn test
- Loading branch information
Showing
155 changed files
with
2,128 additions
and
1,406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/legacy/core_plugins/kibana/server/lib/csp_usage_collector/csp_collector.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { Server } from 'hapi'; | ||
import { createCSPRuleString, DEFAULT_CSP_RULES } from '../../../../../server/csp'; | ||
|
||
export function createCspCollector(server: Server) { | ||
return { | ||
type: 'csp', | ||
isReady: () => true, | ||
async fetch() { | ||
const config = server.config(); | ||
|
||
// It's important that we do not send the value of csp.rules here as it | ||
// can be customized with values that can be identifiable to given | ||
// installs, such as URLs | ||
const defaultRulesString = createCSPRuleString([...DEFAULT_CSP_RULES]); | ||
const actualRulesString = createCSPRuleString(config.get('csp.rules')); | ||
|
||
return { | ||
strict: config.get('csp.strict'), | ||
warnLegacyBrowsers: config.get('csp.warnLegacyBrowsers'), | ||
rulesChangedFromDefault: defaultRulesString !== actualRulesString, | ||
}; | ||
}, | ||
}; | ||
} | ||
|
||
export function registerCspCollector(server: Server): void { | ||
const { collectorSet } = server.usage; | ||
const collector = collectorSet.makeUsageCollector(createCspCollector(server)); | ||
collectorSet.register(collector); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/legacy/core_plugins/kibana/server/lib/csp_usage_collector/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
export { registerCspCollector } from './csp_collector'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { i18n } from '@kbn/i18n'; | ||
|
||
/* | ||
* config options opt into telemetry | ||
* @type {string} | ||
*/ | ||
export const CONFIG_TELEMETRY = 'telemetry:optIn'; | ||
/* | ||
* config description for opting into telemetry | ||
* @type {string} | ||
*/ | ||
export const getConfigTelemetryDesc = () => { | ||
return i18n.translate('telemetry.telemetryConfigDescription', { | ||
defaultMessage: | ||
'Help us improve the Elastic Stack by providing usage statistics for basic features. We will not share this data outside of Elastic.', | ||
}); | ||
}; | ||
|
||
/** | ||
* The amount of time, in milliseconds, to wait between reports when enabled. | ||
* | ||
* Currently 24 hours. | ||
* @type {Number} | ||
*/ | ||
export const REPORT_INTERVAL_MS = 86400000; | ||
|
||
/* | ||
* Key for the localStorage service | ||
*/ | ||
export const LOCALSTORAGE_KEY = 'telemetry.data'; | ||
|
||
/** | ||
* Link to the Elastic Telemetry privacy statement. | ||
*/ | ||
export const PRIVACY_STATEMENT_URL = `https://www.elastic.co/legal/telemetry-privacy-statement`; | ||
|
||
/** | ||
* The type name used within the Monitoring index to publish localization stats. | ||
* @type {string} | ||
*/ | ||
export const KIBANA_LOCALIZATION_STATS_TYPE = 'localization'; | ||
|
||
/** | ||
* UI metric usage type | ||
* @type {string} | ||
*/ | ||
export const UI_METRIC_USAGE_TYPE = 'ui_metric'; |
41 changes: 41 additions & 0 deletions
41
src/legacy/core_plugins/telemetry/common/get_xpack_config_with_deprecated.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { KibanaConfig } from 'src/legacy/server/kbn_server'; | ||
|
||
export function getXpackConfigWithDeprecated(config: KibanaConfig, configPath: string) { | ||
try { | ||
const deprecatedXpackmainConfig = config.get(`xpack.xpack_main.${configPath}`); | ||
if (typeof deprecatedXpackmainConfig !== 'undefined') { | ||
return deprecatedXpackmainConfig; | ||
} | ||
} catch (err) { | ||
// swallow error | ||
} | ||
try { | ||
const deprecatedXpackConfig = config.get(`xpack.${configPath}`); | ||
if (typeof deprecatedXpackConfig !== 'undefined') { | ||
return deprecatedXpackConfig; | ||
} | ||
} catch (err) { | ||
// swallow error | ||
} | ||
|
||
return config.get(configPath); | ||
} |
Oops, something went wrong.