-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
Send source
for transactions
#2180
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2180 +/- ##
============================================
- Coverage 80.87% 80.65% -0.22%
- Complexity 3343 3355 +12
============================================
Files 236 240 +4
Lines 12208 12324 +116
Branches 1625 1633 +8
============================================
+ Hits 9873 9940 +67
- Misses 1735 1778 +43
- Partials 600 606 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…nsaction; default to CUSTOM when changing
@@ -376,15 +374,12 @@ public abstract interface class io/sentry/IHub { | |||
public fun startTransaction (Lio/sentry/TransactionContext;)Lio/sentry/ITransaction; | |||
public fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/CustomSamplingContext;)Lio/sentry/ITransaction; | |||
public abstract fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/CustomSamplingContext;Z)Lio/sentry/ITransaction; | |||
public abstract fun startTransaction (Lio/sentry/TransactionContext;Lio/sentry/CustomSamplingContext;ZLjava/util/Date;)Lio/sentry/ITransaction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could consider expanding on this refactoring to further reduce the number of startTransaction
overloads for the next major release. Maybe by providing public and internal TransactionOptions
.
…entry-java into feat/transaction-name-source
sentry-spring/src/main/java/io/sentry/spring/tracing/SentryTransactionAdvice.java
Outdated
Show resolved
Hide resolved
boolean bindToScope, | ||
@Nullable Date startTimestamp) { | ||
final @NotNull TransactionContext transactionContext, | ||
final @NotNull TransactionOptions transactionOptions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that we now have transactionOptions
param which is nice, my question is, for all the methods that have changed to accept this new param, are they all @ApiStatus.Internal
or are we breaking Public APIs as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only changed the internal ones for now.
import org.jetbrains.annotations.NotNull; | ||
|
||
@ApiStatus.Internal | ||
public enum TransactionNameSource implements JsonSerializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now an enum
which is good, what if this SDK ser/deser objects from Hybrid SDKs, they might have sources that this SDK does not know yet, wondering if this should be a String to make it flexible for this use case.
Maybe @bruno-garcia has ideas here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use String in TransactionInfo like this: #2194
Would you prefer that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged the other PRs in here now as seems more stable to me to rely on String based de/serialization
@@ -85,7 +87,7 @@ protected void doFilterInternal( | |||
// if transaction name is not resolved, the request has not been processed by a controller | |||
// and we should not report it to Sentry | |||
if (transactionName != null) { | |||
transaction.setName(transactionName); | |||
transaction.setName(transactionName, TransactionNameSource.ROUTE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to check with other folks, shouldn't that be URL
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm you're right, it's only ROUTE
for SpringMvcTransactionNameProvider
but since people might provide their own, it should probably rather be CUSTOM
for now. Not sure if we need to improve the TransactionNameProvider
interface and add a method with default impl that returns CUSTOM
marked as internal which we override and provide what we think works. Not sure I like this approach though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #2188 to show what I mean. Not sure I like the approach though. As an alternative easy way out we could simply set CUSTOM
as source
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged the other PRs in here now as it's still better than sending wrong source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
final TransactionOptions transactionOptions = new TransactionOptions(); | ||
|
||
transactionOptions.setStartTimestamp(appStartTime); | ||
transactionOptions.setWaitForChildren(true); | ||
transactionOptions.setTransactionFinishedCallback( | ||
(finishingTransaction) -> { | ||
@Nullable Activity unwrappedActivity = weakActivity.get(); | ||
if (unwrappedActivity != null) { | ||
activityFramesTracker.setMetrics( | ||
unwrappedActivity, finishingTransaction.getEventId()); | ||
} else { | ||
if (options != null) { | ||
options | ||
.getLogger() | ||
.log( | ||
SentryLevel.WARNING, | ||
"Unable to track activity frames as the Activity %s has been destroyed.", | ||
activityName); | ||
} | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: TransactionOptions in both IF blocks are pretty much the same expect for the 'startTimestamp'. I think we can have a good refactoring here.
📜 Description
Add transaction
source
💡 Motivation and Context
getsentry/team-mobile#30
💚 How did you test it?
Unit Tests
📝 Checklist
🔮 Next steps