-
Notifications
You must be signed in to change notification settings - Fork 60
Conversation
6d5ea4b
to
c87ea79
Compare
Travis doesn't seem to be returning the proper path of the Go binary that it used to run the current binary. |
Please fix the build. EDIT: looks like ./cmd/ocagent/plugins/plugins_test.go is not formatted correctly? |
4335a1b
to
952d9d3
Compare
Thanks! But the change I made it to didn't affect the functionality, so the Travis Go binary still doesn't seem to be found. |
The test when run locally passes but on Travis plugins_test.go:82: Unexpected output: 2018/10/08 21:00:19 Failed to load the plugin from
/tmp/plugin_end_to_end889768309/sample.so Error: plugin.Open("/tmp/plugin_end_to_end889768309/sample"): plugin was built with a different version of package sync/atomic It is just an integration/example test that can be run on a proper setup so am going to skip it for now, as it is a nice to have. |
4163390
to
8481faf
Compare
@songy23 PTAL. |
* Also added a canonical example as well as regression test to ensure that plugins work as expected. This change finishes up the work started in #46. * plugins_test: skip TestCreatePlugin On Travis CI, trying to retrieve the same version of Go as is being used at runtime is quite the hassle. Since this test is a nice-to-have and more of an integration test that runs properly locally, skip it for now until we have enough time to expend investigating Travis CI e.g. https://travis-ci.org/census-instrumentation/opencensus-service/builds/438157975 Fixes #47
8481faf
to
466203d
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.
The logic makes sense to me, though I'm not very familiar with the syntax/usage of Go plugins. /cc @rakyll on this change.
Please don't use Go plugins yet. They are not production ready and are not supported on Windows. |
@rakyll yes, we considered that as per https://github.com/census-instrumentation/opencensus-service/blob/master/exporter/plugins.md#limitations
What do you mean? |
There are many missing pieces. For example, if a plugin is built by a different version of Go, it cannot be loaded to a binary built with a different version. There are problems with sharing data and using types from third party packages. Plugins are not currently ready to be used for the purposes we want them be used for. Even if we use plugins, we need to own and build the vendor-specific shared libraries each time we make a new binary release. |
Also considered and in the limitations section of https://github.com/census-instrumentation/opencensus-service/blob/master/exporter/plugins.md#limitations
Not really, we plan on distributing say binaries or a Docker image built using a specific version of Go that will be returned by #60 and vendors can hook into.
Our purpose here is very specific and we cut through the limitations mentioned, please correct me if am missing something else but I believe we examined all those points raised. |
We can achieve agent features without having to rely on plugins. For example, we can look in the PATH if a vendor-specific agent extension binary exists. If config file contains "apmvendor", we can look whether ocagent-apmvendor is in the PATH and fork it. Then communicate from ocagent to ocagent-apmvendor for exports. I am sure there are more other alternatives but this is one of the possibilities. |
The other alternative is to make ocagent server a library, so vendors can build their own ocagent-compatible binaries with their features and exporters and distribute them without having to rely on us. |
+1 to not using native Go plugins. This is a more production ready option if you keep going down the plugin path https://github.com/hashicorp/go-plugin |
As we discussed I think it is important to achieve the flexibility and configurability for the agent but I think plugins are not good here because they are not very mature and they don't work on windows based on my understanding. |
@derekperkins nice suggestion! However, please take a look (if you haven't already) at https://github.com/hashicorp/go-plugin#what-about-shared-libraries for the reason why they wrote that library in 2012 and then compare to today :)
@bogdandrutu sort of: they've been around since 2012 and not working on Windows is something we discussed and documented, plus I answered all the points raised in #70 (comment) I think this proposal can simmer for a while as we find other ideas, as suggested. It is great that we've gotten discourse from this implementation and for now we can develop the other features of the agent until someone actually needs this feature or prioritize it. Thanks y'all! |
Honestly I don't think the situation has changed much since 2012. Not only do Go versions have to match, but there are serious issues with shared libraries, vendoring and versioning like @rakyll mentioned. golang/go#20481 If the question is about performance, another route is something akin to the plugin system for Caddy. https://caddyserver.com/download That actually natively compiles supported plugins into a binary.
sounds like a plan :) |
I'll close this PR and if we need it back, we can get it back from history. |
A better link to Caddy plugins approach: https://github.com/mholt/caddy/wiki. As I understand, it's just adding the plugins to the source code and building a custom binary, i.e. does not involve distributing pre-built binaries for core server + plugins. |
Also added a canonical example as well as
regression test to ensure that plugins
work as expected.
This change finishes up the work started in #46.
Fixes #47