sentry-dart icon indicating copy to clipboard operation
sentry-dart copied to clipboard

Send DSN with SentryEnvelopeHeader

Open vishnukvmd opened this issue 3 years ago • 6 comments

:scroll: Description

This change injects DSN into the SentryEnvelopeHeader class and serializes it if available.

:bulb: Motivation and Context

This change ensures that the DSN is passed to the server along with events, bringing in consistency with the JavaScript SDK. This gets us one step closer to passing a tunnel that can be used to proxy data to Sentry servers (to fixe #872). Once this change is merged, will create a separate PR that accepts tunnel as a parameter within the SentryConfig and configures the transport accordingly (again, similar to the JS SDK).

:green_heart: How did you test it?

Verified that the dsn was passed within the envelope to the remote server.

:pencil: Checklist

  • [x] I reviewed submitted code
  • [x] I added tests to verify changes
  • [x] I updated the docs if needed
  • [x] All tests passing
  • [x] No breaking changes

:crystal_ball: Next steps

vishnukvmd avatar May 28 '22 23:05 vishnukvmd

@vishnukvmd Thanks for doing this. That would require changes on the Android SDK as well since it does a roundtrip in the JSON, otherwise, this field is gonna be lost. https://github.com/getsentry/sentry-java/blob/6.x.x/sentry/src/main/java/io/sentry/SentryEnvelopeHeader.java

Would you like to raise an issue on that repo as well? Thanks.

marandaneto avatar May 31 '22 16:05 marandaneto

Hey @marandaneto, why would this require changes to the Java SDK? Isn't the Dart SDK self contained?

vishnukvmd avatar Jun 13 '22 13:06 vishnukvmd

Hey @marandaneto, why would this require changes to the Java SDK? Isn't the Dart SDK self contained?

Hey, no, the Android SDK has to deserialize and serialize again the event in order to enrich the event with the device context. The reason is: https://github.com/getsentry/team-mobile/issues/11

On iOS it'd work ootb.

marandaneto avatar Jun 13 '22 13:06 marandaneto

Yikes, I had no idea. I would much rather someone who is familiar with the development environment for the Java SDK make that change. I hope that's okay.

vishnukvmd avatar Jun 13 '22 13:06 vishnukvmd

Yikes, I had no idea. I would much rather someone who is familiar with the development environment for the Java SDK make that change. I hope that's okay.

Yep, let me try to get into this latest next week since this is a short week, if that's ok.

marandaneto avatar Jun 13 '22 14:06 marandaneto

Yikes, I had no idea. I would much rather someone who is familiar with the development environment for the Java SDK make that change. I hope that's okay.

Yep, let me try to get into this latest next week since this is a short week, if that's ok.

That'd be great, thank you so much! 🙏

vishnukvmd avatar Jun 13 '22 14:06 vishnukvmd

Codecov Report

Base: 90.05% // Head: 90.13% // Increases project coverage by +0.08% :tada:

Coverage data is based on head (3502ee4) compared to base (fa7e619). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #873      +/-   ##
==========================================
+ Coverage   90.05%   90.13%   +0.08%     
==========================================
  Files         105      107       +2     
  Lines        3357     3405      +48     
==========================================
+ Hits         3023     3069      +46     
- Misses        334      336       +2     
Impacted Files Coverage Δ
dart/lib/src/sentry_envelope.dart 100.00% <ø> (ø)
dart/lib/src/sentry_client.dart 93.43% <100.00%> (+0.04%) :arrow_up:
dart/lib/src/sentry_envelope_header.dart 100.00% <100.00%> (ø)
logging/lib/src/extension.dart 100.00% <0.00%> (ø)
logging/lib/src/logging_integration.dart 90.47% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Sep 27 '22 07:09 codecov-commenter

@ua741 CI is unhappy, also, add a new changelog entry, after that, happy to LGTM.

marandaneto avatar Sep 28 '22 07:09 marandaneto

@ua741 CI is unhappy, also, add a new changelog entry, after that, happy to LGTM.

@ua741 any update here?

marandaneto avatar Oct 05 '22 07:10 marandaneto

Seems like only a lint issue, preferred const over final, otherwise tests are passing.

krystofwoldrich avatar Oct 05 '22 09:10 krystofwoldrich

Closing in favor of https://github.com/getsentry/sentry-dart/pull/1050

marandaneto avatar Oct 07 '22 09:10 marandaneto

@ua741 CI is unhappy, also, add a new changelog entry, after that, happy to LGTM.

@ua741 any update here?

Sorry for dropping the ball here, I was on vacation. Thank you so much for taking it forward and merging it. Really appreciate it.

ua741 avatar Oct 10 '22 11:10 ua741