@@ -604,6 +604,7 @@ else if (!dataFileDir.exists())
604604 QueryImportPipelineJob job = new QueryImportPipelineJob (getQueryImportProviderName (), info , root , importContextBuilder );
605605 PipelineService .get ().queueJob (job , getQueryImportJobNotificationProviderName ());
606606
607+ SimpleMetricsService .get ().increment ("query" , "fileBackgroundImports" , getMetricPrefix (_target ));
607608 JSONObject response = new JSONObject ();
608609 response .put ("success" , true );
609610 response .put ("jobId" , PipelineService .get ().getJobId (user , getContainer (), job .getJobGUID ()));
@@ -635,7 +636,10 @@ else if (!dataFileDir.exists())
635636 int rowCount = importData (loader , file , originalName , ve , behaviorType , auditEvent , _auditUserComment );
636637
637638 if (ve .hasErrors ())
639+ {
640+ addImportValidationErrorMetric (_insertOption , _target , (form instanceof QueryForm qf ) ? qf .getQueryName () : null );
638641 throw ve ;
642+ }
639643
640644 JSONObject response = createSuccessResponse (rowCount );
641645 if (auditEvent != null )
@@ -879,9 +883,7 @@ public static int importData(DataLoader dl, TableInfo target, QueryUpdateService
879883 if (auditEvent != null )
880884 auditEvent .addComment (auditAction , count );
881885
882- String metricPrefix = target .getUserSchema () == null ? target .getSchema ().getName () : target .getUserSchema ().getSchemaName ();
883- metricPrefix = metricPrefix .replace ("exp." , "" );
884- incrementRowCountMetric (count , context .getInsertOption (), metricPrefix );
886+ incrementRowCountMetric (count , context .getInsertOption (), getMetricPrefix (target ));
885887 transaction .commit ();
886888
887889 return count ;
@@ -903,6 +905,24 @@ else if (!context.isCrossTypeImport())
903905 return 0 ;
904906 }
905907
908+ public static void addImportValidationErrorMetric (QueryUpdateService .InsertOption insertOption , @ Nullable TableInfo target , @ Nullable String queryName )
909+ {
910+ String featureArea = insertOption .toString ().toLowerCase () + "FailWithValidationError" ;
911+ String targetType = null ;
912+ if (target != null )
913+ targetType = getMetricPrefix (target );
914+ else if (queryName != null )
915+ targetType = queryName .equalsIgnoreCase ("materials" ) ? "samples" : queryName ;
916+ if (targetType != null )
917+ SimpleMetricsService .get ().increment ("query" , featureArea , targetType );
918+ }
919+
920+ public static String getMetricPrefix (TableInfo target )
921+ {
922+ String metricPrefix = target .getUserSchema () == null ? target .getSchema ().getName () : target .getUserSchema ().getSchemaName ();
923+ return metricPrefix .replace ("exp." , "" );
924+ }
925+
906926 public static void incrementRowCountMetric (int count , QueryUpdateService .InsertOption insertOption , String prefix )
907927 {
908928 String featureArea = "file" + StringUtils .capitalize (insertOption .toString ().toLowerCase ()) + "Counts" ;
0 commit comments