Skip to content
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

Merged
merged 6 commits into from
Nov 28, 2018

Conversation

SammyK
Copy link
Contributor

@SammyK SammyK commented Nov 27, 2018

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. :)

@SammyK SammyK requested a review from labbati November 27, 2018 16:39
@SammyK SammyK force-pushed the integration-guzzle-v5 branch from 7829665 to 4801264 Compare November 27, 2018 16:42
Copy link
Member

@labbati labbati left a 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.

src/DDTrace/Integrations/Guzzle/v5/GuzzleIntegration.php Outdated Show resolved Hide resolved
src/DDTrace/Integrations/Integration.php Show resolved Hide resolved
src/DDTrace/Integrations/Integration.php Show resolved Hide resolved
public static function setDefaultTags(Span $span, $method)
{
parent::setDefaultTags($span, $method);
$span->setTag(Tags\SPAN_TYPE, Types\GUZZLE);
Copy link
Member

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

@SammyK SammyK force-pushed the integration-guzzle-v5 branch from 11e1b1d to b2bdc04 Compare November 28, 2018 14:29
@SammyK SammyK added the 🎉 new-integration A new integration label Nov 28, 2018
{
self::traceMethod('send', function (Span $span, array $args) {
$span->setTag('http.method', $args[0]->getMethod());
$span->setTag('http.url', $args[0]->getUrl());
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! :)

Copy link
Member

@labbati labbati left a 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! 😄

@SammyK SammyK merged commit 8ae3217 into DataDog:master Nov 28, 2018
@SammyK SammyK deleted the integration-guzzle-v5 branch November 28, 2018 17:40
@labbati labbati added this to the 0.5.0 milestone Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 new-integration A new integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants