Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Http request body in a trace is truncated to 512 bytes instead of 128 KB #288

Closed
shantanu-vsbhosale opened this issue Mar 16, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@shantanu-vsbhosale
Copy link
Contributor

shantanu-vsbhosale commented Mar 16, 2021

Use Case
A spring pet clinic app (having POST service) was running which was instrumented by hypertrace java-agent. The app was loaded with multiple POST requests having body ~1MB.
hypertrace traces has the body of a http post request. By default it should capture 128 KB.

Issue
We are only capturing 512 bytes of post request body. See attached images/files.

Solution
The post request body should be 128KB by default.
input_1MB.txt
post_request
output_512B.txt

@pavolloffay pavolloffay added the bug Something isn't working label Mar 16, 2021
@pavolloffay
Copy link
Member

pavolloffay commented Jul 6, 2021

Correct the default capture size is 128 KB. Which is 128*1024 = 131072 bytes. One string character is 2 bytes. Hence by default 65536 characters should be captured.

EDIT: One string character = 2 bytes applies for UTF-16BE encoding.

@pavolloffay
Copy link
Member

pavolloffay commented Jul 6, 2021

I could not reproduce this issue with Jaeger and sample generated spring boot app.

Perhaps the collector or platform is tuncating the result.

Here is the controller method

  @PostMapping("/post/{length}")
  public ResponseEntity<String> post(@PathVariable("length") Integer length, @RequestBody String body) {
    System.out.printf("received: %s", body);

    byte[] arr = new byte[length];
    for (int i = 0; i < length; i++) {
      arr[i] = 'a';
    }

    HttpHeaders headers = new HttpHeaders();
    headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
    return new ResponseEntity(new String(arr), headers, HttpStatus.ACCEPTED);
  }

@pavolloffay
Copy link
Member

Closing this as cannot reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants