8000 Add cpu info to serverinfo (#40208) by thomasdarimont · Pull Request #40209 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add cpu info to serverinfo (#40208) #40209

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

Merged
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.keycloak.representations.info;

8000 public class CpuInfoRepresentation {

protected long processorCount;

public static CpuInfoRepresentation create() {
Runtime runtime = Runtime.getRuntime();
CpuInfoRepresentation rep = new CpuInfoRepresentation();
rep.setProcessorCount(runtime.availableProcessors());
return rep;
}

public long getProcessorCount() {
return processorCount;
}

public void setProcessorCount(long processorCount) {
this.processorCount = processorCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
public class ServerInfoRepresentation {

private SystemInfoRepresentation systemInfo;
private CpuInfoRepresentation cpuInfo;
private MemoryInfoRepresentation memoryInfo;
private ProfileInfoRepresentation profileInfo;

Expand Down Expand Up @@ -71,6 +72,14 @@ public void setMemoryInfo(MemoryInfoRepresentation memoryInfo) {
this.memoryInfo = memoryInfo;
}

public CpuInfoRepresentation getCpuInfo() {
return cpuInfo;
}

public void setCpuInfo(CpuInfoRepresentation cpuInfo) {
this.cpuInfo = cpuInfo;
}

public ProfileInfoRepresentation getProfileInfo() {
return profileInfo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,8 @@ protocolTypes.openid-connect=OpenID Connect
clientTypeHelp='OpenID Connect' allows Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server.'SAML' enables web-based authentication and authorization scenarios including cross-domain single sign-on (SSO) and uses security tokens containing assertions to pass information.
addOpenIdProvider=Add OpenID Connect provider
memory=Memory
cpu=CPU
processorCount=Processor Count
eventTypes.CLIENT_LOGIN.name=Client login
mapper.nameid.format.tooltip=This mapper is applied only if the NameID format of the incoming AuthnRequest is equal to this value.
hideOnLoginPageHelp=If hidden, login with this provider is possible only if requested explicitly, for example using the 'kc_idp_hint' parameter.
Expand Down
13 changes: 13 additions & 0 deletions js/apps/admin-ui/src/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ const Dashboard = () => {
</DescriptionListGroup>
</DescriptionList>
</CardBody>
<CardTitle>{t("cpu")}</CardTitle>
<CardBody>
<DescriptionList>
<DescriptionListGroup>
<DescriptionListTerm>
{t("processorCount")}
</DescriptionListTerm>
<DescriptionListDescription>
{serverInfo.cpuInfo?.processorCount}
</DescriptionListDescription>
</DescriptionListGroup>
</DescriptionList>
</CardBody>
<CardTitle>{t("memory")}</CardTitle>
<CardBody>
<DescriptionList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type SystemInfoRepresentation from "./systemInfoRepersantation.js";
*/
export interface ServerInfoRepresentation {
systemInfo?: SystemInfoRepresentation;
cpuInfo?: CpuInfoRepresentation;
memoryInfo?: MemoryInfoRepresentation;
profileInfo?: ProfileInfoRepresentation;
features?: FeatureRepresentation[];
Expand Down Expand Up @@ -63,6 +64,10 @@ export interface MemoryInfoRepresentation {
freeFormated: string;
}

export interface CpuInfoRepresentation {
processorCount: number;
}

export interface ProtocolMapperTypeRepresentation {
id: string;
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.keycloak.representations.idm.ProtocolMapperRepresentation;
import org.keycloak.representations.idm.ProtocolMapperTypeRepresentation;
import org.keycloak.representations.info.ClientInstallationRepresentation;
import org.keycloak.representations.info.CpuInfoRepresentation;
import org.keycloak.representations.info.CryptoInfoRepresentation;
import org.keycloak.representations.info.FeatureRepresentation;
import org.keycloak.representations.info.FeatureType;
Expand Down Expand Up @@ -110,6 +111,7 @@ public ServerInfoAdminResource(KeycloakSession session) {
public ServerInfoRepresentation getInfo() {
ServerInfoRepresentation info = new ServerInfoRepresentation();
info.setSystemInfo(SystemInfoRepresentation.create(session.getKeycloakSessionFactory().getServerStartupTimestamp(), Version.VERSION));
info.setCpuInfo(CpuInfoRepresentation.create());
info.setMemoryInfo(MemoryInfoRepresentation.create());
info.setProfileInfo(createProfileInfo());
info.setFeatures(createFeatureRepresentations());
Expand Down
Loading
0