diff --git a/analytics-service/c8y_agent.py b/analytics-service/c8y_agent.py index ef72155..347a6fe 100644 --- a/analytics-service/c8y_agent.py +++ b/analytics-service/c8y_agent.py @@ -52,16 +52,16 @@ def restart_cep(self, request_headers): self._logger.info(f"Restarted CEP!") - def get_cep_id(self, request_headers): + def get_cep_operationobject_id(self, request_headers): try: - self._logger.info(f"Retrieving id of service object for CEP ...") + self._logger.info(f"Retrieving id of operation object for CEP ...") response = self.c8yapp.get_tenant_instance(headers=request_headers).get( resource=f"/service/cep/diagnostics/apamaCtrlStatus") try: app_id = response["microservice_application_id"] microservice_name = response["microservice_name"] - cep_id = None + cep_operationobject_id = None query = f"applicationId eq '{app_id}' and name eq '{microservice_name}'" self._logger.info(f"Build filter: {query}") @@ -75,12 +75,12 @@ def get_cep_id(self, request_headers): f"Found managed object: {managed_object.id} for cep app: {app_id}" ) managed_object_id = managed_object - cep_id = managed_object_id.id + cep_operationobject_id = managed_object_id.id break if managed_object_id == None: self._logger.error(f"Not found !") return None - return {"id": cep_id} + return {"id": cep_operationobject_id} except: self._logger.error( f"Error finding app id: {app_id}", diff --git a/analytics-service/flask_wrapper.py b/analytics-service/flask_wrapper.py index fde12f4..4742293 100644 --- a/analytics-service/flask_wrapper.py +++ b/analytics-service/flask_wrapper.py @@ -212,8 +212,8 @@ def get_cep_extension_metadata(): # returns: # id @app.route("/cep/id", methods=["GET"]) -def get_cep_id(): - result = agent.get_cep_id(request_headers=request.headers) +def get_cep_operationobject_id(): + result = agent.get_cep_operationobject_id(request_headers=request.headers) if (result == None): return f"Not found", 400 return jsonify(result) diff --git a/analytics-ui/src/monitoring/engine-monitoring.component.ts b/analytics-ui/src/monitoring/engine-monitoring.component.ts index 85a7b98..33832bb 100644 --- a/analytics-ui/src/monitoring/engine-monitoring.component.ts +++ b/analytics-ui/src/monitoring/engine-monitoring.component.ts @@ -19,7 +19,7 @@ import { HumanizePipe, PropertiesListItem } from '@c8y/ngx-components'; encapsulation: ViewEncapsulation.None }) export class EngineMonitoringComponent implements OnInit { - cepId: string; + cepOperationObjectId: string; cepCtrlStatusLabels$: BehaviorSubject = new BehaviorSubject([]); @Output() closeSubject: Subject = new Subject(); @@ -47,7 +47,7 @@ export class EngineMonitoringComponent implements OnInit { const humanize = new HumanizePipe(); this.init(); - this.cepId = await this.analyticsService.getCEP_Id(); + this.cepOperationObjectId = await this.analyticsService.getCEP_OperationObject(); const cepCtrlStatus = await this.analyticsService.getCEP_Status(); const cepCtrlStatusLabels = []; Object.keys(cepCtrlStatus).forEach((key) => { @@ -66,13 +66,13 @@ export class EngineMonitoringComponent implements OnInit { const filterAlarm: object = { pageSize: 5, - source: this.cepId, + source: this.cepOperationObjectId, currentPage: 1, withTotalPages: true }; const filterEvent: object = { pageSize: 5, - source: this.cepId, + source: this.cepOperationObjectId, currentPage: 1, withTotalPages: true }; @@ -106,7 +106,7 @@ export class EngineMonitoringComponent implements OnInit { } private async init() { - this.cepId = await this.analyticsService.getCEP_Id(); + this.cepOperationObjectId = await this.analyticsService.getCEP_OperationObject(); } nextPageAlarm(direction: number) { diff --git a/analytics-ui/src/shared/analytics.service.ts b/analytics-ui/src/shared/analytics.service.ts index e682b9e..a1af1a8 100644 --- a/analytics-ui/src/shared/analytics.service.ts +++ b/analytics-ui/src/shared/analytics.service.ts @@ -40,7 +40,7 @@ import { isCustomCEP_Block, removeFileExtension } from './utils'; export class AnalyticsService { appDeleted = new EventEmitter(); progress: BehaviorSubject = new BehaviorSubject(null); - private _cepId: Promise; + private _cepOperationObjectId: Promise; private _cepStatus: Promise; private _blocksDeployed: Promise; private _extensionsDeployed: Promise; @@ -143,7 +143,7 @@ export class AnalyticsService { async clearCaches() { this._blocksDeployed = undefined; this._extensionsDeployed = undefined; - this._cepId = undefined; + this._cepOperationObjectId = undefined; } async getLoadedCEP_Blocks(): Promise { @@ -205,9 +205,9 @@ export class AnalyticsService { return data; } - async getCEP_Id(): Promise { - let cepId: string; - if (!this._cepId) { + async getCEP_OperationObject(): Promise { + let cepOperationObjectId: string; + if (!this._cepOperationObjectId) { const useBackend = true; if (useBackend) { // get name of microservice from cep endpoint @@ -221,7 +221,7 @@ export class AnalyticsService { } ); const data = await response.json(); - cepId = data.id; + cepOperationObjectId = data.id; } else { // get name of microservice from cep endpoint const response: IFetchResponse = await this.fetchClient.fetch( @@ -256,12 +256,12 @@ export class AnalyticsService { ); return; } - cepId = data[0].id; + cepOperationObjectId = data[0].id; } } - this._cepId = Promise.resolve(cepId); + this._cepOperationObjectId = Promise.resolve(cepOperationObjectId); } - return this._cepId; + return this._cepOperationObjectId; } getCEP_Restarting(): Subject { @@ -298,16 +298,16 @@ export class AnalyticsService { } async subscribeMonitoringChannel(): Promise { - const cepId = await this.getCEP_Id(); - console.log('Started subscription on :', cepId); + const cepOperationObjectId = await this.getCEP_OperationObject(); + console.log('Started subscription on CEP operationObject:', cepOperationObjectId); const subMO = this.realtime.subscribe( - `/managedobjects/${cepId}`, + `/managedobjects/${cepOperationObjectId}`, this.updateStatusFromMO.bind(this) ); return subMO; // const sub = this.realtime.subscribe( - // `/events/${cepId}`, + // `/events/${cepOperationObjectId}`, // this.updateStatus.bind(this) // ); // this.subscription = this.restart$ diff --git a/analytics-ui/src/status/engine-status.component.ts b/analytics-ui/src/status/engine-status.component.ts index b950789..4e3d72b 100644 --- a/analytics-ui/src/status/engine-status.component.ts +++ b/analytics-ui/src/status/engine-status.component.ts @@ -10,7 +10,7 @@ import { BehaviorSubject, Subject } from 'rxjs'; encapsulation: ViewEncapsulation.None }) export class EngineStatusComponent implements OnInit { - cepId: string; + cepOperationObjectId: string; cepCtrlStatus$: Subject = new Subject(); cepCtrlStatusLabels$: BehaviorSubject = new BehaviorSubject([]); @@ -24,7 +24,7 @@ export class EngineStatusComponent implements OnInit { const humanize = new HumanizePipe(); this.init(); - this.cepId = await this.analyticsService.getCEP_Id(); + this.cepOperationObjectId = await this.analyticsService.getCEP_OperationObject(); const cepCtrlStatus = await this.analyticsService.getCEP_Status(); const cepCtrlStatusLabels = []; Object.keys(cepCtrlStatus).forEach((key) => { @@ -45,6 +45,6 @@ export class EngineStatusComponent implements OnInit { } private async init() { - this.cepId = await this.analyticsService.getCEP_Id(); + this.cepOperationObjectId = await this.analyticsService.getCEP_OperationObject(); } }