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

Ensure Introspection endpoints are always available #755

Merged
merged 3 commits into from
Aug 26, 2019

Conversation

prashantv
Copy link
Contributor

@prashantv prashantv commented Aug 22, 2019

Currently, introspection endpoints only work if the service doesn't use
SetHandler to completely take over the procedure->handler mapping, and
if the caller uses either the service name of the channel or "tchannel"
to hit the introspection endpoints.

Instead, let's always handle introspection first for the "tchannel" service. This
cannot be overridden, and no other service names work for introspection.

The test added panics without this change,

=== RUN   TestIntrospectionNotBlocked
=== RUN   TestIntrospectionNotBlocked/no_relay
panic: should not be called

goroutine 20 [running]:
github.com/uber/tchannel-go_test.TestIntrospectionNotBlocked.func1.1(0xa498c0,
0xc000152070, 0xc0001da000)
        /home/prashant/go/src/github.com/uber/tchannel-go/introspection_test.go:125

@prashantv prashantv requested a review from abhinav August 22, 2019 21:38
@codecov
Copy link

codecov bot commented Aug 22, 2019

Codecov Report

Merging #755 into dev will increase coverage by 1.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #755      +/-   ##
==========================================
+ Coverage   87.62%   88.67%   +1.04%     
==========================================
  Files          40       40              
  Lines        4090     4096       +6     
==========================================
+ Hits         3584     3632      +48     
+ Misses        389      352      -37     
+ Partials      117      112       -5
Impacted Files Coverage Δ
connection.go 88.38% <100%> (+4.83%) ⬆️
introspection.go 95% <100%> (-0.88%) ⬇️
channel.go 89.97% <100%> (+1.63%) ⬆️
inbound.go 82.19% <100%> (+1.98%) ⬆️
outbound.go 87.13% <0%> (-1.17%) ⬇️
peer.go 94.18% <0%> (+0.72%) ⬆️
preinit_connection.go 94.16% <0%> (+1.45%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 418b17e...09332d3. Read the comment docs.

@@ -195,8 +195,7 @@ func TestGetHandlers(t *testing.T) {
}{
{
serviceName: ch.ServiceName(),
// Default service name comes with extra introspection methods.
wantMethods: []string{"_gometa_introspect", "_gometa_runtime", "method1", "method2"},
wantMethods: []string{"method1", "method2"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

To confirm this removal: before we registered both introspection and actual procedure together. Now we don't and those introspection are not visible anymore during actual handling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep exactly. They're no longer just "user-level" methods, but internal methods that are always registered at a higher layer, so they don't show up here anymore.

Currently, introspection endpoints only work if the service doesn't use
SetHandler to completely take over the procedure->handler mapping, and
if the caller uses either the service name of the channel or "tchannel"
to hit the introspection endpoints.

Instead, let's always handle introspection first regardless of the
service name.

The test added panics without this change,
```
=== RUN   TestIntrospectionNotBlocked
=== RUN   TestIntrospectionNotBlocked/no_relay
panic: should not be called

goroutine 20 [running]:
github.com/uber/tchannel-go_test.TestIntrospectionNotBlocked.func1.1(0xa498c0,
0xc000152070, 0xc0001da000)
        /home/prashant/go/src/github.com/uber/tchannel-go/introspection_test.go:125
```
@prashantv prashantv force-pushed the always_add_introspect branch from 7996f09 to 6a60a55 Compare August 23, 2019 23:12
@prashantv prashantv merged commit 2e38a99 into dev Aug 26, 2019
@prashantv prashantv deleted the always_add_introspect branch August 26, 2019 22:13
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.

3 participants