@@ -32,6 +32,17 @@ const VEGA_USAGE_TYPE = 'vis_type_vega';
3232const checkVegaSchemaType = ( schemaURL : string , type : VegaType ) =>
3333 schemaURL . includes ( `//vega.github.io/schema/${ type } /` ) ;
3434
35+ // we want to exclude the Vega Sample Data visualizations from the stats
36+ // in order to have more accurate results
37+ const excludedFromStatsVisualizations = [
38+ '[Flights] Airport Connections (Hover Over Airport)' ,
39+ '[Flights] Departure Count Map' ,
40+ '[Logs] File Type Scatter Plot' ,
41+ '[Logs] Source and Destination Sankey Chart' ,
42+ '[Logs] Visitors Map' ,
43+ '[eCommerce] Sales Count Map' ,
44+ ] ;
45+
3546const getStats = async ( callCluster : LegacyAPICaller , index : string ) => {
3647 const searchParams = {
3748 size : 10000 ,
@@ -56,11 +67,15 @@ const getStats = async (callCluster: LegacyAPICaller, index: string) => {
5667 const finalTelemetry = esResponse . hits . hits . reduce (
5768 ( telemetry , hit ) => {
5869 const visualization = get ( hit , '_source.visualization' , { visState : '{}' } ) ;
59- const visState : { type ?: string ; params ?: { spec ?: string } } = JSON . parse (
70+ const visState : { title : string ; type ?: string ; params ?: { spec ?: string } } = JSON . parse (
6071 visualization . visState
6172 ) ;
6273
63- if ( visState . type === 'vega' && visState . params ?. spec )
74+ if (
75+ visState . type === 'vega' &&
76+ visState . params ?. spec &&
77+ ! excludedFromStatsVisualizations . includes ( visState . title )
78+ )
6479 try {
6580 const spec = parse ( visState . params . spec , { legacyRoot : false } ) ;
6681
0 commit comments