-
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
Possibility to enable/disable distributed tracing and priority sampling #160
Conversation
0c54af0
to
7a29d03
Compare
08fbf2d
to
f9d5a5f
Compare
f9d5a5f
to
b2e0f9d
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.
Just some optional comments/alternative approaches, otherwise Looks great!
* Registry that holds configuration properties and that is able to recover configuration values from environment | ||
* variables. | ||
*/ | ||
class EnvVariableRegistry |
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.
Would it make sense to extract interface of this?
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.
Absolutely, let's do it
* | ||
* @return bool | ||
*/ | ||
public function isDistributedTracingEnabled() |
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 stumped here a bit. one hand I really like that we're using statically analyzable code to fetch configuration.
OTOH, adding a method for every configuration option - I feel like it might be a bit of an overkill in the long run.
WDYT if AbstractConfiguration implemented also VariableRegistry
interface.
So that boolValue could be reimplemented here.
And we could use this configuration like so:
$globalConfiguration->boolValue('distributed.tracing');
Hmm. This also means that we would have split the configuration defaults from the implementation. Maybe to a DefaultVariableRegistry
?
I might be optimizing a bit for the future here, so just thinking out loud. Otherwise I really like this approach!
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.
Ehehehe the solution that you proposed it much more php-style, so I would be totally for that.
To be honest, I really like to have statically analysable methods and I don't think that they will be dozens.
So I still gives my vote to methods 😄 but totally opened to change it if you guys prefer 😄
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 have a feeling we'll end up with both, and it should be cool too. I.e. the big things like isDistrubutedTracingEnabled()
is really good case for methods approach.
The small things like:
agent.connection.timeout
agent.send.timeout
agent.port
agent.hostname
Might work better as string addressable config.
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.
TBH I am not a big fan of allowing both 😄 but I also acknowledge that the string approach is more in line with PHP coding styles. So let me add both the access mechanism...but I hope that everybody will use the explicit method call 😄.
@pawelchcki I applied changes from your comments, it would be great if you have some time to take it a look for second round of code review. |
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.
one tiny nitpicky question otherwise looks good 👍
src/DDTrace/Configuration.php
Outdated
*/ | ||
public function isDistributedTracingEnabled() | ||
{ | ||
return $this->registry->boolValue('distributed.tracing', 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.
Can you use $this->boolValue(...
here ?
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.
eheheh very good catch!!! 👍 thanks
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.
LGTM 🚢 it :
Description
This PR adds the possibility to enable and disable distributed tracing and priority sampling
Readiness checklist