@@ -59,70 +59,70 @@ describe('get_data_telemetry', () => {
5959 test ( 'matches some indices and puts them in their own category' , ( ) => {
6060 expect (
6161 buildDataTelemetryPayload ( [
62- // APM Indices have known shipper (so we can infer the datasetType from mapping constant)
62+ // APM Indices have known shipper (so we can infer the dataStreamType from mapping constant)
6363 { name : 'apm-7.7.0-error-000001' , shipper : 'apm' , isECS : true } ,
6464 { name : 'apm-7.7.0-metric-000001' , shipper : 'apm' , isECS : true } ,
6565 { name : 'apm-7.7.0-onboarding-2020.05.17' , shipper : 'apm' , isECS : true } ,
6666 { name : 'apm-7.7.0-profile-000001' , shipper : 'apm' , isECS : true } ,
6767 { name : 'apm-7.7.0-span-000001' , shipper : 'apm' , isECS : true } ,
6868 { name : 'apm-7.7.0-transaction-000001' , shipper : 'apm' , isECS : true } ,
69- // Packetbeat indices with known shipper (we can infer datasetType from mapping constant)
69+ // Packetbeat indices with known shipper (we can infer dataStreamType from mapping constant)
7070 { name : 'packetbeat-7.7.0-2020.06.11-000001' , shipper : 'packetbeat' , isECS : true } ,
71- // Matching patterns from the list => known datasetName but the rest is unknown
71+ // Matching patterns from the list => known dataStreamDataset but the rest is unknown
7272 { name : 'filebeat-12314' , docCount : 100 , sizeInBytes : 10 } ,
7373 { name : 'metricbeat-1234' , docCount : 100 , sizeInBytes : 10 , isECS : false } ,
7474 { name : '.app-search-1234' , docCount : 0 } ,
7575 { name : 'logs-endpoint.1234' , docCount : 0 } , // Matching pattern with a dot in the name
7676 // New Indexing strategy: everything can be inferred from the constant_keyword values
7777 {
7878 name : '.ds-logs-nginx.access-default-000001' ,
79- datasetName : 'nginx.access' ,
80- datasetType : 'logs' ,
79+ dataStreamDataset : 'nginx.access' ,
80+ dataStreamType : 'logs' ,
8181 shipper : 'filebeat' ,
8282 isECS : true ,
8383 docCount : 1000 ,
8484 sizeInBytes : 1000 ,
8585 } ,
8686 {
8787 name : '.ds-logs-nginx.access-default-000002' ,
88- datasetName : 'nginx.access' ,
89- datasetType : 'logs' ,
88+ dataStreamDataset : 'nginx.access' ,
89+ dataStreamType : 'logs' ,
9090 shipper : 'filebeat' ,
9191 isECS : true ,
9292 docCount : 1000 ,
9393 sizeInBytes : 60 ,
9494 } ,
9595 {
9696 name : '.ds-traces-something-default-000002' ,
97- datasetName : 'something' ,
98- datasetType : 'traces' ,
97+ dataStreamDataset : 'something' ,
98+ dataStreamType : 'traces' ,
9999 packageName : 'some-package' ,
100100 isECS : true ,
101101 docCount : 1000 ,
102102 sizeInBytes : 60 ,
103103 } ,
104104 {
105105 name : '.ds-metrics-something.else-default-000002' ,
106- datasetName : 'something.else' ,
107- datasetType : 'metrics' ,
106+ dataStreamDataset : 'something.else' ,
107+ dataStreamType : 'metrics' ,
108108 managedBy : 'ingest-manager' ,
109109 isECS : true ,
110110 docCount : 1000 ,
111111 sizeInBytes : 60 ,
112112 } ,
113- // Filter out if it has datasetName and datasetType but none of the shipper, packageName or managedBy === 'ingest-manager'
113+ // Filter out if it has dataStreamDataset and dataStreamType but none of the shipper, packageName or managedBy === 'ingest-manager'
114114 {
115115 name : 'some-index-that-should-not-show' ,
116- datasetName : 'should-not-show' ,
117- datasetType : 'logs' ,
116+ dataStreamDataset : 'should-not-show' ,
117+ dataStreamType : 'logs' ,
118118 isECS : true ,
119119 docCount : 1000 ,
120120 sizeInBytes : 60 ,
121121 } ,
122122 {
123123 name : 'other-index-that-should-not-show' ,
124- datasetName : 'should-not-show-either' ,
125- datasetType : 'metrics' ,
124+ dataStreamDataset : 'should-not-show-either' ,
125+ dataStreamType : 'metrics' ,
126126 managedBy : 'me' ,
127127 isECS : true ,
128128 docCount : 1000 ,
@@ -167,23 +167,23 @@ describe('get_data_telemetry', () => {
167167 doc_count : 0 ,
168168 } ,
169169 {
170- dataset : { name : 'nginx.access' , type : 'logs' } ,
170+ data_stream : { dataset : 'nginx.access' , type : 'logs' } ,
171171 shipper : 'filebeat' ,
172172 index_count : 2 ,
173173 ecs_index_count : 2 ,
174174 doc_count : 2000 ,
175175 size_in_bytes : 1060 ,
176176 } ,
177177 {
178- dataset : { name : 'something' , type : 'traces' } ,
178+ data_stream : { dataset : 'something' , type : 'traces' } ,
179179 package : { name : 'some-package' } ,
180180 index_count : 1 ,
181181 ecs_index_count : 1 ,
182182 doc_count : 1000 ,
183183 size_in_bytes : 60 ,
184184 } ,
185185 {
186- dataset : { name : 'something.else' , type : 'metrics' } ,
186+ data_stream : { dataset : 'something.else' , type : 'metrics' } ,
187187 index_count : 1 ,
188188 ecs_index_count : 1 ,
189189 doc_count : 1000 ,
@@ -236,7 +236,7 @@ describe('get_data_telemetry', () => {
236236 test ( 'find an index that does not match any index pattern but has mappings metadata' , async ( ) => {
237237 const callCluster = mockCallCluster (
238238 [ 'cannot_match_anything' ] ,
239- { isECS : true , datasetType : 'traces' , shipper : 'my-beat' } ,
239+ { isECS : true , dataStreamType : 'traces' , shipper : 'my-beat' } ,
240240 {
241241 indices : {
242242 cannot_match_anything : {
@@ -247,7 +247,7 @@ describe('get_data_telemetry', () => {
247247 ) ;
248248 await expect ( getDataTelemetry ( callCluster ) ) . resolves . toStrictEqual ( [
249249 {
250- dataset : { name : undefined , type : 'traces' } ,
250+ data_stream : { dataset : undefined , type : 'traces' } ,
251251 shipper : 'my-beat' ,
252252 index_count : 1 ,
253253 ecs_index_count : 1 ,
@@ -266,7 +266,7 @@ describe('get_data_telemetry', () => {
266266
267267function mockCallCluster (
268268 indicesMappings : string [ ] = [ ] ,
269- { isECS = false , datasetName = '' , datasetType = '' , shipper = '' } = { } ,
269+ { isECS = false , dataStreamDataset = '' , dataStreamType = '' , shipper = '' } = { } ,
270270 indexStats : any = { }
271271) {
272272 return jest . fn ( ) . mockImplementation ( async ( method : string , opts : any ) => {
@@ -279,14 +279,14 @@ function mockCallCluster(
279279 ...( shipper && { _meta : { beat : shipper } } ) ,
280280 properties : {
281281 ...( isECS && { ecs : { properties : { version : { type : 'keyword' } } } } ) ,
282- ...( ( datasetType || datasetName ) && {
283- dataset : {
282+ ...( ( dataStreamType || dataStreamDataset ) && {
283+ data_stream : {
284284 properties : {
285- ...( datasetName && {
286- name : { type : 'constant_keyword' , value : datasetName } ,
285+ ...( dataStreamDataset && {
286+ dataset : { type : 'constant_keyword' , value : dataStreamDataset } ,
287287 } ) ,
288- ...( datasetType && {
289- type : { type : 'constant_keyword' , value : datasetType } ,
288+ ...( dataStreamType && {
289+ type : { type : 'constant_keyword' , value : dataStreamType } ,
290290 } ) ,
291291 } ,
292292 } ,
0 commit comments