Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Iter 23-24 #10

Merged
merged 24 commits into from
Apr 23, 2023
Merged

Iter 23-24 #10

merged 24 commits into from
Apr 23, 2023

Conversation

alkurbatov
Copy link
Owner

@alkurbatov alkurbatov commented Apr 17, 2023

Детали реализации инкремента 24

  1. Сервер одновременно предоставляет два вида API: HTTP и GRPC. Адрес и порт gRPC API назначается по аналогии с адресом HTTP API (поддержаны все доступные способы).
  2. Агент отправляет данные либо по HTTP, либо по gRPC (желаемый способ задается через опцию TRANSPORT, поддержаны все доступные способы).
  3. Для работы с gRPC API добавлен проект для Kreya.

Ограничения gRPC API

  • Нет сжатия (думаю, оно тут не нужно).
  • Нет RSA шифрования (непонятно как это делать на уровне gRPC, поддержка сертификатов не требовалась по условиям задания).
  • Нет автоматически сгенерированной документации.

Покрытие сейчас 81%

- Use closures instead of passing channels.
- Remove extra closure around shutdown logic.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Assume that if we can't decrypt request, something is wrong with the client data.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Now it is possible to reject agents requests from not trusted networks.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Since we know how much was read, we can trim not written bytes.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Currently, only Ping method supported.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Also, disable wrapcheck as it doesn't help much.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Also, refactor unit-tests.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Previously we had to provide MetricReq structure of HTTP API.
Now it is possible to use either storage.Record, or plain data for convenience.

Also, refactor and simplify signer's tests and logic.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
In order to simplify the CI routine avoid installation of many
extra tools for code generation.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
@alkurbatov alkurbatov self-assigned this Apr 17, 2023
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
This situation most likely means that something is wrong
with request, not server.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
@alkurbatov alkurbatov force-pushed the iter24 branch 2 times, most recently from 172f649 to 60d8658 Compare April 17, 2023 19:01
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Also, disable musttag as we don't follow it's rules.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
@alkurbatov alkurbatov force-pushed the iter24 branch 2 times, most recently from c87bac8 to ecbb548 Compare April 17, 2023 19:17
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
The autotests have changed and now require the server to return updated metrics
in each response to batch update request. This commit implements proper logic
in both gRPC and HTTP APIs.

Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
Signed-off-by: Alexander Kurbatov <sir.alkurbatov@yandex.ru>
}

service Metrics {
rpc Update(MetricReq) returns (MetricReq);
Copy link

Choose a reason for hiding this comment

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

Лучше делать типы запросов и ответов разными: UpdateRequest, UpdateResponse, GetResponse.
Так если придется обновить один из типов, изменения удастся внести только в один тип, не затрагивая остальные

Copy link
Owner Author

Choose a reason for hiding this comment

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

Согласен, спасибо.

@alkurbatov alkurbatov merged commit c2add7f into main Apr 23, 2023
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants