31
31
import java .util .concurrent .ExecutionException ;
32
32
33
33
@ RestController
34
- class AController {
34
+ public class AController {
35
35
private static final Logger log = LoggerFactory .getLogger (AController .class );
36
36
37
37
@ Autowired
@@ -82,17 +82,17 @@ public String a() throws ExecutionException, InterruptedException {
82
82
//这是rpc调用的方式
83
83
String result = restTemplate .getForObject ("http://sc-B/b" , String .class );
84
84
85
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
85
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
86
86
"[config=" + configValue + "]" + " -> " + result ;
87
87
}
88
88
89
89
@ Operation (summary = "HTTP 全链路灰度入口 a调用b和c" , tags = {"入口应用" })
90
90
@ GetMapping ("/a2bc" )
91
91
public String a2bc () throws ExecutionException , InterruptedException {
92
92
93
- String resultB = "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
93
+ String resultB = "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
94
94
"[config=" + configValue + "]" + " -> " + restTemplate .getForObject ("http://sc-B/b" , String .class );
95
- String resultA = "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
95
+ String resultA = "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
96
96
"[config=" + configValue + "]" + " -> " + restTemplate .getForObject ("http://sc-C/c" , String .class );
97
97
98
98
return resultA + "\n " + resultB ;
@@ -104,7 +104,7 @@ public String aByFeign() throws ExecutionException, InterruptedException {
104
104
105
105
String result = feignClient .bByFeign ("test" );
106
106
107
- return "A[tag= " + serviceTag + "][" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
107
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
108
108
"[config=" + configValue + "]" + " -> " + result ;
109
109
}
110
110
@@ -116,7 +116,7 @@ public String flow() throws ExecutionException, InterruptedException {
116
116
HttpStatusCode status = responseEntity .getStatusCode ();
117
117
String result = responseEntity .getBody () + " code:" + status .value ();
118
118
119
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
119
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
120
120
"[config=" + configValue + "]" + " -> " + result ;
121
121
}
122
122
@@ -129,7 +129,7 @@ public String params(@PathVariable("hot") String hot) throws ExecutionException,
129
129
HttpStatusCode status = responseEntity .getStatusCode ();
130
130
String result = responseEntity .getBody () + " code:" + status .value ();
131
131
132
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
132
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
133
133
"[config=" + configValue + "]" + " params:" + hot + " -> " + result ;
134
134
}
135
135
@@ -141,7 +141,7 @@ public String isolate() throws ExecutionException, InterruptedException {
141
141
HttpStatusCode status = responseEntity .getStatusCode ();
142
142
String result = responseEntity .getBody () + " code:" + status .value ();
143
143
144
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
144
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
145
145
"[config=" + configValue + "]" + " -> " + result ;
146
146
}
147
147
@@ -156,50 +156,50 @@ public String sql(@RequestParam Map<String, String> allRequestParams) throws Uns
156
156
url .append ("&" );
157
157
}
158
158
String result = restTemplate .getForObject (url .toString (), String .class );
159
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
159
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
160
160
"[config=" + configValue + "]" + " -> " + result ;
161
161
}
162
162
163
163
@ Operation (summary = "HTTP 全链路灰度入口" , tags = {"入口应用" })
164
164
@ GetMapping ("/a-zone" )
165
165
public String aZone () {
166
- return "A[tag= " + serviceTag + "] [" + currentZone + "]" + " -> " +
166
+ return "A" + serviceTag + "[" + currentZone + "]" + " -> " +
167
167
restTemplate .getForObject ("http://sc-B/b-zone" , String .class );
168
168
}
169
169
170
170
@ Operation (summary = "Dubbo 全链路灰度入口" , tags = {"入口应用" })
171
171
@ GetMapping ("/dubbo" )
172
172
public String dubbo (@ RequestParam (required = false ) String param ) {
173
- return "A[tag= " + serviceTag + "][" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
173
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
174
174
helloServiceB .hello (param );
175
175
}
176
176
177
177
178
178
@ Operation (summary = "Dubbo 全链路灰度入口" , tags = {"入口应用" })
179
179
@ GetMapping ("/dubbo2" )
180
180
public String dubbo2 (@ RequestParam Map <String ,String > allRequestParams ) {
181
- return "A[tag= " + serviceTag + "][" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
181
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
182
182
helloServiceBTwo .hello2 (JSON .toJSONString (allRequestParams ));
183
183
}
184
184
185
185
@ Operation (summary = "Dubbo 限流测试" , tags = {"入口应用" })
186
186
@ GetMapping ("/dubbo-flow" )
187
187
public String dubbo_flow () {
188
- return "A[tag= " + serviceTag + "][" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
188
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
189
189
helloServiceB .hello ("A" );
190
190
}
191
191
192
192
@ Operation (summary = "Dubbo 热点测试" , tags = {"入口应用" })
193
193
@ GetMapping ("/dubbo-params/{hot}" )
194
194
public String dubbo_params (@ PathVariable ("hot" ) String hot ) {
195
- return "A[tag= " + serviceTag + "][" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " params:" + hot + " -> " +
195
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " params:" + hot + " -> " +
196
196
helloServiceB .hello (hot );
197
197
}
198
198
199
199
@ Operation (summary = "Dubbo 隔离测试" , tags = {"入口应用" })
200
200
@ GetMapping ("/dubbo-isolate" )
201
201
public String dubbo_isolate () {
202
- return "A[tag= " + serviceTag + "][" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
202
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
203
203
helloServiceB .hello ("isolate" );
204
204
}
205
205
@@ -209,7 +209,7 @@ public String circuit_breaker_rt() throws ExecutionException, InterruptedExcepti
209
209
210
210
String result = feignClient .circuit_breaker_rt_b ();
211
211
212
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
212
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
213
213
"[config=" + configValue + "]" + " -> " + result ;
214
214
}
215
215
@@ -218,7 +218,7 @@ public String circuit_breaker_rt() throws ExecutionException, InterruptedExcepti
218
218
public String circuit_breaker_exception () throws ExecutionException , InterruptedException {
219
219
String result = feignClient .circuit_breaker_exception_b ();
220
220
221
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
221
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" +
222
222
"[config=" + configValue + "]" + " -> " + result ;
223
223
}
224
224
@@ -233,7 +233,7 @@ public String swagger(@Parameter(name = "name", description = "我是姓名", re
233
233
@ Operation (summary = "Dubbo rt 熔断测试" , tags = {"入口应用" })
234
234
@ GetMapping ("/dubbo-circuit-breaker-rt" )
235
235
public String dubbo_circuit_breaker_rt () {
236
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
236
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " +
237
237
helloServiceB .slow ();
238
238
}
239
239
@@ -250,6 +250,6 @@ public String dubbo_circuit_breaker_exception() {
250
250
response = "Service is in abnormal status and throws exception by itself!" ;
251
251
}
252
252
}
253
- return "A[tag= " + serviceTag + "] [" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " + response ;
253
+ return "A" + serviceTag + "[" + inetUtils .findFirstNonLoopbackAddress ().getHostAddress () + "]" + " -> " + response ;
254
254
}
255
255
}
0 commit comments