@@ -46,6 +46,9 @@ public class DemoController {
4646 @ Value ("${enable.sentinel.demo.flow:false}" )
4747 private boolean enableSentinelFlow ;
4848
49+ @ Value ("${enable.gray:false}" )
50+ private boolean enableGray ;
51+
4952 private static Random random = new Random ();
5053
5154 private static final ScheduledExecutorService FLOW_EXECUTOR = Executors .newScheduledThreadPool (16 ,
@@ -135,7 +138,9 @@ public void run() {
135138
136139 try (CloseableHttpClient httpClient = HttpClientBuilder .create ().build ()) {
137140 HttpGet httpGet = new HttpGet ("http://localhost:20000/A/a" );
138- httpGet .addHeader ("x-mse-tag" , "gray" );
141+ if (enableGray ) {
142+ httpGet .addHeader ("x-mse-tag" , "gray" );
143+ }
139144 httpClient .execute (httpGet );
140145
141146 } catch (Exception ignore ) {
@@ -157,7 +162,9 @@ public void run() {
157162
158163 try (CloseableHttpClient httpClient = HttpClientBuilder .create ().build ()) {
159164 HttpGet httpGet = new HttpGet ("http://localhost:20000/A/flow" );
160- httpGet .addHeader ("x-mse-tag" , "gray" );
165+ if (enableGray ) {
166+ httpGet .addHeader ("x-mse-tag" , "gray" );
167+ }
161168 httpClient .execute (httpGet );
162169
163170 } catch (Exception ignore ) {
@@ -171,7 +178,9 @@ public void run() {
171178 }
172179 try (CloseableHttpClient httpClient = HttpClientBuilder .create ().build ()) {
173180 HttpGet httpGet = new HttpGet ("http://localhost:20000/A/dubbo-flow" );
174- httpGet .addHeader ("x-mse-tag" , "gray" );
181+ if (enableGray ) {
182+ httpGet .addHeader ("x-mse-tag" , "gray" );
183+ }
175184 httpClient .execute (httpGet );
176185
177186 } catch (Exception ignore ) {
@@ -185,7 +194,9 @@ public void run() {
185194 }
186195 try (CloseableHttpClient httpClient = HttpClientBuilder .create ().build ()) {
187196 HttpGet httpGet = new HttpGet ("http://localhost:20000/A/dubbo-isolate" );
188- httpGet .addHeader ("x-mse-tag" , "gray" );
197+ if (enableGray ) {
198+ httpGet .addHeader ("x-mse-tag" , "gray" );
199+ }
189200 httpClient .execute (httpGet );
190201
191202 } catch (Exception ignore ) {
@@ -298,7 +309,9 @@ public void run() {
298309
299310 try (CloseableHttpClient httpClient = HttpClientBuilder .create ().build ()) {
300311 HttpGet httpGet = new HttpGet ("http://localhost:20000/A/dubbo" );
301- httpGet .addHeader ("x-mse-tag" , "gray" );
312+ if (enableGray ) {
313+ httpGet .addHeader ("x-mse-tag" , "gray" );
314+ }
302315 httpClient .execute (httpGet );
303316
304317 } catch (Exception ignore ) {
0 commit comments