Skip to content

Commit

Permalink
[pinpoint-apm#9317] Change api for agent-management page
Browse files Browse the repository at this point in the history
  • Loading branch information
binDongKim committed Dec 15, 2022
1 parent 69981a4 commit 4c35651
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ import { Observable } from 'rxjs';

@Injectable()
export class RemovableAgentDataService {
private listUrl = 'getAgentList.pinpoint';
private listUrl = 'agents/search-application.pinpoint';
private removeApplicationUrl = 'admin/removeApplicationName.pinpoint';
private removeAgentUrl = 'admin/removeAgentId.pinpoint';
// private removeInactiveUrl = 'admin/removeInactiveAgents.pinpoint';

constructor(
private http: HttpClient
) {}

getAgentList(appName: string): Observable<IAgentList> {
return this.http.get<IAgentList>(this.listUrl, {
getAgentList(appName: string): Observable<IServerAndAgentDataV2[]> {
return this.http.get<IServerAndAgentDataV2[]>(this.listUrl, {
params: new HttpParams().set('application', appName)
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class RemovableAgentListContainerComponent implements OnInit, OnDestroy {
useDisable = false;
showLoading = false;
errorMessage: string;
agentList$: Observable<{[key: string]: any}>;
agentList$: Observable<any[]>;
selectedApplication: IApplication = null;
removeAgent: string;
i18nText: {[key: string]: string} = {
Expand Down Expand Up @@ -73,15 +73,15 @@ export class RemovableAgentListContainerComponent implements OnInit, OnDestroy {
).pipe(
tap(() => this.showProcessing()),
switchMap(() => this.removableAgentDataService.getAgentList(this.selectedApplication.getApplicationName()).pipe(
map((data: IAgentList) => {
return Object.entries(data).reduce((acc: {[key: string]: any}[], [key, value]: [string, IAgent[]]) => {
return [...acc, ...value.map((agent: IAgent) => {
map((data: IServerAndAgentDataV2[]) => {
return data.map(({instancesList}: IServerAndAgentDataV2) => {
return instancesList.map((agent: IAgentDataV2) => {
const {applicationName, hostName, agentId, agentName, agentVersion, startTimestamp, ip} = agent;
const agentNameText = agentName ? agentName : 'N/A';

return {applicationName, hostName, agentId, agentNameText, agentVersion, startTimestamp, ip};
})];
}, []);
})
}).flat();
}),
catchError((error: IServerError) => {
this.errorMessage = error.message;
Expand Down
31 changes: 31 additions & 0 deletions web/src/main/angular/src/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ interface ISelectedRowInfo {
agentId?: string;
}
// @store

interface IServerAndAgentData {
agentId: string;
agentName?: string;
Expand Down Expand Up @@ -329,6 +330,36 @@ interface IServerAndAgentData {
vmVersion: string;
}

interface IServerAndAgentDataV2 {
groupName: string;
instancesList: IAgentDataV2[];
}

interface IAgentDataV2 {
agentId: string;
agentName: string;
agentVersion: string;
applicationName: string;
container: boolean;
hostName: string;
ip: string;
linkList: any[];
pid: number;
ports: string;
serviceType: string;
serviceTypeCode: number;
startTimestamp: number;
status: {
agentId: string;
eventTimestamp: number;
state: {
code: number;
desc: string;
}
};
vmVersion: string;
}

// @store
interface ISyntaxHighlightData {
type: string;
Expand Down
4 changes: 3 additions & 1 deletion web/src/main/angular/src/proxy.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ const PROXY_CONFIG = [
"/getApplicationStat/apdexScore/chart.pinpoint",
"/getAgentStat/apdexScore/chart.pinpoint",
"/uriStat/top50.pinpoint",
"/uriStat/chart.pinpoint"
"/uriStat/chart.pinpoint",
"/agents/search-all",
"/agents/search-application"
],
target: 'http://localhost:8080',
secure: false
Expand Down

0 comments on commit 4c35651

Please sign in to comment.