This is an automated email from the ASF dual-hosted git repository.
mikexue pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/develop by this push:
new 6c222cc add http trace http point. (#509)
6c222cc is described below
commit 6c222ccaa561e6002f57f5d324b5f9a782ce67ff
Author: YuDong Tang <[email protected]>
AuthorDate: Mon Sep 6 14:43:20 2021 +0800
add http trace http point. (#509)
---
.../java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
index 26603e0..83cba95 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
@@ -132,11 +132,13 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
"; charset=" + EventMeshConstants.DEFAULT_CHARSET);
response.headers().add(HttpHeaderNames.CONTENT_LENGTH,
response.content().readableBytes());
response.headers().add(HttpHeaderNames.CONNECTION,
HttpHeaderValues.KEEP_ALIVE);
+ // todo server span end with error, record status, we should get
channel here to get span in channel's context in async call..
ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
}
public void sendResponse(ChannelHandlerContext ctx,
DefaultFullHttpResponse response) {
+ // todo end server span, we should get channel here to get span in
channel's context in async call.
ctx.writeAndFlush(response).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture f) throws Exception {
@@ -203,6 +205,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpRequest
httpRequest) throws Exception {
HttpPostRequestDecoder decoder = null;
+ // todo start server span, we should get channel here to put span
in channel's context in async call.
try {
if (!httpRequest.decoderResult().isSuccess()) {
sendError(ctx, HttpResponseStatus.BAD_REQUEST);
@@ -210,6 +213,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
}
final HttpCommand requestCommand = new HttpCommand();
+ // todo record command opaque in span.
httpRequest.headers().set(ProtocolKey.ClientInstanceKey.IP,
RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
@@ -252,6 +256,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
requestCommand.setHttpMethod(httpRequest.method().name());
requestCommand.setHttpVersion(httpRequest.protocolVersion().protocolName());
requestCommand.setRequestCode(requestCode);
+ // todo record command method, version and requestCode in span.
HttpCommand responseCommand = null;
@@ -293,6 +298,7 @@ public abstract class AbstractHTTPServer extends
AbstractRemotingServer {
processEventMeshRequest(ctx, asyncContext);
} catch (Exception ex) {
httpServerLogger.error("AbrstractHTTPServer.HTTPHandler.channelRead0 err", ex);
+ // todo span end with exception.
} finally {
try {
decoder.destroy();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]