jina icon indicating copy to clipboard operation
jina copied to clipboard

feat: monitoring bytes

Open samsja opened this issue 2 years ago • 2 comments

Context

one requested metrics is to measure the size in bytes of the requests

issue : https://github.com/jina-ai/jina/issues/4940

┌─────────┐
│ Client  │
└─┬───────┘
  │    ▲
  │    │
  │    │
 A▼    │ F
┌──────┴──┐
│ Gateway │
└─┬───────┘
 B│     ▲  E
  │     │
  │     │
 C▼     │  D
┌───────┴──┐
│ Executor │
└──────────┘

What this pr do

Monitor everywhere the the size of the requests everywhere

Gateway

  • [x] size of the received request (A)
  • [x] size of the send request to a pod (B)
  • [x] size of the return request from a pod (E)
  • [ ] size of the return request to the client (F)

Head :

  • [x] size of the send request to a pod (B)
  • [x] size of the return request from a pod (E)

Executor:

  • [x] size of the received request (C)

  • [x] size of the send request (D)

  • [x] add runtime label in the metrics of the Connection pool

samsja avatar Aug 31 '22 13:08 samsja

Codecov Report

Merging #5111 (4215451) into master (1399e36) will increase coverage by 1.01%. The diff coverage is 92.50%.

@@            Coverage Diff             @@
##           master    #5111      +/-   ##
==========================================
+ Coverage   84.72%   85.73%   +1.01%     
==========================================
  Files         101      103       +2     
  Lines        7108     7166      +58     
==========================================
+ Hits         6022     6144     +122     
+ Misses       1086     1022      -64     
Flag Coverage Δ
jina 85.73% <92.50%> (+1.11%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
jina/serve/helper.py 75.00% <75.00%> (ø)
jina/serve/networking.py 86.00% <89.47%> (-0.02%) :arrow_down:
jina/serve/monitoring.py 100.00% <100.00%> (ø)
jina/serve/runtimes/gateway/request_handling.py 96.64% <100.00%> (+0.21%) :arrow_up:
.../runtimes/request_handlers/data_request_handler.py 94.89% <100.00%> (+1.70%) :arrow_up:
jina/serve/streamer.py 93.87% <100.00%> (+0.12%) :arrow_up:
jina/serve/runtimes/gateway/websocket/gateway.py 98.11% <0.00%> (-1.89%) :arrow_down:
jina/clients/base/http.py 93.24% <0.00%> (-1.36%) :arrow_down:
jina/serve/runtimes/gateway/http/app.py 96.42% <0.00%> (-0.72%) :arrow_down:
jina/orchestrate/deployments/config/k8s.py 100.00% <0.00%> (+0.62%) :arrow_up:
... and 8 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Aug 31 '22 13:08 codecov[bot]

I think these names are confusing:

jina_request_size_bytes

jina_send_request_bytes

Why one has size and not the other?

JoanFM avatar Sep 22 '22 15:09 JoanFM

Accoridng to diagram, in D I would call respond and not send

JoanFM avatar Sep 22 '22 15:09 JoanFM

In the diagram you write in description u do not write about the Head. It can be interesting to see how u approach it there in terms of naming

JoanFM avatar Sep 22 '22 15:09 JoanFM

Accoridng to diagram, in D I would call respond and not send

I see something like this jina_respond_request_bytes instead of jina_send_request_bytes

samsja avatar Sep 22 '22 15:09 samsja

my suggestion regarding naming, is to introduce a breaking change in jina_request_size_bytes and have more clear naming: use received/sent, request/response, just bytes instead of size_bytes + we add runtime name as follows:

(A) jina_request_size_bytes -> gateway_received_request_bytes (B) jina_send_request_bytes -> gateway_sent_request_bytes (E) jina_return_request_bytes -> gateway_received_response_bytes (F) jina_return_client_request_bytes -> gateway_sent_response_bytes

Executor:

(C) jina_request_size_bytes -> worker_received_request_bytes

(D) jina_send_request_bytes -> worker_sent_response_bytes PS: the head metrics should be named same as head imo (just change runtime name)

alaeddine-13 avatar Sep 23 '22 06:09 alaeddine-13

my suggestion regarding naming, is to introduce a breaking change in jina_request_size_bytes and have more clear naming: use received/sent, request/response, just bytes instead of size_bytes + we add runtime name as follows:

(A) jina_request_size_bytes -> gateway_received_request_bytes (B) jina_send_request_bytes -> gateway_sent_request_bytes (E) jina_return_request_bytes -> gateway_received_response_bytes (F) jina_return_client_request_bytes -> gateway_sent_response_bytes

Executor:

(C) jina_request_size_bytes -> worker_received_request_bytes

(D) jina_send_request_bytes -> worker_sent_response_bytes PS: the head metrics should be named same as head imo (just change runtime name)

metric should not include where they come from (worker/gateway) this is the job of label. Name should be unified

Nevertheless I like the received/sent, request/response I will rename to this

samsja avatar Sep 26 '22 09:09 samsja

it may help future readers to add comments above each defined metric with some description

@alaeddine-13 you mean in the documentation ? How would you see it ?

samsja avatar Sep 26 '22 11:09 samsja

it may help future readers to add comments above each defined metric with some description

@alaeddine-13 you mean in the documentation ? How would you see it ?

I meant in the source code

alaeddine-13 avatar Sep 26 '22 11:09 alaeddine-13

:memo: Docs are deployed on https://feat-monitoring-bytes--jina-docs.netlify.app :tada:

github-actions[bot] avatar Sep 27 '22 07:09 github-actions[bot]