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

Rework beater package #2489

Closed
8 tasks done
simitt opened this issue Jul 23, 2019 · 0 comments
Closed
8 tasks done

Rework beater package #2489

simitt opened this issue Jul 23, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@simitt
Copy link
Contributor

simitt commented Jul 23, 2019

The beater package deals with a couple of technical debts at the moment. This is a meta issue to discuss issues and how to address them.

The logging and monitoring handling is spread all over the package, leading to errors and not fully logged and monitored requests (e.g. ACM requests increase counter for requests, but not for responses).

The response writer logic needs some refactoring to have a unique and more idiomatic way of writing responses and errors. Response handling should be separated from increasing monitoring counters.

After some research the suggested solution is to introduce a Context struct pool. A Context is passed around between Handlers within one request, abstracting the http.ResponseWriter and the *http.Request. For every new request the context pool takes care of reusing an idle context, and resetting it to the current request.

Introducing a Context allows for better separation of concerns for the single middleware handlers, while reusing structs to increase performance.

Since this is a larger effort, the changes will be introduced in separate PRs, directed against a feature branch. Once all changes are in and all tests are accordingly adapted, the feature branch will be merged against master.

Separating the effort into following tasks:

@simitt simitt added the meta label Jul 23, 2019
@graphaelli graphaelli added this to the 7.4 milestone Jul 23, 2019
@simitt simitt self-assigned this Jul 23, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 24, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 24, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 24, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 24, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 24, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 24, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 30, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 31, 2019
simitt added a commit to simitt/apm-server that referenced this issue Jul 31, 2019
simitt added a commit that referenced this issue Aug 5, 2019
Change response write handling to set a response per context and then call write on the context. Introduce a shared beatertest package with testing helper structs and methods.

Related to #2489
simitt added a commit to simitt/apm-server that referenced this issue Aug 5, 2019
Create several packages inside the beater directory to better organize
http framework logic. Adapt tests and code to new structure.

related to elastic#2489
simitt added a commit to simitt/apm-server that referenced this issue Aug 5, 2019
Create several packages inside the beater directory to better organize
http framework logic. Adapt tests and code to new structure.

related to elastic#2489
simitt added a commit that referenced this issue Aug 6, 2019
* [beater] Restructure beater package and some more test

Create several packages inside the beater directory to better organize
http framework logic. Adapt tests and code to new structure.

related to #2489
simitt added a commit to simitt/apm-server that referenced this issue Aug 7, 2019
Change response write handling to set a response per context and then call write on the context. Introduce a shared beatertest package with testing helper structs and methods.

Related to elastic#2489
simitt added a commit to simitt/apm-server that referenced this issue Aug 7, 2019
* [beater] Restructure beater package and some more test

Create several packages inside the beater directory to better organize
http framework logic. Adapt tests and code to new structure.

related to elastic#2489
simitt added a commit that referenced this issue Aug 20, 2019
* [beater] Add context handlers and adapt log handling (#2492 )

related to #2201

* [beater] Introduce middleware logic and dedicated monitoring middleware (#2493)

partially implements #2142

* [beater] Improve Response Writing (#2494)

Change response write handling to set a response per context and then call write on the context. Introduce a shared beatertest package with testing helper structs and methods.

related to #2489

* [beater] Restructure beater package (#2518)

Create several packages inside the beater directory to better organize http framework logic. Adapt tests and code to new structure.

related to #2489

* More beater coverage (#2582)

Co-Authored-By: Gil Raphaelli <[email protected]>
simitt added a commit to simitt/apm-server that referenced this issue Aug 20, 2019
* [beater] Add context handlers and adapt log handling (elastic#2492 )

related to elastic#2201

* [beater] Introduce middleware logic and dedicated monitoring middleware (elastic#2493)

partially implements elastic#2142

* [beater] Improve Response Writing (elastic#2494)

Change response write handling to set a response per context and then call write on the context. Introduce a shared beatertest package with testing helper structs and methods.

related to elastic#2489

* [beater] Restructure beater package (elastic#2518)

Create several packages inside the beater directory to better organize http framework logic. Adapt tests and code to new structure.

related to elastic#2489

* More beater coverage (elastic#2582)

Co-Authored-By: Gil Raphaelli <[email protected]>
simitt added a commit that referenced this issue Aug 20, 2019
* [beater] Add context handlers and adapt log handling (#2492 )

related to #2201

* [beater] Introduce middleware logic and dedicated monitoring middleware (#2493)

partially implements #2142

* [beater] Improve Response Writing (#2494)

Change response write handling to set a response per context and then call write on the context. Introduce a shared beatertest package with testing helper structs and methods.

related to #2489

* [beater] Restructure beater package (#2518)

Create several packages inside the beater directory to better organize http framework logic. Adapt tests and code to new structure.

related to #2489

* More beater coverage (#2582)

Co-Authored-By: Gil Raphaelli <[email protected]>
@simitt simitt closed this as completed Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants