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

New logs service with GetLogs API stub #9738

Merged
merged 10 commits into from Feb 22, 2024
Merged

Conversation

zmajeed
Copy link
Contributor

@zmajeed zmajeed commented Feb 14, 2024

Minimal changes for new logs service with single GetLogs API that has all the messages and types defined in logs.proto but only returns a dummy response for simple testing

@zmajeed zmajeed requested review from a team as code owners February 14, 2024 20:14
@zmajeed zmajeed marked this pull request as draft February 14, 2024 20:22
@jrockway jrockway requested review from jrockway and removed request for avigil February 14, 2024 20:23
Copy link
Member

@jrockway jrockway left a comment

Choose a reason for hiding this comment

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

Looks good.

bazel run //:gazelle is necessary. After that, expose logs.proto to the proto generator by adding a rule in src/logs/BUILD.bazel like:

filegroup(
    name = "protos",
    srcs = glob(["*.proto"]),
    visibility = ["//src:__pkg__"],
)

Then in src/BUILD.bazel, add //src/logs:protos to the srcs of all_protos. Run bazel run //:buildifier to make sure the srcs list is sorted (otherwise //:buildifier_test will fail).

@zmajeed zmajeed marked this pull request as ready for review February 14, 2024 22:35
@@ -85,6 +86,9 @@ type TransactionAPIClient transaction.APIClient
// DebugClient is an alias of debug.DebugClient
type DebugClient debug.DebugClient

// LogsClient is an alias of logs.APIClient
Copy link
Contributor

Choose a reason for hiding this comment

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

I would not add anything to the external client library. Users should just access our API via the Go gRPC bindings.

@@ -98,6 +102,7 @@ type APIClient struct {
AdminAPIClient
TransactionAPIClient
DebugClient
LogsClient
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that you’re just copying the existing pattern here, which is fine, but I think that you should consider just adding a member rather than embedding here. I don’t think that there’s a need for embedding in this case — it just means being able to call logs.APIClient methods on a Client instance, when they don’t overlap with some other embedded type’s methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no client changes now

message ParsedJSONLogMessage {
VerbatimLogMessage verbatim = 1; // The verbatim line from Loki.
//map<string, google.protobuf.Any> fields = 2; // A raw JSON parse of the entire line.
map<string, string> fields = 2; // A raw JSON parse of the entire line.
Copy link
Contributor

Choose a reason for hiding this comment

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

The assumption here is that the JSON property values will always be strings. Is that guaranteed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to protobuf Struct

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (faf04ed) 59.13% compared to head (8ce081c) 59.01%.
Report is 1 commits behind head on master.

Files Patch % Lines
src/client/transaction.gen.go 0.00% 2 Missing ⚠️
src/internal/client/transaction.gen.go 0.00% 2 Missing ⚠️
src/internal/pachd/builder.go 66.66% 1 Missing and 1 partial ⚠️
src/internal/restgateway/restgateway.go 50.00% 1 Missing ⚠️
src/internal/testpachd/mock_pachd.go 85.71% 1 Missing ⚠️
src/server/logs/server/api_server.go 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9738      +/-   ##
==========================================
- Coverage   59.13%   59.01%   -0.12%     
==========================================
  Files         582      583       +1     
  Lines       69908    69941      +33     
==========================================
- Hits        41338    41278      -60     
- Misses      27987    28089     +102     
+ Partials      583      574       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@bbonenfant bbonenfant left a comment

Choose a reason for hiding this comment

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

No issues with this, but a couple of requests/questions:

  1. Is this intended to be customer facing? Should the client expose this? Any new APIs (proto files) need to be manually exposed within the python client.
  • if Yes: then make a ticket with the INT team so that we can get this exposed and maybe tested,
  • If No: then I can show you where to disable the python generation for this file.
  1. Please move the comments/documentation to be above the fields. That's where the parser expects the documentation to be. Being inline now, none of this important information is making it into the generated python code.

LOG_FORMAT_PPS_LOGMESSAGE = 3;
}

message GetLogsRequest {
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is the "entrance point" to the new RPC, could each of these fields get a little documentation? Additionally, could you move the comment above the field instead of inline? It makes the file longer, but the parser expects documentation for fields to be the line(s) immediately above the field definition.

string job = 2;
}

message PipelineDatumLogQuery {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@zmajeed zmajeed requested a review from a team as a code owner February 21, 2024 15:34
@zmajeed zmajeed force-pushed the zmajeed_logs_service_api_1 branch 2 times, most recently from 2fe663f to 5db2a45 Compare February 21, 2024 19:24
@zmajeed
Copy link
Contributor Author

zmajeed commented Feb 22, 2024

will add more documentation in following PRs

@FahadBSyed
Copy link
Contributor

Could you provide some context on the reasoning or motivation behind this change? Other than that, the code itself looks good.

@zmajeed
Copy link
Contributor Author

zmajeed commented Feb 22, 2024

It's a GetLogs API improvement

@zmajeed zmajeed merged commit 1fb5812 into master Feb 22, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants