-
Notifications
You must be signed in to change notification settings - Fork 61
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
Update the Method Call metric usage #2040
Conversation
9e9c2ac
to
06f622e
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2040 +/- ##
===========================================
- Coverage 83.23% 83.03% -0.20%
===========================================
Files 491 493 +2
Lines 17685 17701 +16
Branches 2685 2685
===========================================
- Hits 14719 14697 -22
- Misses 2227 2271 +44
+ Partials 739 733 -6
|
@@ -47,11 +47,13 @@ interface FeatureScope { | |||
* @param callerClass name of the class calling the performance measurement. | |||
* @param metric name of the metric that we want to measure. | |||
* @param samplingRate value between 0-100 for sampling the event. | |||
* @param operationName the name of the operation being measured | |||
* @return a PerformanceMetric object that can later be used to send telemetry, or null if sampled out | |||
*/ | |||
fun startPerformanceMeasure( |
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.
side note: I added some comments to the original PR #1940 (review), but they were too late. I think in the future we should refactor this a bit a remove this method from the FeatureScope
.
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.
Good point, I'll take your other comments here 👍
* @param samplingRate the sampling rate for the metric | ||
* @param operation the operation to report | ||
*/ | ||
fun <R : Any?> FeatureScope?.measureMethodCallPerf( |
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.
fun <R : Any?> FeatureScope?.measureMethodCallPerf( | |
@InternalApi | |
fun <R : Any?> FeatureScope?.measureMethodCallPerf( |
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.
👍
|
||
val result = operation() | ||
|
||
val isSuccessful = (result != null) && ((result !is Collection<*>) || result.isNotEmpty()) |
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.
why generally speaking empty collection shouldn't be considered as a successful result? but probably for the methods we are going to cover with this call it makes sense.
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 was trying to keep the existing behavior consistent
@@ -52,6 +52,7 @@ android { | |||
|
|||
dependencies { | |||
api(project(":dd-sdk-android-core")) | |||
api(project(":features:dd-sdk-android-trace")) |
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.
blocking: seems like unnecessary change? I don't see any com.datadog.android.trace
or com.datadog.trace
usages in this PR
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.
Indeed, I was using some traces in my tests, forgot to remove this
val nodes = views | ||
.mapNotNull { | ||
val nodes = sessionReplayFeature.measureMethodCallPerf( | ||
javaClass, |
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.
should this be in the consumer rules to prevent name obfuscation?
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.
Good point 👍
06f622e
to
7618a02
Compare
7618a02
to
f4f8507
Compare
What does this PR do?
Update the MethodCall metric code to allow multiple usage with different operation names + cleanup some SR code