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

Add /api/sampling endpoint in collector #1990

Conversation

RickyRajinder
Copy link
Contributor

@RickyRajinder RickyRajinder commented Dec 21, 2019

Which problem is this PR solving?

Short description of the changes

  • Consolidated agent and collector API handlers into one

cmd/collector/app/http_handler.go Outdated Show resolved Hide resolved
cmd/collector/app/http_handler.go Outdated Show resolved Hide resolved
cmd/collector/app/http_handler.go Outdated Show resolved Hide resolved
cmd/collector/app/http_handler_test.go Outdated Show resolved Hide resolved
cmd/agent/app/httpserver/server_test.go Outdated Show resolved Hide resolved
@RickyRajinder
Copy link
Contributor Author

@yurishkuro Do I update the content/docs/next-release/faq in the documentation repo?

@yurishkuro
Copy link
Member

Do I update the content/docs/next-release/faq in the documentation repo?

yes

@RickyRajinder
Copy link
Contributor Author

@yurishkuro How would an import from the same repo resolve if it is pointing to the remote master that does not contain the branch's changes?

@yurishkuro
Copy link
Member

Sorry, I don't follow.

@RickyRajinder
Copy link
Contributor Author

@yurishkuro For example, when I import "github.com/jaegertracing/jaeger/cmd/agent/app/httpserver" the import points to the remote repo that has been downloaded in /vendor, which causes compilation errors. So my question is, how would I properly import the local package from my branch.

@yurishkuro
Copy link
Member

There's something wrong with your Go setup then. Maybe you cloned this repo in the wrong location, it should be under $GOPATH/src/github.com/jaegertracing/jaeger/

@RickyRajinder RickyRajinder force-pushed the expose-sampling-endpoint-in-collector branch 7 times, most recently from 12bf753 to 64afaff Compare December 21, 2019 05:47
@codecov
Copy link

codecov bot commented Dec 21, 2019

Codecov Report

Merging #1990 into master will increase coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1990      +/-   ##
==========================================
+ Coverage   96.93%   96.95%   +0.02%     
==========================================
  Files         204      205       +1     
  Lines       10113    10114       +1     
==========================================
+ Hits         9803     9806       +3     
+ Misses        270      269       -1     
+ Partials       40       39       -1
Impacted Files Coverage Δ
pkg/clientcfg/clientcfghttp/cfgmgr.go 100% <100%> (ø)
cmd/collector/app/http_handler.go 100% <100%> (ø) ⬆️
cmd/collector/app/zipkin/http_handler.go 100% <100%> (ø) ⬆️
pkg/clientcfg/clientcfghttp/handler.go 100% <100%> (ø) ⬆️
plugin/storage/badger/spanstore/reader.go 96.79% <0%> (ø) ⬆️
...lugin/sampling/strategystore/adaptive/processor.go 100% <0%> (+0.79%) ⬆️

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 7350001...85c144c. Read the comment docs.

@RickyRajinder
Copy link
Contributor Author

@yurishkuro it appears cross-dock is failing and it is not clear from the logs as to why. Could this be related to #1455?

Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

This PR now creates a lot of new public APIs. I don't think it's necessary. What we need is to pull the HTTP handler from the agent into a shared location, e.g. /pkg/clientcfg/http where there's only a single public type HTTPHandler that has RegisterHander(mux) function. The actual HTTPServer should remain in the agent, and the collector has its own HTTPService (used for /api/traces endpoint). This will also mean the test infrastructure that you made public can remain private in that package.

cmd/agent/app/httpserver/server.go Outdated Show resolved Hide resolved
cmd/all-in-one/main.go Outdated Show resolved Hide resolved
@RickyRajinder
Copy link
Contributor Author

RickyRajinder commented Dec 22, 2019

This PR now creates a lot of new public APIs. I don't think it's necessary. What we need is to pull the HTTP handler from the agent into a shared location, e.g. /pkg/clientcfg/http where there's only a single public type HTTPHandler that has RegisterHander(mux) function. The actual HTTPServer should remain in the agent, and the collector has its own HTTPService (used for /api/traces endpoint). This will also mean the test infrastructure that you made public can remain private in that package.

@yurishkuro if RegisterHandler(mux) is shared, then doesn't that mean that the collector and agent will be sharing the same endpoints?

@yurishkuro
Copy link
Member

Yes, since they are part of the implementation. And they can remain private

@RickyRajinder RickyRajinder reopened this Dec 22, 2019
@RickyRajinder RickyRajinder force-pushed the expose-sampling-endpoint-in-collector branch from 64afaff to 2fdedfb Compare December 31, 2019 06:56
@RickyRajinder RickyRajinder force-pushed the expose-sampling-endpoint-in-collector branch 6 times, most recently from 16ba9f2 to d06b515 Compare December 31, 2019 08:38
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

I did the refactoring as a separate PR #1996, please rebase. It should limit the scope of this change to only registering the endpoints from collector.

cmd/collector/app/zipkin/http_handler.go Outdated Show resolved Hide resolved
pkg/clientcfg/http/http_handler.go Outdated Show resolved Hide resolved
@RickyRajinder
Copy link
Contributor Author

I did the refactoring as a separate PR #1996, please rebase. It should limit the scope of this change to only registering the endpoints from collector.

So APIHandler in cmd/collector/app/http_handler.go should contain a clientcfghttp.HTTPHandler?

@RickyRajinder RickyRajinder force-pushed the expose-sampling-endpoint-in-collector branch 2 times, most recently from 7604fa3 to a420344 Compare December 31, 2019 23:46
Return metricsFactory from test server init

fix import structure

fix unwanted change in agent server

Add license on new file

Signed-off-by: RickyRajinder <singh.sangh@gmail.com>

Add tests for errors

Refactor collector API handler to extend agent handler

Remove unused fields

Unexport fields in HttpHandler

Update callers of NewAPIHandler

Run go fmt

Fix lint issues

Fix spelling error in comment

Refactor HTTP Handler to shared location

Implement clientConfigManager interface for collector

Run gofmt

Resolve prior dependencies

Rename HTTPHandler

Update comments and fix failing test in agent

Change mux version

Add empty test

Rebase master and register routes in APIHandler

Remove empty test and rename handler variables

Run fmt
@RickyRajinder RickyRajinder force-pushed the expose-sampling-endpoint-in-collector branch from a420344 to 7350001 Compare January 1, 2020 00:25
Copy link
Member

@yurishkuro yurishkuro left a comment

Choose a reason for hiding this comment

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

Looks good, almost there!

cmd/all-in-one/main.go Outdated Show resolved Hide resolved
cmd/collector/app/http_handler.go Outdated Show resolved Hide resolved
cmd/all-in-one/main.go Outdated Show resolved Hide resolved
cmd/collector/main.go Outdated Show resolved Hide resolved
cmd/collector/main.go Outdated Show resolved Hide resolved
yurishkuro and others added 7 commits January 1, 2020 12:11
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
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.

Replicate /sampling endpoint from agent in the collector
2 participants