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

SDK reports a status 200 instead of a 304 #1008

Open
pietrini opened this issue Aug 8, 2022 · 9 comments
Open

SDK reports a status 200 instead of a 304 #1008

pietrini opened this issue Aug 8, 2022 · 9 comments
Labels
enhancement New feature or request

Comments

@pietrini
Copy link

pietrini commented Aug 8, 2022

Thanks for taking the time for reporting an issue!

Describe what happened
My Android app launched a call that returned a 304, and datadog RUM session resource says it has a 200 status instead of a 304.

Steps to reproduce the issue:
Have e-tags server side

Describe what you expected:
Hi guys! I hope you're doing fine! I was recently investigating something in my project, and I found out datadog is not reporting 304 status on some requests. You have an example here

x-datadog-origin: rum
x-datadog-parent-id: 6329686970868304213
x-datadog-sampling-priority: 1
x-datadog-trace-id: 8589955483293502493

(I have the AS screenshot of the request, but I can't share it publicly, give me an email, and I'll get back to you)

I've also asked my teammates on iOS to look at it because I think they might have the same problem.

Have a great day.

Additional context

  • Android OS version: Any
  • Device Model: Any
  • Datadog SDK version: 1.11.1
  • Versions of any other relevant dependencies (OkHttp, …): okHttpVersion (4.9.0)
  • Proguard configuration: Can't disclose
  • Gradle Plugins: Can't disclose
@pietrini pietrini added the bug Something isn't working label Aug 8, 2022
@mariusc83
Copy link
Member

Hi @pietrini, thank you for reporting the issue.
We will check internally on both platforms to see if we can reproduce it. We might get back to you for some more information in case we will not be able to track this on our end. Will keep you posted.

@mariusc83
Copy link
Member

@pietrini you mentioned you will check this also on iOS, do you have any feedback from your team ? It will be very helpful for us to have this information as I checked in our code and everything seems to be fine.

@pietrini
Copy link
Author

I have asked, and I have more insights on iOS because we enabled this first here.
I've found that for resources like images, it works, but for standard JSON, we have the same problem.

@mariusc83
Copy link
Member

@pietrini Thanks for the info, we opened a ticket on our end to properly investigate this and we will probably work on this in the next weeks. We will get back here with more information once we have it.

@xgouchet
Copy link
Member

Hi @pietrini, this behaviour is kind of expected.

A 304 status code signals that the ressource you're requested didn't change and that the cached version should be used. This is done to avoid transferring data for nothing. What happens is that on the network layer, OkHttp knows it has a previous version of the URL you're requesting, and when it receives the 304, it converts it to a 200 and returns the cached response. This is why our tracker understands the resource as 200 when your backend returned a 304. A similar mechanism do appear in iOS as well.

We'll keep investigating to see if there's a way for us to reflect this 304 to 200 conversion in some way.

@pietrini
Copy link
Author

Ok, understood; thanks for the investigation!

It's indeed a tricky problem if OkHttp "lies" about the status 😄

Should I close this ticket as it's not a bug and create a new one with the "enhancement" label?

Have a great day!

@xgouchet
Copy link
Member

We can keep this one hear, I'll change the label.

@xgouchet xgouchet added enhancement New feature or request and removed bug Something isn't working labels Aug 19, 2022
@neugartf
Copy link

neugartf commented Aug 19, 2022

Hey!
Running into the same issue. Any workaround to filter these in the RUM explorer?
I've seen that their size is tracked around 18 bytes. Not fully confident though on this.

@xgouchet
Copy link
Member

We don't have a workaround yet, but we'll keep you updated as soon as we have more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants