@meshmakers/octo-services 3.3.1170 → 3.3.1180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4040,6 +4040,41 @@ class CommunicationService {
4040
4040
  }
4041
4041
  }
4042
4042
  // ============================================================================
4043
+ // Adapter Resource Metrics
4044
+ // ============================================================================
4045
+ /**
4046
+ * Fetches the controller's in-memory ring buffer of CPU / memory samples for a
4047
+ * given adapter. Used by the UI to drive live sparklines. Returns an empty
4048
+ * array when the communication services URL is not configured, when the
4049
+ * adapter is not currently connected (controller returns 404), or when no
4050
+ * sample has been collected yet.
4051
+ *
4052
+ * Pass `since` for incremental polling — only samples strictly newer than the
4053
+ * supplied UTC timestamp are returned, keeping subsequent refreshes light.
4054
+ */
4055
+ async getAdapterMetrics(tenantId, adapterRtId, adapterCkTypeId, since) {
4056
+ if (!this.communicationServicesUrl) {
4057
+ return [];
4058
+ }
4059
+ const rtEntityId = encodeURIComponent(`${adapterCkTypeId}@${adapterRtId}`);
4060
+ const uri = `${this.communicationServicesUrl}${tenantId}/v1/adapter/${rtEntityId}/metrics`;
4061
+ let params = new HttpParams();
4062
+ if (since) {
4063
+ params = params.set('since', since.toISOString());
4064
+ }
4065
+ return firstValueFrom(this.httpClient
4066
+ .get(uri, { params, headers: this.noCacheHeaders })
4067
+ .pipe(catchError((err) => {
4068
+ // 404 = adapter not connected yet / unknown to the controller;
4069
+ // surface as "no samples" so the UI can render an empty state
4070
+ // instead of a toast.
4071
+ if (err.status === 404) {
4072
+ return of([]);
4073
+ }
4074
+ return throwError(() => err);
4075
+ })));
4076
+ }
4077
+ // ============================================================================
4043
4078
  // Pool-Level Adapter Deployment
4044
4079
  // ============================================================================
4045
4080
  /**