Skip to content
This repository has been archived by the owner on May 31, 2022. It is now read-only.

feat(http): access logs and x-sendfile support #56

Merged
merged 6 commits into from
Oct 6, 2021

Conversation

rustatian
Copy link
Member

@rustatian rustatian commented Oct 5, 2021

Reason for This PR

closes: #9
closes: #34

Description of Changes

  • Add support for the access logs at Info log level.
    Fields:
    method - http method.
    remote_addr - request remote address.
    bytes_sent - content-length,
    http_host - host.
    request - request Query.
    time_local - local time in Common Log Format.
    request_length - request body with headers size (content-len + size of all headers) in bytes. Max allowed headers size for the RR is 1MB.
    request_time - request processing time in seconds with a milliseconds resolution.
    status - http response status.
    http_user_agent - http user agent
    http_referer - http referer

  • ✏️ Access logs turned off by default, to turn on, please, use the following field in the configuration:

http:
  address: 127.0.0.1:58332
  max_request_size: 1024
  access_logs: true <----------------- NEW
  middleware: [ ]
  pool:
    num_workers: 2
    max_jobs: 0
    allocate_timeout: 60s
    destroy_timeout: 60s
  • ✏️ HTTP middleware to handle Symfony's X-Sendfile header.
http:
  address: 127.0.0.1:44444
  max_request_size: 1024
  middleware: ["sendfile"] <----- NEW MIDDLEWARE

  pool:
    num_workers: 2
    max_jobs: 0
    allocate_timeout: 60s
    destroy_timeout: 60s

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian requested a review from wolfy-j October 5, 2021 14:03
@rustatian rustatian self-assigned this Oct 5, 2021
@rustatian rustatian added C-enhancement Category: enhancement. Meaning improvements of current module, transport, etc.. P-HTTP Plugin: HTTP R-beta Release: Nominated for backporting to the RR in the beta channel. labels Oct 5, 2021
@rustatian rustatian added this to In progress in RoadRunner via automation Oct 5, 2021
@rustatian rustatian added this to the v2.5.0 milestone Oct 5, 2021
@rustatian rustatian added this to SPRINT 2021-10-15 [IN_PROGRESS] in RoadRunner Sprints Oct 5, 2021
Update dependencies

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@codecov
Copy link

codecov bot commented Oct 5, 2021

Codecov Report

Merging #56 (3d0f439) into master (2c385f7) will increase coverage by 0.22%.
The diff coverage is 91.17%.

❗ Current head 3d0f439 differs from pull request most recent head bfcb6fd. Consider uploading reports for the commit bfcb6fd to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   67.48%   67.71%   +0.22%     
==========================================
  Files         110      110              
  Lines        9233     9294      +61     
==========================================
+ Hits         6231     6293      +62     
  Misses       2376     2376              
+ Partials      626      625       -1     
Impacted Files Coverage Δ
http/config/http.go 55.23% <ø> (ø)
http/middleware/gzip/plugin.go 88.88% <ø> (ø)
http/middleware/headers/plugin.go 86.48% <ø> (ø)
http/middleware/static/config.go 66.66% <ø> (ø)
http/middleware/static/etag.go 65.90% <ø> (ø)
http/middleware/static/plugin.go 69.90% <ø> (ø)
http/handler/request.go 77.63% <50.00%> (-0.30%) ⬇️
http/ssl.go 36.11% <50.00%> (ø)
http/handler/handler.go 83.40% <90.90%> (+3.72%) ⬆️
http/http.go 45.00% <100.00%> (ø)
... and 6 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 2c385f7...bfcb6fd. Read the comment docs.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian added the D-driver Driver for the RR plugin label Oct 5, 2021
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian marked this pull request as ready for review October 5, 2021 20:36
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian merged commit a5b3b2b into master Oct 6, 2021
RoadRunner automation moved this from In progress to Done Oct 6, 2021
@bors bors bot deleted the feat/logs_x-sendfile branch October 6, 2021 07:09
@rustatian rustatian removed this from SPRINT 2021-10-15 [DONE] in RoadRunner Sprints Jan 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-enhancement Category: enhancement. Meaning improvements of current module, transport, etc.. D-driver Driver for the RR plugin P-HTTP Plugin: HTTP R-beta Release: Nominated for backporting to the RR in the beta channel.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Access logs [FEATURE REQUEST] Support X-Sendfile Header
1 participant