Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 92 additions & 61 deletions api/errorgroups/v1/errorgroups.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,104 +13,135 @@ service ErrorGroupsService {
rpc GetDetails(GetDetailsRequest) returns (GetDetailsResponse) {}
rpc GetReleases(GetReleasesRequest) returns (GetReleasesResponse) {}
rpc GetServices(GetServicesRequest) returns (GetServicesResponse) {}
rpc DiffByReleases(DiffByReleasesRequest) returns (DiffByReleasesResponse) {}
}

enum Order {
ORDER_FREQUENT = 0;
ORDER_LATEST = 1;
ORDER_OLDEST = 2;
ORDER_FREQUENT = 0;
ORDER_LATEST = 1;
ORDER_OLDEST = 2;
}

message GetGroupsRequest {
string service = 1;
optional string env = 2;
optional string release = 3;
google.protobuf.Duration duration = 4;
uint32 limit = 5;
uint32 offset = 6;
Order order = 7;
bool with_total = 8;
optional string source = 9;
string service = 1;
optional string env = 2;
optional string release = 3;
google.protobuf.Duration duration = 4;
uint32 limit = 5;
uint32 offset = 6;
Order order = 7;
bool with_total = 8;
optional string source = 9;
}

message GetGroupsResponse {
uint64 total = 1;
repeated Group groups = 2;
uint64 total = 1;
repeated Group groups = 2;
uint64 total_new = 3;
repeated uint64 groups_new = 4;
}

message Group {
uint64 hash = 1;
string message = 2;
uint64 seen_total = 3;
google.protobuf.Timestamp first_seen_at = 4;
google.protobuf.Timestamp last_seen_at = 5;
string source = 6;
uint64 hash = 1;
string message = 2;
uint64 seen_total = 3;
google.protobuf.Timestamp first_seen_at = 4;
google.protobuf.Timestamp last_seen_at = 5;
string source = 6;
}

message GetHistRequest {
string service = 1;
optional uint64 group_hash = 2;
optional string env = 3;
optional string release = 4;
optional google.protobuf.Duration duration = 5;
optional string source = 6;
string service = 1;
optional uint64 group_hash = 2;
optional string env = 3;
optional string release = 4;
optional google.protobuf.Duration duration = 5;
optional string source = 6;
}

message GetHistResponse {
repeated Bucket buckets = 1;
repeated Bucket buckets = 1;
}

message Bucket {
google.protobuf.Timestamp time = 1;
uint64 count = 2;
google.protobuf.Timestamp time = 1;
uint64 count = 2;
}

message GetDetailsRequest {
string service = 1;
uint64 group_hash = 2;
optional string env = 3;
optional string release = 4;
optional string source = 5;
string service = 1;
uint64 group_hash = 2;
optional string env = 3;
optional string release = 4;
optional string source = 5;
}

message GetDetailsResponse {
message Distribution {
string value = 1;
uint64 percent = 2;
}
message Distributions {
repeated Distribution by_env = 1;
repeated Distribution by_release = 2;
}

uint64 group_hash = 1;
string message = 2;
uint64 seen_total = 3;
google.protobuf.Timestamp first_seen_at = 4;
google.protobuf.Timestamp last_seen_at = 5;
Distributions distributions = 6;
map<string, string> log_tags = 7;
string source = 8;
message Distribution {
string value = 1;
uint64 percent = 2;
}

message Distributions {
repeated Distribution by_env = 1;
repeated Distribution by_release = 2;
}

uint64 group_hash = 1;
string message = 2;
uint64 seen_total = 3;
google.protobuf.Timestamp first_seen_at = 4;
google.protobuf.Timestamp last_seen_at = 5;
Distributions distributions = 6;
map<string, string> log_tags = 7;
string source = 8;
}

message GetReleasesRequest {
string service = 1;
reserved 2;
optional string env = 3;
string service = 1;
reserved 2;
optional string env = 3;
}

message GetReleasesResponse {
repeated string releases = 1;
repeated string releases = 1;
}

message GetServicesRequest {
string query = 1;
optional string env = 2;
uint32 limit = 3;
uint32 offset = 4;
string query = 1;
optional string env = 2;
uint32 limit = 3;
uint32 offset = 4;
}

message GetServicesResponse {
repeated string services = 1;
repeated string services = 1;
}

message DiffByReleasesRequest {
string service = 1;
repeated string releases = 2;
optional string env = 3;
optional string source = 4;
uint32 limit = 5;
uint32 offset = 6;
Order order = 7;
bool with_total = 8;
}

message DiffByReleasesResponse {
message ReleaseInfo {
uint64 seen_total = 1;
}

message Group {
uint64 group_hash = 1;
string message = 2;
google.protobuf.Timestamp first_seen_at = 3;
google.protobuf.Timestamp last_seen_at = 4;
map<string, ReleaseInfo> release_infos = 5;
}

uint64 total = 1;
repeated Group groups = 2;
}
1 change: 1 addition & 0 deletions internal/api/errorgroups/v1/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (a *API) Router() chi.Router {
mux.Post("/details", a.serveGetDetails)
mux.Post("/releases", a.serveGetReleases)
mux.Post("/services", a.serveGetServices)
mux.Post("/diff_by_releases", a.serveGetDiffByReleases)

return mux
}
Expand Down
54 changes: 54 additions & 0 deletions internal/api/errorgroups/v1/http/diff_by_releases.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package http

import (
"net/http"
"time"

_ "github.com/ozontech/seq-ui/internal/api/httputil"
)

// serveDiffByReleases go doc.
//
// @Router /errorgroups/v1/diff_by_releases [post]
// @ID errorgroups_v1_diff_by_releases
// @Tags errorgroups_v1
// @Param body body diffByReleasesRequest true "Request body"
// @Success 200 {object} diffByReleasesResponse "A successful response"
// @Failure default {object} httputil.Error "An unexpected error response"
// @Security bearer
func (a *API) serveGetDiffByReleases(w http.ResponseWriter, r *http.Request) {
}

// nolint: unused
type diffByReleasesRequest struct {
Service string `json:"service"`
Releases []string `json:"releases"`
Env *string `json:"env,omitempty"`
Source *string `json:"source,omitempty"`
Limit uint32 `json:"limit"`
Offset uint32 `json:"offset"`
Order order `json:"order"`
WithTotal bool `json:"with_total"`
} // @name errorgroups.v1.DiffByReleasesRequest

// nolint: unused
type diffByReleasesResponse struct {
Total uint64 `json:"total"`
Groups []diffGroup `json:"groups"`
} // @name errorgroups.v1.DiffByReleasesResponse

// nolint: unused
type diffGroup struct {
Hash string `json:"hash" format:"uint64"`
Message string `json:"message"`
FirstSeenAt time.Time `json:"first_seen_at" format:"date-time"`
LastSeenAt time.Time `json:"last_seen_at" format:"date-time"`
Source string `json:"source"`

ReleaseInfos map[string]diffReleaseInfo `json:"release_infos"`
} // @name errorgroups.v1.DiffGroup

// nolint: unused
type diffReleaseInfo struct {
SeenTotal uint64 `json:"seen_total"`
} // @name errorgroups.v1.DiffReleaseInfo
3 changes: 3 additions & 0 deletions internal/api/errorgroups/v1/http/get_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ type getGroupsRequest struct {
type getGroupsResponse struct {
Total uint64 `json:"total"`
Groups []group `json:"groups"`

TotalNew uint64 `json:"total_new"`
GroupsNew []uint64 `json:"groups_new"`
} // @name errorgroups.v1.GetGroupsResponse

type group struct {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/dashboards/v1/dashboards.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/dashboards/v1/dashboards_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading