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

Possibility to enable/disable distributed tracing and priority sampling #160

Merged
merged 3 commits into from
Dec 4, 2018

Conversation

labbati
Copy link
Member

@labbati labbati commented Nov 30, 2018

Description

This PR adds the possibility to enable and disable distributed tracing and priority sampling

Readiness checklist

  • [docs/changelog.md](Changelog entry) added, if necessary
  • Tests added for this feature/bug

@labbati labbati force-pushed the labbati/config-disable-distributed-tracing branch from 0c54af0 to 7a29d03 Compare November 30, 2018 16:10
@labbati labbati changed the title Possibility to enable/disable distributed tracing and prioirty sampling Possibility to enable/disable distributed tracing and priority sampling Nov 30, 2018
@labbati labbati force-pushed the labbati/config-disable-distributed-tracing branch 2 times, most recently from 08fbf2d to f9d5a5f Compare November 30, 2018 16:13
@labbati labbati added the 🍏 core Changes to the core tracing functionality label Nov 30, 2018
@labbati labbati modified the milestones: 0.6.0, 0.7.0 Nov 30, 2018
@labbati labbati requested review from pawelchcki and SammyK December 3, 2018 13:41
@labbati labbati force-pushed the labbati/config-disable-distributed-tracing branch from f9d5a5f to b2e0f9d Compare December 3, 2018 13:47
pawelchcki
pawelchcki previously approved these changes Dec 3, 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.

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
Copy link
Contributor

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?

Copy link
Member Author

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()
Copy link
Contributor

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!

Copy link
Member Author

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 😄

Copy link
Contributor

@pawelchcki pawelchcki Dec 3, 2018

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.

Copy link
Member Author

@labbati labbati Dec 4, 2018

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

@labbati
Copy link
Member Author

labbati commented Dec 4, 2018

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

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.

one tiny nitpicky question otherwise looks good 👍

*/
public function isDistributedTracingEnabled()
{
return $this->registry->boolValue('distributed.tracing', true);
Copy link
Contributor

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 ?

Copy link
Member Author

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

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.

LGTM 🚢 it :

@labbati labbati merged commit c7a8c66 into master Dec 4, 2018
@labbati labbati deleted the labbati/config-disable-distributed-tracing branch December 4, 2018 12:02
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