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

Issue 1712 add status information #1747

Merged
merged 34 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fb5d33b
Update to store status information in the cache.
aindriu-aiven Sep 5, 2023
02c3f5d
Updated caching mechanism to reduce load on recreating all caches fro…
aindriu-aiven Sep 8, 2023
813e75d
Updated caching mechanism to reduce load on recreating all caches fro…
aindriu-aiven Sep 8, 2023
fae81be
Update to add new api endpoints for synchronizing the caches.
aindriu-aiven Sep 8, 2023
315667a
merge from main
aindriu-aiven Sep 8, 2023
506283a
Update minor consistency changes
aindriu-aiven Sep 8, 2023
38b94a9
format typescript
aindriu-aiven Sep 8, 2023
a1f1ec8
Merge branch 'main' of github.com:Aiven-Open/klaw into issue-1712-add…
aindriu-aiven Sep 11, 2023
6aa1f80
Updates from PR
aindriu-aiven Sep 11, 2023
6fb58bd
Addition of secure https communication
aindriu-aiven Sep 11, 2023
77d863c
Addition of secure https communication
aindriu-aiven Sep 11, 2023
05ced44
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Sep 12, 2023
140175c
Address PR Comments
aindriu-aiven Sep 12, 2023
fd57af8
Merge branch 'issue-1712-add-status-information' of github.com:Aiven-…
aindriu-aiven Sep 12, 2023
e03e2de
Updates to add app2app authentication and address a few comments from…
aindriu-aiven Sep 21, 2023
ef3f755
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Sep 21, 2023
f69daaf
Updates to coral to use envStatus
aindriu-aiven Sep 21, 2023
7e95843
fix typo
aindriu-aiven Sep 21, 2023
8306d37
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Sep 22, 2023
8c642b9
Updte formatting to resolve failing tests.
aindriu-aiven Sep 22, 2023
c54669f
Merge branch 'issue-1712-add-status-information' of github.com:Aiven-…
aindriu-aiven Sep 22, 2023
4d259bf
Updates to only exposes HA endpoints when HA is enabled
aindriu-aiven Sep 22, 2023
e3e980d
Add the APIs to coral
aindriu-aiven Sep 22, 2023
4c7091a
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Sep 22, 2023
ea8a2b3
change logging to debug
aindriu-aiven Sep 22, 2023
1e4bb84
Merge branch 'issue-1712-add-status-information' of github.com:Aiven-…
aindriu-aiven Sep 22, 2023
ef06588
fix formatting issue
aindriu-aiven Sep 22, 2023
4bbd37a
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Sep 26, 2023
b084f90
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Sep 26, 2023
65637a7
Update to make changes from PR feedback also updates to include the t…
aindriu-aiven Sep 26, 2023
1455587
Merge branch 'issue-1712-add-status-information' of github.com:Aiven-…
aindriu-aiven Sep 26, 2023
1a9a5c2
Update to alter the envStatusTimeString
aindriu-aiven Sep 26, 2023
2fb204a
Update to correct strings in coral tests
aindriu-aiven Sep 27, 2023
694e87f
Merge branch 'main' into issue-1712-add-status-information
aindriu-aiven Oct 4, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "DEV",
envStatus: "OFFLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
otherParams: "",
showDeleteEnv: false,
totalNoPages: "1",
Expand Down Expand Up @@ -66,6 +67,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "DEV_CLS",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
otherParams: "",
showDeleteEnv: false,
totalNoPages: "1",
Expand Down Expand Up @@ -98,6 +100,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "TST",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
otherParams:
"default.partitions=2,max.partitions=2,default.replication.factor=1,max.replication.factor=1,topic.prefix=,topic.suffix=",
showDeleteEnv: false,
Expand Down Expand Up @@ -131,6 +134,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "DEV",
envStatus: "OFFLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
otherParams: "",
showDeleteEnv: false,
totalNoPages: "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "TST_CONNCT",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
showDeleteEnv: false,
totalNoPages: "1",
currentPage: "1",
Expand All @@ -55,6 +56,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "DEV",
envStatus: "OFFLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
showDeleteEnv: false,
totalNoPages: "1",
currentPage: "1",
Expand All @@ -72,6 +74,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "UIKLAW",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
showDeleteEnv: false,
totalNoPages: "1",
currentPage: "1",
Expand All @@ -89,6 +92,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "UIKLAW",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
showDeleteEnv: false,
totalNoPages: "1",
currentPage: "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "TST_SCHEMA",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
showDeleteEnv: false,
totalNoPages: "1",
currentPage: "1",
Expand All @@ -59,6 +60,7 @@ const mockedEnvironmentsResponse: EnvironmentPaginatedApiResponse =
tenantName: "default",
clusterName: "DEV_CLS",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we don't also want a requesttimestring property as we have for the[entity]RequestsResponseModel. We can parse it on the front end, but then we have a potential for divergence if the formatting changes in one of the two spots we are now doing time formatting in :o

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am adding in entStatusRequestedAtTime

Copy link
Contributor

@mathieu-anderson mathieu-anderson Sep 26, 2023

Choose a reason for hiding this comment

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

I'm sorry, I didn't mean to add the time of the request, but having the envStatusTime formatted in the same way as requesttimestring 🙇 Maybe the following is already what is happening, but the test values express a different thing: https://github.com/Aiven-Open/klaw/pull/1747/files#diff-df59e5cc730be0ccaca740fec7b48fdf327c4430601001cf99da3813e39f32d7R42

The difference between these two: https://github.com/Aiven-Open/klaw/blob/main/openapi.yaml#L7062-L7068

Is that one is the undformatted timestamp (requesttime) and the other is a formatted string expressing the time in the UTC tz (requesttimestring)

We are currently doing no parsing of timestamps in the FE, only rendering the already formatted requesttimestring:

Screenshot 2023-09-26 at 13 33 28

And I thought we might do the same for the envStatusTime timestamp: same time, but formatted differently.

showDeleteEnv: false,
totalNoPages: "1",
currentPage: "1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe("EnvironmentStatus", () => {
mockGetUpdateEnvStatus.mockResolvedValue({
result: "success",
envStatus: "ONLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
});

expect(screen.getByText("Working")).toBeVisible();
Expand All @@ -108,6 +109,7 @@ describe("EnvironmentStatus", () => {
mockGetUpdateEnvStatus.mockResolvedValue({
result: "success",
envStatus: "OFFLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
});

expect(screen.getByText("Working")).toBeVisible();
Expand Down Expand Up @@ -152,6 +154,7 @@ describe("EnvironmentStatus", () => {
mockGetUpdateEnvStatus.mockResolvedValue({
result: "success",
envStatus: "OFFLINE",
envStatusTime: "2023-09-21T11:47:15.664615239",
});

expect(screen.getByText("Working")).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("environment-test-helper.ts", () => {
defaultPartitions: undefined,
defaultReplicationFactor: undefined,
envStatus: "ONLINE",
envStatusTime: "2023-09-08T12:34:10.615919098",
id: "1",
maxPartitions: undefined,
maxReplicationFactor: undefined,
Expand Down
1 change: 1 addition & 0 deletions coral/src/domain/environment/environment-test-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const defaultEnvironmentDTO: KlawApiModel<"EnvModelResponse"> = {
tenantName: "default",
clusterName: "DEV",
envStatus: "ONLINE",
envStatusTime: "2023-09-08T12:34:10.615919098",
otherParams:
"default.partitions=2,max.partitions=2,default.replication.factor=1,max.replication.factor=1,topic.prefix=,topic.suffix=",
showDeleteEnv: false,
Expand Down
20 changes: 19 additions & 1 deletion coral/src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ const API_PATHS = {
| "getKafkaEnv"
| "getKafkaConnectEnv"
| "getSchemaRegEnv"
| "addEnvToCache"
| "removeEnvFromCache"
>]: keyof ApiPaths;
};

Expand All @@ -223,6 +225,14 @@ type GetTopicRequest = (params: { topicReqId: string }) => keyof ApiPaths;
type GetKafkaEnv = (params: { envId: string }) => keyof ApiPaths;
type GetConnectEnv = (params: { envId: string }) => keyof ApiPaths;
type GetSchemaRegEnv = (params: { envId: string }) => keyof ApiPaths;
type AddEnvToCache = (params: {
tenantId: string;
id: string;
}) => keyof ApiPaths;
type RemoveEnvFromCache = (params: {
tenantId: string;
id: string;
}) => keyof ApiPaths;

const DYNAMIC_API_PATHS = {
getSchemaOfTopicFromSource: ({
Expand All @@ -242,6 +252,10 @@ const DYNAMIC_API_PATHS = {
`/environments/kafkaconnect/${envId}` as keyof ApiPaths,
getSchemaRegEnv: ({ envId }: Parameters<GetSchemaRegEnv>[0]) =>
`/environments/schemaRegistry/${envId}` as keyof ApiPaths,
addEnvToCache: ({ tenantId, id }: Parameters<AddEnvToCache>[0]) =>
`/cache/tenant/${tenantId}/entityType/environment/id/${id}` as keyof ApiPaths,
removeEnvFromCache: ({ tenantId, id }: Parameters<RemoveEnvFromCache>[0]) =>
`/cache/tenant/${tenantId}/entityType/environment/id/${id}` as keyof ApiPaths,
} satisfies {
[key in keyof Pick<
ApiOperations,
Expand All @@ -251,13 +265,17 @@ const DYNAMIC_API_PATHS = {
| "getKafkaEnv"
| "getKafkaConnectEnv"
| "getSchemaRegEnv"
| "addEnvToCache"
| "removeEnvFromCache"
>]:
| GetSchemaOfTopicFromSource
| GetSwitchTeams
| GetTopicRequest
| GetKafkaEnv
| GetConnectEnv
| GetSchemaRegEnv;
| GetSchemaRegEnv
| AddEnvToCache
| RemoveEnvFromCache;
};

type Params = URLSearchParams;
Expand Down
105 changes: 87 additions & 18 deletions coral/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ export type paths = {
"/chPwd": {
post: operations["changePwd"];
};
"/cache/tenant/{tenantId}/entityType/environment/id/{id}": {
post: operations["addEnvToCache"];
delete: operations["removeEnvFromCache"];
};
"/addTenantId": {
post: operations["addTenantId"];
};
Expand Down Expand Up @@ -884,6 +888,40 @@ export type components = {
envId: string;
includeOnlyFailedTasks: boolean;
};
Env: {
id?: string;
/** Format: int32 */
tenantId?: number;
name?: string;
stretchCode?: string;
/** Format: int32 */
clusterId?: number;
type?: string;
otherParams?: string;
envExists?: string;
/** @enum {string} */
envStatus?: "OFFLINE" | "ONLINE" | "NOT_KNOWN";
/** Format: date-time */
envStatusTime?: string;
associatedEnv?: components["schemas"]["EnvTag"];
params?: components["schemas"]["EnvParams"];
};
EnvParams: {
defaultPartitions?: string;
maxPartitions?: string;
partitionsList?: (string)[];
defaultRepFactor?: string;
maxRepFactor?: string;
replicationFactorList?: (string)[];
topicPrefix?: (string)[];
topicSuffix?: (string)[];
topicRegex?: (string)[];
applyRegex?: boolean;
};
EnvTag: {
id?: string;
name?: string;
};
KwTenantModel: {
tenantName: string;
tenantDesc: string;
Expand Down Expand Up @@ -911,22 +949,6 @@ export type components = {
tenantId?: number;
params?: components["schemas"]["EnvParams"];
};
EnvParams: {
defaultPartitions?: string;
maxPartitions?: string;
partitionsList?: (string)[];
defaultRepFactor?: string;
maxRepFactor?: string;
replicationFactorList?: (string)[];
topicPrefix?: (string)[];
topicSuffix?: (string)[];
topicRegex?: (string)[];
applyRegex?: boolean;
};
EnvTag: {
id?: string;
name?: string;
};
KwClustersModel: {
/** Format: int32 */
clusterId?: number;
Expand Down Expand Up @@ -1126,6 +1148,8 @@ export type components = {
result: string;
/** @enum {string} */
envStatus: "OFFLINE" | "ONLINE" | "NOT_KNOWN";
/** Format: date-time */
envStatusTime: string;
};
TopicsCountPerEnv: {
status?: string;
Expand Down Expand Up @@ -1219,8 +1243,8 @@ export type components = {
hasSchema: boolean;
/** Format: int32 */
clusterId: number;
topicOwner?: boolean;
highestEnv?: boolean;
topicOwner?: boolean;
};
TopicBaseConfig: {
topicName: string;
Expand Down Expand Up @@ -1384,6 +1408,8 @@ export type components = {
clusterName: string;
/** @enum {string} */
envStatus: "OFFLINE" | "ONLINE" | "NOT_KNOWN";
/** Format: date-time */
envStatusTime: string;
otherParams: string;
showDeleteEnv: boolean;
totalNoPages: string;
Expand Down Expand Up @@ -2833,6 +2859,49 @@ export type operations = {
};
};
};
addEnvToCache: {
parameters: {
header: {
Authorization: string;
};
path: {
tenantId: number;
id: number;
};
};
requestBody: {
content: {
"application/json": components["schemas"]["Env"];
};
};
responses: {
/** @description OK */
200: {
content: {
"application/json": components["schemas"]["ApiResponse"];
};
};
};
};
removeEnvFromCache: {
parameters: {
header: {
Authorization: string;
};
path: {
tenantId: number;
id: number;
};
};
responses: {
/** @description OK */
200: {
content: {
"application/json": components["schemas"]["ApiResponse"];
};
};
};
};
addTenantId: {
requestBody: {
content: {
Expand Down Expand Up @@ -3731,7 +3800,7 @@ export type operations = {
getEnvParams: {
parameters: {
query: {
envSelected: string;
envSelected: number;
};
};
responses: {
Expand Down
Loading