mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Spaces] Added disabled features back to mappings (#184195)
## Summary
We aggregate on disabledFeatures in [Spaces Usage
Collector](5e95a76796/x-pack/plugins/spaces/server/usage_collection/spaces_usage_collector.ts (L38)
),
but field was removed from mappings. Added `disabledFeatures` back to
mappings.
### How to Test
1. Create a couple of spaces with disabled features.
```
POST kbn:/api/spaces/space
{
"name": "my-space-1",
"id": "my-space-1",
"description": "a description",
"color": "#5c5959",
"disabledFeatures": ["canvas", "discover"]
}
POST kbn:/api/spaces/space
{
"name": "my-space-2",
"id": "my-space-2",
"description": "a description",
"color": "#5c5959",
"disabledFeatures": ["savedObjectsManagement", "canvas"]
}
```
2. Make a request to stats endpoint and check that `disabledFeatures`
counters.
```
POST kbn:/internal/telemetry/clusters/_stats
{
"unencrypted": true, "refreshCache": true
}
```
### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
### For maintainers
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
__Fixes: https://github.com/elastic/kibana/issues/184194__
## Release note
Added `disabledFeatures` back to mappings, so it can be aggregated on.
---------
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
d6c2909ed4
commit
e8cdde2fb6
12 changed files with 135 additions and 6 deletions
|
@ -932,6 +932,7 @@
|
|||
],
|
||||
"slo-settings": [],
|
||||
"space": [
|
||||
"disabledFeatures",
|
||||
"name",
|
||||
"solution"
|
||||
],
|
||||
|
|
|
@ -3058,6 +3058,9 @@
|
|||
"space": {
|
||||
"dynamic": false,
|
||||
"properties": {
|
||||
"disabledFeatures": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
|
|
|
@ -149,7 +149,7 @@ describe('checking migration metadata changes on all registered SO types', () =>
|
|||
"siem-ui-timeline-pinned-event": "082daa3ce647b33873f6abccf340bdfa32057c8d",
|
||||
"slo": "9a9995e4572de1839651c43b5fc4dc8276bb5815",
|
||||
"slo-settings": "f6b5ed339470a6a2cda272bde1750adcf504a11b",
|
||||
"space": "d38fa4bc669b9b1d6ec86aac2983d4c6675723ed",
|
||||
"space": "953a72d8962d829e7ea465849297c5e44d8e9a2d",
|
||||
"spaces-usage-stats": "3abca98713c52af8b30300e386c7779b3025a20e",
|
||||
"synthetics-monitor": "5ceb25b6249bd26902c9b34273c71c3dce06dbea",
|
||||
"synthetics-param": "3ebb744e5571de678b1312d5c418c8188002cf5e",
|
||||
|
|
|
@ -139,9 +139,7 @@ describe('migrating from 7.3.0-xpack which used v1 migrations', () => {
|
|||
typeof modelVersions === 'function' ? modelVersions() : modelVersions ?? {};
|
||||
|
||||
Object.entries(modelVersionCreateSchemas).forEach(([key, modelVersion]) => {
|
||||
if (modelVersion.schemas?.create) {
|
||||
migrationsKeys.push(modelVersionToVirtualVersion(key));
|
||||
}
|
||||
migrationsKeys.push(modelVersionToVirtualVersion(key));
|
||||
});
|
||||
|
||||
const highestVersion = migrationsKeys.sort(Semver.compare).reverse()[0];
|
||||
|
|
|
@ -22,6 +22,9 @@ export const SpacesSavedObjectMappings = deepFreeze({
|
|||
solution: {
|
||||
type: 'keyword',
|
||||
},
|
||||
disabledFeatures: {
|
||||
type: 'keyword',
|
||||
},
|
||||
},
|
||||
} as const);
|
||||
|
||||
|
|
|
@ -25,7 +25,13 @@ describe('SpacesSavedObjectsService', () => {
|
|||
1,
|
||||
expect.objectContaining({
|
||||
name: 'space',
|
||||
mappings: expect.any(Object),
|
||||
mappings: expect.objectContaining({
|
||||
properties: expect.objectContaining({
|
||||
disabledFeatures: expect.any(Object),
|
||||
name: expect.any(Object),
|
||||
solution: expect.any(Object),
|
||||
}),
|
||||
}),
|
||||
schemas: { '8.8.0': expect.any(Object) },
|
||||
})
|
||||
);
|
||||
|
|
|
@ -54,6 +54,16 @@ export class SpacesSavedObjectsService {
|
|||
}),
|
||||
},
|
||||
},
|
||||
2: {
|
||||
changes: [
|
||||
{
|
||||
type: 'mappings_addition',
|
||||
addedMappings: {
|
||||
disabledFeatures: { type: 'keyword' },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
|
|||
esArchiver: config.kibana.functional.get('services.esArchiver'),
|
||||
kibanaServer: config.kibana.functional.get('services.kibanaServer'),
|
||||
spaces: config.xpack.api.get('services.spaces'),
|
||||
usageAPI: config.xpack.api.get('services.usageAPI'),
|
||||
},
|
||||
junit: {
|
||||
reportName: 'X-Pack Spaces API Integration Tests -- ' + name,
|
||||
|
|
|
@ -10,5 +10,6 @@ import { services as apiIntegrationServices } from '../../api_integration/servic
|
|||
|
||||
export const services = {
|
||||
...commonServices,
|
||||
usageAPI: apiIntegrationServices.usageAPI,
|
||||
supertestWithoutAuth: apiIntegrationServices.supertestWithoutAuth,
|
||||
};
|
||||
|
|
|
@ -8,4 +8,8 @@
|
|||
import { createTestConfig } from '../common/config';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default createTestConfig('spaces_only', { disabledPlugins: ['security'], license: 'basic' });
|
||||
export default createTestConfig('spaces_only', {
|
||||
disabledPlugins: ['security'],
|
||||
license: 'basic',
|
||||
testFiles: [require.resolve('./telemetry'), require.resolve('./apis')],
|
||||
});
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function spacesOnlyTestSuite({ loadTestFile }: FtrProviderContext) {
|
||||
describe('spaces telemetry data', function () {
|
||||
loadTestFile(require.resolve('./telemetry'));
|
||||
});
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function ({ getService }: FtrProviderContext) {
|
||||
const spacesService = getService('spaces');
|
||||
const usageAPI = getService('usageAPI');
|
||||
|
||||
describe('Verify disabledFeatures telemetry payloads', async () => {
|
||||
beforeEach(async () => {
|
||||
await spacesService.create({
|
||||
id: 'space-1',
|
||||
name: 'space-1',
|
||||
description: 'This is your space-1!',
|
||||
color: '#00bfb3',
|
||||
disabledFeatures: ['canvas', 'maps'],
|
||||
});
|
||||
|
||||
await spacesService.create({
|
||||
id: 'space-2',
|
||||
name: 'space-2',
|
||||
description: 'This is your space-2!',
|
||||
color: '#00bfb3',
|
||||
disabledFeatures: ['savedObjectsManagement', 'canvas', 'maps'],
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await spacesService.delete('space-1');
|
||||
await spacesService.delete('space-2');
|
||||
});
|
||||
|
||||
it('includes only disabledFeatures findings', async () => {
|
||||
const [{ stats }] = await usageAPI.getTelemetryStats({
|
||||
unencrypted: true,
|
||||
refreshCache: true,
|
||||
});
|
||||
|
||||
expect(stats.stack_stats.kibana.plugins.spaces.disabledFeatures).to.eql({
|
||||
guidedOnboardingFeature: 0,
|
||||
actions: 0,
|
||||
observabilityAIAssistant: 0,
|
||||
aiAssistantManagementSelection: 0,
|
||||
savedObjectsTagging: 0,
|
||||
graph: 0,
|
||||
rulesSettings: 0,
|
||||
maintenanceWindow: 0,
|
||||
stackAlerts: 0,
|
||||
generalCases: 0,
|
||||
maps: 2,
|
||||
canvas: 2,
|
||||
ml: 0,
|
||||
fleetv2: 0,
|
||||
fleet: 0,
|
||||
osquery: 0,
|
||||
observabilityCases: 0,
|
||||
uptime: 0,
|
||||
slo: 0,
|
||||
infrastructure: 0,
|
||||
logs: 0,
|
||||
monitoring: 0,
|
||||
apm: 0,
|
||||
enterpriseSearch: 0,
|
||||
siem: 0,
|
||||
securitySolutionCases: 0,
|
||||
securitySolutionAssistant: 0,
|
||||
discover: 0,
|
||||
visualize: 0,
|
||||
dashboard: 0,
|
||||
dev_tools: 0,
|
||||
advancedSettings: 0,
|
||||
indexPatterns: 0,
|
||||
filesManagement: 0,
|
||||
filesSharedImage: 0,
|
||||
savedObjectsManagement: 1,
|
||||
savedQueryManagement: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue