Skip to content

Commit

Permalink
Allow introspection calls on the "tchannel" service
Browse files Browse the repository at this point in the history
We register meta endpoints on the "tchannel" service:
https://github.com/uber/tchannel/blob/master/docs/meta.md

We should register the Go-specific meta endpoints on the same
service name.

This is useful when trying to debug a service given only the host:port.
The introspection endpoints can be used to expose the service name
information.
  • Loading branch information
prashantv committed Jul 20, 2016
1 parent d234188 commit 64dccc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions introspection.go
Expand Up @@ -477,6 +477,7 @@ func (ch *Channel) registerInternal() {
{"_gometa_runtime", handleInternalRuntime},
}

tchanSC := ch.GetSubChannel("tchannel")
for _, ep := range endpoints {
// We need ep in our closure.
ep := ep
Expand All @@ -494,5 +495,6 @@ func (ch *Channel) registerInternal() {
NewArgWriter(call.Response().Arg3Writer()).WriteJSON(ep.handler(arg3))
}
ch.Register(HandlerFunc(handler), ep.name)
tchanSC.Register(HandlerFunc(handler), ep.name)
}
}
10 changes: 10 additions & 0 deletions introspection_test.go
Expand Up @@ -55,6 +55,16 @@ func TestIntrospection(t *testing.T) {
"includeGoStacks": true,
}, &resp)
require.NoError(t, err, "Call _gometa_runtime failed")

if !ts.HasRelay() {
// Try making the call on the "tchannel" service which is where meta handlers
// are registered. This will only work when we call it directly as the relay
// will not forward the tchannel service.
err = json.CallPeer(ctx, peer, "tchannel", "_gometa_runtime", map[string]interface{}{
"includeGoStacks": true,
}, &resp)
require.NoError(t, err, "Call _gometa_runtime failed")
}
})
}

Expand Down

0 comments on commit 64dccc0

Please sign in to comment.