You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/09/01 14:30:27 UTC

[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1967: Spring boot tracing filter

TeslaCN commented on a change in pull request #1967:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1967#discussion_r700271299



##########
File path: elasticjob-lite/elasticjob-lite-spring/elasticjob-lite-spring-boot-starter/src/main/java/org/apache/shardingsphere/elasticjob/lite/spring/boot/job/ElasticJobBootstrapConfiguration.java
##########
@@ -95,10 +95,30 @@ private void constructJobBootstraps(final ElasticJobProperties elasticJobPropert
         }
     }
     
+    private void jobExtraConfigurations(final JobConfiguration jobConfig, final TracingConfiguration<?> tracingConfig) {
+        if (null == tracingConfig) {
+            return;
+        }
+        TracingProperties tracingProperties = applicationContext.getBean(TracingProperties.class);
+        Preconditions.checkArgument(null == tracingProperties.getIncludeJobNames()
+                || null == tracingProperties.getExcludeJobNames(),
+                "[tracing.includeJobNames] and [tracing.excludeJobNames] are mutually exclusive.");
+        if (null == tracingProperties.getIncludeJobNames() && null == tracingProperties.getExcludeJobNames()) {
+            jobConfig.getExtraConfigurations().add(tracingConfig);
+        } else if (null != tracingProperties.getIncludeJobNames()) {
+            if (tracingProperties.getIncludeJobNames().contains(jobConfig.getJobName())) {
+                jobConfig.getExtraConfigurations().add(tracingConfig);
+            }
+        } else if (null != tracingProperties.getExcludeJobNames()
+                && !tracingProperties.getExcludeJobNames().contains(jobConfig.getJobName())) {
+            jobConfig.getExtraConfigurations().add(tracingConfig);
+        }

Review comment:
       I think these logic can be more elegant.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org