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

Add priority sampling #169

Merged
merged 15 commits into from
Dec 6, 2018
Merged

Add priority sampling #169

merged 15 commits into from
Dec 6, 2018

Conversation

labbati
Copy link
Member

@labbati labbati commented Dec 5, 2018

Description

This PR adds priority sampling management to the game. In the process, some refactoring to the way we handle distributed tracing in general was necessary.

Readiness checklist

@labbati labbati force-pushed the labbati/priority-sampling branch from 7d947b3 to c5bbde1 Compare December 5, 2018 10:03
Copy link
Contributor

@pawelchcki pawelchcki left a comment

Choose a reason for hiding this comment

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

Overall looks good!
Just left a few small questions.

src/DDTrace/SpanContext.php Show resolved Hide resolved
* @param array $traces
* @return bool
*/
private function isPrioritySamplingEndpoint(array $traces)
Copy link
Contributor

Choose a reason for hiding this comment

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

isPrioritySamplingEndpoint seems quite specific to endpoints, which is only partialy true, because method body doesn't mention endpoints but its only used there.
As such, would isPrioritySamplingUsed work here ? -< its a bit more generic IMO

Copy link
Member Author

Choose a reason for hiding this comment

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

totally 👍

$path = self::DEFAULT_TRACE_AGENT_PATH;
$endpoint = "http://${host}:${port}${path}";
$defaultEndpoint = "http://${host}:${port}" . self::DEFAULT_TRACE_AGENT_PATH;
$prioritySamlpingEndpoint = "http://${host}:${port}" . self::PRIORITY_SAMPLING_TRACE_AGENT_PATH;
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is probably not very bad for performance.
But it worries me a bit that we're doing some computations every request, that are not normally used during the request and after.

Overall would be great to defer most of the transport setup to the very end when we need to actually send (but this is probably out of the scope for this PR).

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good point and I like the idea. If you agree I will do for the parts that I touched in this PR and will postpone a wider refactoring of the Http transport (as the same applies also to other config params) to a later stage.

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed, it is risky as it introduces potential breaking changes for users, so I would defer it to a later http transport refactoring

Copy link
Member Author

@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.

Thanks @pawelchcki for the first round of CR. I answered to your comments

src/DDTrace/SpanContext.php Show resolved Hide resolved
$path = self::DEFAULT_TRACE_AGENT_PATH;
$endpoint = "http://${host}:${port}${path}";
$defaultEndpoint = "http://${host}:${port}" . self::DEFAULT_TRACE_AGENT_PATH;
$prioritySamlpingEndpoint = "http://${host}:${port}" . self::PRIORITY_SAMPLING_TRACE_AGENT_PATH;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a good point and I like the idea. If you agree I will do for the parts that I touched in this PR and will postpone a wider refactoring of the Http transport (as the same applies also to other config params) to a later stage.

* @param array $traces
* @return bool
*/
private function isPrioritySamplingEndpoint(array $traces)
Copy link
Member Author

Choose a reason for hiding this comment

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

totally 👍

pawelchcki
pawelchcki previously approved these changes Dec 5, 2018
Copy link
Contributor

@pawelchcki pawelchcki left a comment

Choose a reason for hiding this comment

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

I think this might be missing changelog entry. Otherwise looks good 👍

@labbati labbati changed the title WIP: Add priority sampling Add priority sampling Dec 6, 2018
@labbati labbati added this to the 0.7.0 milestone Dec 6, 2018
@labbati labbati added the 🍏 core Changes to the core tracing functionality label Dec 6, 2018
@labbati labbati force-pushed the labbati/priority-sampling branch from 550fc7b to 723580d Compare December 6, 2018 11:09
@labbati
Copy link
Member Author

labbati commented Dec 6, 2018

@pawelchcki I did some manual testing and look good. It would be great to have your latest CR round. Thanks a lot!

@labbati labbati merged commit 6aff2ab into master Dec 6, 2018
@labbati labbati deleted the labbati/priority-sampling branch December 6, 2018 13:08
bwoebi pushed a commit that referenced this pull request Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍏 core Changes to the core tracing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants