Skip to content

Instrument vertx client directly - #311

Merged
pavolloffay merged 8 commits into
hypertrace:mainfrom
pavolloffay:vertx-web-fix
Apr 23, 2021
Merged

Instrument vertx client directly#311
pavolloffay merged 8 commits into
hypertrace:mainfrom
pavolloffay:vertx-web-fix

Conversation

@pavolloffay

Copy link
Copy Markdown
Member

Resolves #310

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
@pavolloffay
pavolloffay requested a review from shashank11p April 22, 2021 13:33
BoundedCharArrayWriter buffer =
InstrumentationContext.get(MultiMap.class, BoundedCharArrayWriter.class)
.get(request.headers());
if (buffer != null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont we want to check if

(HypertraceConfig.get().getDataCapture().getHttpBody().getRequest().getValue()
          && ContentTypeUtils.shouldCapture(contentType))
          

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have to check it here bc the buffer is null if the body shouldn't be captured.

buffer = BoundedBuffersFactory.createWriter();
contextStore.put(request.headers(), buffer);
}
buffer.write(chunk);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we calling this here and in EndRequestAdvice both?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this writes a chunk and in the end method it as well writes a chunk and sends the request.

public void handle(Buffer event) {
String responseBody = event.getString(0, event.length());
if (span.isRecording()) {
span.setAttribute(HypertraceSemanticAttributes.HTTP_RESPONSE_BODY, responseBody);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check if we should capture response body?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed as this is reached only after the check from the previous instrumentation point.

Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
Signed-off-by: Pavol Loffay <p.loffay@gmail.com>
@pavolloffay
pavolloffay merged commit b8e63cf into hypertrace:main Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertx client instrumentation is broken in 1.1

2 participants