Comments (6)
from sofa-tracer.
@khotyn 是的。
from sofa-tracer.
@mccxj 额。。。。到底是 Spring MVC 还是直接采用 HttpClient 发起请求,这两种的支持方式是不一样的。
from sofa-tracer.
spring mvc不是只负责接收么? 我说的是httpclient直接发起。
from sofa-tracer.
@mccxj 需要把 SpanContext 放到 Request 的 Header 里面传递过来,目前的版本只提供了 Spring MVC 作为服务端接收的能力,欢迎参与贡献进来哈,我们下一步计划做掉哈。
from sofa-tracer.
@mccxj 我自己写了个RestTemplate的拦截器,你可以参考一下,改成httpclient的拦截器或者用RestTemplate来做
public class SofaTracerClientHttpRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
SofaTracerSpan clientSpan = SpringMvcTracer.getSpringMvcTracerSingleton().clientSend(
request.getURI().toString());
Map<String, String> head = new HashMap<>(1);
clientSpan.getSofaTracer().inject(clientSpan.context(), Format.Builtin.HTTP_HEADERS,
new TextMapInjectAdapter(head));
HttpHeaders headers = request.getHeaders();
for (Map.Entry<String, String> entry : head.entrySet()) {
headers.set(entry.getKey(), entry.getValue());
}
ClientHttpResponse response = null;
try {
response = execution.execute(request, body);
} finally {
String resultCode = "";
if (response != null) {
resultCode = response.getStatusCode().value() + "";
}
SpringMvcTracer.getSpringMvcTracerSingleton().clientReceive(resultCode);
}
return response;
}
}
from sofa-tracer.
Related Issues (20)
- OpenFeign 10.7.3+版本兼容问题 HOT 1
- 不使用sofa boot,使用spring boot parent,依赖tracer-sofa-boot-starter时启动报错 HOT 6
- does support dubbo async invoke??? HOT 1
- Redis plugin未恢复paren span,导致span id的层级无限增长
- Open Source Promotion Plan 2022 - upgrade opentracing api version & adapter opentelemetry api HOT 5
- SofaTracer如何支持Agent接入方式 HOT 2
- spring cloud 3中的openfeign支持 HOT 2
- spring cloud gateway webflux集成问题 HOT 1
- 基于SOFAArk实现类加载器加载外置的SofaTracer的Spring Boot Starter插件 HOT 4
- datasource 模块如何记录完整的 sql 语句,包含参数的那种
- sofatracer的tracerId不一定为30位 HOT 1
- sofa-tracer-httpclient-plugin使用httpclient连接池,请求发生异常时,内存泄漏,spanId无限变长 HOT 19
- sofa-tracer-kafkamq-plugin支持ProducerListener解决方案 HOT 1
- CI failed in the master branch
- classNotFound SofaTracerLoadBalancedFeignClient HOT 1
- 是否支持 SOFA-TraceId 由前端生成放到header中请求
- sofa-tracer redis plugin未串联父span
- dubbo 2.7 使用问题 HOT 1
- feat: Delegate java.util.concurrent.Executor
- springboot v3 版本 启动报错 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sofa-tracer.