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

Replace custom lifecycle with AS::Notifications #138

Closed

Conversation

quixoten
Copy link
Contributor

@quixoten quixoten commented Feb 4, 2014

By using ActiveSupport::Notificaitons, we can take advantage other tools already available that work with its interface. This will also make it easier for persons already familiar with ActiveSupport::Notifications to add logging, statistics, etc. for protobuf. After this change, I'd like to continue by adding additional instrumentation hooks throughout the code, so I can easily integrate it with logstash and statsd.

I know the increased dependency on activesupport is not ideal, but I think the benefits of having a uniform instrumentation interface is worth it. Rails (starting in 3.0 I believe) started using AS::Notifications for all of its logging, so I feel confident suggesting it is production hardened code.

Thoughts?


@abrandoned @localshred @liveh2o

@localshred
Copy link
Contributor

Are we not registering for any Lifecycle events within protobuf? That seems odd to me. Also, I'm not sure it's a good idea to just remove the Lifecycle class entirely seeing as external classes will depend on the type being present. Perhaps the right solution is to leave the class and have it simply wrap AS::Notifications, possibly with a deprecation warning.

@@ -1,5 +1,3 @@
# encoding: utf-8
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this removal. It's a change that shouldn't go out.

Not sure why this got deleted. It was not intentional
This will warn users that Lifecycle events are being deprecated in favor
of active support notifications.
@quixoten
Copy link
Contributor Author

quixoten commented Feb 4, 2014

@localshred, I added a friendly transition path with deprecation warnings. What thinkest thou?

@@ -244,7 +243,7 @@ def start_server
"pid #{::Process.pid} -- #{@runner_mode} RPC Server listening at #{options.host}:#{options.port}"
}

::Protobuf::Lifecycle.trigger( "after_server_bind" )
::ActiveSupport::Notifications.instrument( "after_server_bind")
Copy link
Contributor

Choose a reason for hiding this comment

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

Unbalanced spaces.

@localshred
Copy link
Contributor

So, did you want to open this against 2-8-stable, 2-9-dev, or master?

@quixoten
Copy link
Contributor Author

quixoten commented Feb 4, 2014

Well, I meant to open it against 2-8-stable. Is that what I should do?

@localshred
Copy link
Contributor

If you want this in the next release, then yes.

@quixoten
Copy link
Contributor Author

quixoten commented Feb 4, 2014

Closed in favor of #139

@quixoten quixoten closed this Feb 4, 2014
@quixoten quixoten deleted the devin/as_instrumentation branch February 6, 2014 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants