-
Notifications
You must be signed in to change notification settings - Fork 147
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
Uri to resource name ON by default #798
Conversation
…pping so we test default behavior
… match with expected
…hould be overridable
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.
Looks great @labbati! Just one little tweak and this should be good to go. :)
src/DDTrace/Tracer.php
Outdated
@@ -384,6 +388,10 @@ public function getTracesAsArray() | |||
$globalTags = $this->globalConfig->getGlobalTags(); | |||
if ($globalTags) { | |||
foreach ($internalSpans as &$internalSpan) { | |||
// If resource is empty, we normalize it the the operation name. | |||
if ($internalSpan['resource'] === null) { | |||
$internalSpan['resource'] === $internalSpan['name']; |
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'm assuming this is supposed to be an assignment, right?
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.
Well yes, and interestingly enough this hasn't been caught by tests, this means at least one more test is required or the exiting ones have to be modified. Thanks for noticing
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.
@@ -70,4 +72,121 @@ public function testGlobalTagsArePresentOnInternalSpansByFlushTime() | |||
public function dummyMethod() | |||
{ | |||
} | |||
|
|||
/** | |||
* When resource is set through tracer's $config object, it should be honored for CLI |
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.
The extra comments are 🔝
4f1f873
to
d8ea222
Compare
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.
Nice work @labbati! :)
…/uri-resource-on-default
…/uri-resource-on-default
The failing test is the usual flaky on 5.4 |
tests/Integration/TracerTest.php
Outdated
protected function tearUp() | ||
{ | ||
\putenv('DD_TRACE_GLOBAL_TAGS'); | ||
\putenv('DD_TRACE_URL_AS_RESOURCE_NAMES_ENABLED'); | ||
parent::tearDown(); | ||
} | ||
|
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'm suspicious here. Why is tearUp
calling parent::tearDown
? Shouldn't this be setUp
or tearDown
?
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.
Yes, tearUp
should be tearDown
for sure. Good catch. :)
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 catch 😄! The test is not failing because in this case I was doing a putenv
at the begin of relevant tests that do override that value. Nonetheless, it is a good habit to left the env clean after every test.
Description
This PR enable the feature request URI by default. In addition to that a few changes were necessary to test real web request with different env variables.
Readiness checklist
Reviewer checklist