forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fleet] fix dynamic mapping missing
time_series_metric
(elastic#160417
) ## Summary Closes elastic#155004 Found a simplification of adding `time_series_metric` to `dynamic_templates`. I think tsdb enabled check is not needed similarly to elastic#157047 To test: - Install package by upload or local registry [istio-0.3.3.zip](https://github.com/elastic/kibana/files/11849494/istio-0.3.3.zip) - Check that the created `metrics-istio.istiod_metric`s index template includes `time_series_metric` ``` "dynamic_templates": [ { "istio.istiod.metrics.*.counter": { "path_match": "istio.istiod.metrics.*.counter", "mapping": { "time_series_metric": "counter", "type": "double" } } }, { ```
- Loading branch information
1 parent
34444e0
commit 863f6bd
Showing
7 changed files
with
65 additions
and
66 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
55 changes: 55 additions & 0 deletions
55
x-pack/test/fleet_api_integration/apis/epm/install_dynamic_template_metric.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,55 @@ | ||
/* | ||
* 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 '../../../api_integration/ftr_provider_context'; | ||
import { skipIfNoDockerRegistry } from '../../helpers'; | ||
import { setupFleetAndAgents } from '../agents/services'; | ||
|
||
export default function (providerContext: FtrProviderContext) { | ||
const { getService } = providerContext; | ||
const supertest = getService('supertest'); | ||
const es = getService('es'); | ||
|
||
const deletePackage = async (name: string, version: string) => { | ||
await supertest.delete(`/api/fleet/epm/packages/${name}/${version}`).set('kbn-xsrf', 'xxxx'); | ||
}; | ||
|
||
describe('metric_type with dynamic_templates', async () => { | ||
skipIfNoDockerRegistry(providerContext); | ||
setupFleetAndAgents(providerContext); | ||
|
||
after(async () => { | ||
await deletePackage('istio', '0.3.3'); | ||
}); | ||
|
||
it('should install with metric_type added as time_series_metric', async function () { | ||
const templateName = 'metrics-istio.istiod_metrics@package'; | ||
|
||
await supertest | ||
.post(`/api/fleet/epm/packages/istio/0.3.3`) | ||
.set('kbn-xsrf', 'xxxx') | ||
.send({ force: true }) | ||
.expect(200); | ||
|
||
const { body: resp } = await es.transport.request<any>( | ||
{ | ||
method: 'GET', | ||
path: `/_component_template/${templateName}`, | ||
}, | ||
{ meta: true } | ||
); | ||
|
||
const template = resp.component_templates[0].component_template; | ||
const dynamicTemplates = template.template.mappings.dynamic_templates; | ||
const mappingName = 'istio.istiod.metrics.*.counter'; | ||
const counter = dynamicTemplates.find((tmpl: any) => Object.keys(tmpl)[0] === mappingName); | ||
|
||
expect(counter[mappingName].mapping.time_series_metric).to.eql('counter'); | ||
}); | ||
}); | ||
} |
Binary file added
BIN
+1.56 MB
x-pack/test/fleet_api_integration/apis/fixtures/test_packages/istio/istio-0.3.3.zip
Binary file not shown.