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

Support for new DSN format (without secretKey) and remove the quiver dependency. #20

Merged
merged 5 commits into from
Jul 30, 2018

Conversation

slightfoot
Copy link
Contributor

I've updated the library to make the secretKey field optional so that it supports the new DSN format from Sentry.

I also noticed that Quiver is only used for Clock to hold a ticking DateTime for reporting. Looking at the use of it I see it can be replaced with a simple function typedef. This I feel is a better way to make the library for flexible and not have the extra dependency on the Quiver library.

@slightfoot
Copy link
Contributor Author

@yjbanov ping!

Fixed dartfmt issues.
@slightfoot
Copy link
Contributor Author

@tvolkert any chance of getting this merged in. I've a release to do and would like project referencing the official repo rather than the fork.

@yjbanov
Copy link
Contributor

yjbanov commented Jul 9, 2018

Hi! Sorry, was out on vacation. Looking at this now.

@tvolkert
Copy link

tvolkert commented Jul 9, 2018

Sorry, was out on vacation

Me too - @slightfoot you caught the team in vacation season 😄

(leaving the review to @yjbanov)

lib/sentry.dart Outdated
@@ -20,6 +19,9 @@ import 'src/version.dart';

export 'src/version.dart';

/// Used to provide time-stamp for logging.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: according to Wikipedia "timestamp" is the correct spelling 🤓

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

lib/sentry.dart Outdated
@@ -56,31 +58,27 @@ class SentryClient {
Event environmentAttributes,
bool compressPayload,
Client httpClient,
Clock clock,
ClockProvider clock,
Copy link
Contributor

Choose a reason for hiding this comment

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

To give people some time to migrate let's make clock a dynamic parameter. Then in the body of the factory we can do this:

final ClockProvider clockProvider = clock is ClockProvider
  ? clock
  : clock.get;

// pass clockProvider to SentryClient._

This still lets us remove our dependency on quiver but won't break existing code. Let's thoroughly document it in the dartdocs though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

String authHeader = 'Sentry sentry_version=6, sentry_client=$sentryClient, '
'sentry_timestamp=${now.millisecondsSinceEpoch}, sentry_key=$publicKey';
if (secretKey != null) {
authHeader += ', sentry_secret=$secretKey';
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add a unit-test for this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added unit test for parsing and http header.

@yjbanov
Copy link
Contributor

yjbanov commented Jul 9, 2018

Thanks! The fewer dependencies the better!

@slightfoot
Copy link
Contributor Author

Thanks for the review @yjbanov I'll look into the details and answer when I get time to make the suggested changes.

@yjbanov yjbanov requested a review from tvolkert July 11, 2018 05:20
@yjbanov
Copy link
Contributor

yjbanov commented Jul 11, 2018

Adding @tvolkert to the reviewer list as I'll be on vacation again.

@slightfoot
Copy link
Contributor Author

@yjbanov @tvolkert looks like everything has passed.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

LGTM with one small nit. Thanks for the contribution!

@@ -46,7 +48,9 @@ class SentryClient {
/// make HTTP calls to Sentry.io. This is useful in tests.
///
/// If [clock] is provided, it is used to get time instead of the system
/// clock. This is useful in tests.
/// clock. This is useful in tests. Should be an implementation of ClockProvider.
Copy link
Contributor

Choose a reason for hiding this comment

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

References to in-scope identifiers should be wrapped in square brackets so that dartdoc can create links to them, in this case [ClockProvider].

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.

3 participants