This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
generated from yandex-praktikum/go-musthave-devops-tpl
-
Notifications
You must be signed in to change notification settings - Fork 0
Iter 23-24 #10
Merged
Merged
Iter 23-24 #10
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
ce5d1b5
ref: Use common approach to shutdown agent and server
alkurbatov 2baad00
fix: Change DecryptRequest status code on failure
alkurbatov 1819a36
tests: Implement unit tests for DecryptRequest middleware
alkurbatov 4461470
feat: Implement increment 23
alkurbatov e770cac
ref: Update golangci-lint and fix new errors
alkurbatov c0c6e2c
perf: Avoid buffer recreation during Encrypt/Decrypt
alkurbatov 64c6341
feat: Implement support of gRPC API
alkurbatov 10eec4c
feat: Implement Update and Get metric in gRPC API
alkurbatov 999848e
feat: Support batch updates in gRPC API
alkurbatov 4b077c3
tests: Add unit tests for config.LoadFromFile
alkurbatov af04933
feat: Support gRPC transport in Agent
alkurbatov e341c94
feat: Implement requests logging for gRPC API
alkurbatov 0caa215
feat: Support requests filtering by subnet in gRPC API
alkurbatov e432d64
ref: Make it possible to sign/verify signature of arbitrary data
alkurbatov 512f678
feat: Support signature verification in gRPC API
alkurbatov 8aaee76
ref: Include gRPC autogenerated code into git
alkurbatov f4b9b0b
chore: Update version of autotest binary
alkurbatov e82752b
fix: Return BadRequest if we failed to decompress request
alkurbatov 7cc41ac
test: Add tests for compression package
alkurbatov 467fe3a
fix: Downgrade golangci-lint as it breaks in CI environment
alkurbatov 446840b
fix: Avoid VCS stamping error when linting files in CI
alkurbatov 7976a9f
tests: Add unit-tests for file backed storage
alkurbatov 3a0d5b9
feat: Return list of updated metrics in response to batch update
alkurbatov e0c3616
feat (agent): Shutdown client gRPC connection gracefully
alkurbatov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ vendor/ | |
.DS_Store | ||
|
||
# Public/private keys for communications encryption | ||
build/keys | ||
build/keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"id": "5cf6f40c-e242-418f-a8f3-2cf627269ad0", | ||
"color": "#60A5FA", | ||
"globalContent": { | ||
"grpc_endpoint": "::50051" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"id": "1391c613-27e1-4895-9db8-2af74f3edee3", | ||
"importStreams": [ | ||
{ | ||
"id": "8697db12-5cc2-4fb7-a80b-5579c72e685c", | ||
"name": "grpc-proto", | ||
"importerName": "ProtoFile", | ||
"createMissingOperations": true, | ||
"options": { | ||
"files": [ | ||
"../proto" | ||
], | ||
"importPaths": [] | ||
} | ||
} | ||
], | ||
"authConfigs": [], | ||
"certificates": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"details": { | ||
"methodFqn": "metrics.collector.v1.Health.Ping" | ||
}, | ||
"requests": [ | ||
{ | ||
"location": "Ping-request.json" | ||
} | ||
], | ||
"operationType": "unary", | ||
"invokerName": "grpc", | ||
"importStreamId": "8697db12-5cc2-4fb7-a80b-5579c72e685c" | ||
} |
14 changes: 14 additions & 0 deletions
14
api/kreya/metrics/collector/v1/Metrics/BatchUpdate-request.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"id": "PollCount", | ||
"mtype": "counter", | ||
"delta": 452 | ||
}, | ||
{ | ||
"id": "Alloc", | ||
"mtype": "gauge", | ||
"value": 568.2049356225625 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"details": { | ||
"methodFqn": "metrics.collector.v1.Metrics.BatchUpdate" | ||
}, | ||
"requests": [ | ||
{ | ||
"location": "BatchUpdate-request.json" | ||
} | ||
], | ||
"operationType": "unary", | ||
"invokerName": "grpc", | ||
"importStreamId": "8697db12-5cc2-4fb7-a80b-5579c72e685c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"id": "MyTest", | ||
"mtype": "gauge" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"details": { | ||
"methodFqn": "metrics.collector.v1.Metrics.Get" | ||
}, | ||
"requests": [ | ||
{ | ||
"location": "Get-request.json" | ||
} | ||
], | ||
"operationType": "unary", | ||
"invokerName": "grpc", | ||
"importStreamId": "8697db12-5cc2-4fb7-a80b-5579c72e685c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"id": "MyTest", | ||
"mtype": "gauge", | ||
"delta": "72", | ||
"value": 670.4969946687745 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"details": { | ||
"methodFqn": "metrics.collector.v1.Metrics.Update" | ||
}, | ||
"requests": [ | ||
{ | ||
"location": "Update-request.json" | ||
} | ||
], | ||
"operationType": "unary", | ||
"invokerName": "grpc", | ||
"importStreamId": "8697db12-5cc2-4fb7-a80b-5579c72e685c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"settings": [ | ||
{ | ||
"options": { | ||
"rest": { | ||
"pathParams": [] | ||
} | ||
} | ||
}, | ||
{ | ||
"environmentId": "5cf6f40c-e242-418f-a8f3-2cf627269ad0", | ||
"options": { | ||
"grpc": { | ||
"endpoint": "http://localhost:50051", | ||
"mode": "grpc", | ||
"disableServerCertificateValidation": true | ||
}, | ||
"rest": { | ||
"pathParams": [] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
|
||
package metrics.collector.v1; | ||
option go_package = "github.com/alkurbatov/metrics-collector/grpcapi"; | ||
|
||
import "google/protobuf/empty.proto"; | ||
|
||
service Health { | ||
rpc Ping(google.protobuf.Empty) returns (google.protobuf.Empty); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
syntax = "proto3"; | ||
|
||
package metrics.collector.v1; | ||
option go_package = "github.com/alkurbatov/metrics-collector/grpcapi"; | ||
|
||
// NB (alkurbatov): The name was intentionally choosen to match the similar structure | ||
// from HTTP API for convenience. | ||
message MetricReq { | ||
string id = 1; | ||
string mtype = 2; | ||
int64 delta = 3; | ||
double value = 4; | ||
string hash = 5; | ||
} | ||
|
||
message GetMetricRequest { | ||
string id = 1; | ||
string mtype = 2; | ||
} | ||
|
||
message BatchUpdateRequest { | ||
repeated MetricReq data = 1; | ||
} | ||
|
||
message BatchUpdateResponse { | ||
repeated MetricReq data = 1; | ||
} | ||
|
||
service Metrics { | ||
rpc Update(MetricReq) returns (MetricReq); | ||
rpc BatchUpdate(BatchUpdateRequest) returns (BatchUpdateResponse); | ||
|
||
rpc Get(GetMetricRequest) returns (MetricReq); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
{ | ||
"address": "localhost:8080", | ||
"grpc_address": "localhost:8080", | ||
"restore": true, | ||
"store_interval": "1s", | ||
"store_file": "/path/to/file.db", | ||
"database_dsn": "", | ||
"crypto_key": "./build/keys/private.pem", | ||
"trusted_subnet": "192.168.0.0/16", | ||
"debug": true | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Лучше делать типы запросов и ответов разными: UpdateRequest, UpdateResponse, GetResponse.
Так если придется обновить один из типов, изменения удастся внести только в один тип, не затрагивая остальные
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Согласен, спасибо.