-
Notifications
You must be signed in to change notification settings - Fork 160
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
[Integration] Add Guzzle v5 integration #148
Conversation
7829665
to
4801264
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.
Great work @SammyK, just a few comments if you think are improvements.
public static function setDefaultTags(Span $span, $method) | ||
{ | ||
parent::setDefaultTags($span, $method); | ||
$span->setTag(Tags\SPAN_TYPE, Types\GUZZLE); |
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 type should be http
for consistency with what other languages do for http client integrations
11e1b1d
to
b2bdc04
Compare
{ | ||
self::traceMethod('send', function (Span $span, array $args) { | ||
$span->setTag('http.method', $args[0]->getMethod()); | ||
$span->setTag('http.url', $args[0]->getUrl()); |
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 I forgot to mention: you can use DDTrace\Http\Urls::sanitize()
to sanitize the url before putting it in the tag.
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.
Done! :)
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.
Great job @SammyK approving it! 😄
This adds the Guzzle integration for v5. I also created an abstract
Integration
class that takes on the majority of the boilerplate for the integration without using instances of objects like in #133. If we'd rather not do this change on this PR, let me know and I'll refactor it out. Then we can just try this abstraction in a separate PR. :)