-
Notifications
You must be signed in to change notification settings - Fork 40
Conversation
5683141
to
234758e
Compare
v1/plugin/stream_collector_proxy.go
Outdated
if err != nil { | ||
log.Fatal(err) | ||
} | ||
}() |
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.
@jcooklin, could you provide me more details regardings those changes in func (p *StreamProxy) StreamMetrics()
? It seems that this cause that streaming rand collector does not work as expected - running task still has Hits = 0.
234758e
to
4f3438e
Compare
06336aa
to
57a59d6
Compare
v1/plugin/plugin.go
Outdated
app = cli.NewApp() | ||
app.Flags = []cli.Flag{ | ||
// Flags required by the plugin lib flags - plugin authors can provide their | ||
// own flags. |
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.
It would be great to point here to snap-plugin-collector-rand/rand/rand.go as a place where the example of usage (I mean adding a flag in the plugin) can be found.
v1/plugin/stream_collector_proxy.go
Outdated
|
||
s, err := stream.Recv() | ||
if err != nil { | ||
log.Debug(err) |
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.
@jcooklin , could you confirm this log should stay on debug level, or maybe "error" would be more appropriate here? What do you think about keeping the same pattern and defining log with the field "_block".
v1/plugin/plugin.go
Outdated
@@ -606,6 +617,26 @@ func printPreambleAndServe(srv server, m *meta, p *pluginProxy, port string, isP | |||
return string(preambleJSON), nil | |||
} | |||
|
|||
// getAddr if we were provided the addr 0.0.0.0 we need to determine the | |||
// address we will advertise to the framework in the premable. |
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.
typo in "premable" -> "preamble"
I noticed that I got log error twice:
I found out that this line duplicates log from here. @jcooklin, I will prepare a PR to your repo with the fix of this small issue |
v1/plugin/plugin.go
Outdated
@@ -573,7 +580,7 @@ func printPreambleAndServe(srv server, m *meta, p *pluginProxy, port string, isP | |||
} | |||
l.Close() | |||
|
|||
addr := fmt.Sprintf("127.0.0.1:%v", l.Addr().(*net.TCPAddr).Port) | |||
addr := fmt.Sprintf("%s:%v", grpcListenAddr, l.Addr().(*net.TCPAddr).Port) |
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 am pondering if lines above (577-581) should be also refactored based on the fact that determined own grpcListenAddress (different than localhost) is now possible.
This is the scenarios that I've tested.:
a) (OK) set unavailable address with port 30 (notice that the port is available on my localhost):
$ ./snap-streaming --addr 119.50.30.3 --port 30 (of course in standalone mode)
ERRO[0000] listen tcp 119.50.30.3:30: bind: cannot assign requested address _block=StartStreanCollector
b) (NOT AS EXPECTED) set unavailable address with port 8181 (notice that the port is already in use on my localhost):
$ ./snap-streaming --addr 119.50.30.3 --port 8181
ERRO[0000] listen tcp :8181: bind: address already in use
In this "b" case I expected to get listen tcp 119.50.30.3:8181: bind: cannot assign requested address
. In this case checking if provided port is available or not in localhost should not happen.
@jcooklin - is there any plan to refactor examplary stest-rand-streamer? Together with these changes, the plugin does not work as expected - no Hits, no Misses |
@IzabellaRaulin: Yes, before it lands the existing example should work as expected. |
It's great. Could you add "todo" checklist with that in the pull request description - if there are any other things which need to be done before it lands, please add them as well. Thanks |
resp := preamble{ | ||
Meta: *m, | ||
ListenAddress: addr, | ||
ListenAddress: fmt.Sprintf("%v:%v", advertisedAddr, l.Addr().(*net.TCPAddr).Port), |
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.
Shouldn't the listening address be separate from advertised address?
Here grpcListenAddr
(--addr
) is used both as -advertised address (reported in preamble) and -listening address net.Listen("tcp", addr)
.
It does matter in case a qualified domain name is added (in contrast to giving an ip). Then user doesn't have explicit control over address resolution, see also description for net.Listen.
@jcooklin it came to me that default port for plugin advertisement is the same as |
@marcintao this is addressed in 1e1089e. |
c03dbcf
to
d9fad5f
Compare
258efba updates the example. |
@@ -20,7 +20,7 @@ limitations under the License. | |||
package main | |||
|
|||
import ( | |||
"github.com/intelsdi-x/snap-plugin-lib-go/examples/streaming/rand" | |||
"github.com/intelsdi-x/snap-plugin-lib-go/examples/snap-plugin-collector-rand-streaming/rand" |
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.
Based on that, some changes are needed in links in README.md - for example here: https://github.com/intelsdi-x/snap-plugin-lib-go/blob/master/examples/streaming/README.md#ready-to-share:
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.
@jcooklin, I made PR with fix to your repo: jcooklin#10
I do not why the behavior of aggregation by
|
Ok, so then it LGTM. |
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, please squash your commit into single one
7e1f8c8
to
0e78d6b
Compare
0e78d6b
to
3a91475
Compare
The docker-compose file and task used in this demo can be found here.
TODO: