-
Notifications
You must be signed in to change notification settings - Fork 314
Fix the Play Framework's span resource name priority so that the client JAX-RS 404 cannot override it #8591
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
Changes from all commits
c9f92b7
b2eac2f
cd6af7c
8fa65e0
a4d72e4
25257d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,8 +25,11 @@ public Object apply(final Try<Result> result) { | |
if (result.isFailure()) { | ||
DECORATE.onError(span, result.failed().get()); | ||
} else { | ||
Result response = result.get(); | ||
if (REPORT_HTTP_STATUS) { | ||
DECORATE.onResponse(span, result.get()); | ||
DECORATE.onResponse(span, response); | ||
} else { | ||
DECORATE.updateOn404Only(span, response); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set the name of the non-found resource name to be used at https://github.com/DataDog/dd-trace-java/pull/8591/files#diff-293ad0cf2c613fd3386ed5b93cd54cbe26b6cd352071e86dc849ccae48f0fda0R87. |
||
} | ||
} | ||
DECORATE.beforeFinish(span); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -428,6 +428,16 @@ public byte getResourceNamePriority() { | |
} | ||
|
||
public void setResourceName(final CharSequence resourceName, byte priority) { | ||
if (log.isDebugEnabled()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: that's generally not required since the log debug checks it and does not perform toString or concat (because of |
||
log.debug( | ||
"setResourceName `{}`->`{}` with priority {}->{} for traceId={} spanId={}", | ||
this.resourceName, | ||
resourceName, | ||
resourceNamePriority, | ||
priority, | ||
traceId, | ||
spanId); | ||
} | ||
if (null == resourceName) { | ||
return; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -307,16 +307,20 @@ def isJavaVersionAllowedForProperty(JavaVersion version, String propertyPrefix = | |
def definedMin = project.hasProperty(minProp) | ||
def definedMax = project.hasProperty(maxProp) | ||
if (definedMin && project.getProperty(minProp).compareTo(version) > 0) { | ||
logger.info("isJavaVersionAllowedForProperty is false b/o minProp=${minProp} is defined and greater than version=${version}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are those logs intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They aren't related to the change, but I added them to figure out why Gradle didn't run the tests. They still require the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with dropping them, but since they were useful when I worked on the change, they might be useful to someone else or myself in the future. That's the main reason I want to keep them. |
||
return false | ||
} | ||
//default to the general min if defined and specific one is was not defined | ||
if (!propertyPrefix.isEmpty() && !definedMin && project.hasProperty('minJavaVersionForTests') && project.getProperty('minJavaVersionForTests').compareTo(version) > 0) { | ||
logger.info("isJavaVersionAllowedForProperty is false b/o minJavaVersionForTests=${project.getProperty('minJavaVersionForTests')} is defined and greater than version=${version}") | ||
return false | ||
} | ||
if (definedMax && project.getProperty(maxProp).compareTo(version) < 0) { | ||
logger.info("isJavaVersionAllowedForProperty is false b/o maxProp=${project.getProperty(maxProp)} is defined and lower than version=${version}") | ||
return false | ||
} | ||
if (!propertyPrefix.isEmpty() && !definedMax && project.hasProperty('maxJavaVersionForTests') && project.getProperty('maxJavaVersionForTests').compareTo(version) < 0) { | ||
logger.info("isJavaVersionAllowedForProperty is false b/o maxJavaVersionForTests=${project.getProperty('maxJavaVersionForTests')} is defined and lower than version=${version}") | ||
return false | ||
} | ||
return true | ||
|
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.
Use a higher priority to prevent the parent span from being accidentally changed by the JAX-RS instrumentation.