jetstream-api 0.1.4__tar.gz → 0.1.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jetstream-api
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python client API for iLink M.O.M. (Message Oriented Middleware)
5
5
  Author: snowjeans
6
6
  License: Boost Software License - Version 1.0 - August 17th, 2003
@@ -1,6 +1,6 @@
1
1
  """iLink - Python client API for iLink M.O.M. (Message Oriented Middleware)."""
2
2
 
3
- __version__ = "0.1.4"
3
+ __version__ = "0.1.5"
4
4
 
5
5
  # --- Admin / Service ---
6
6
  from .admin import ILAdminService, ILAdminQmgr, ILLogBrowser, ILQueueBrowser
@@ -2829,6 +2829,172 @@ class ILAdminQmgr:
2829
2829
  raise ILException(exc) from exc
2830
2830
 
2831
2831
 
2832
+ # ------------------------------------------------------------------
2833
+ # v6.3.4 statistics / diagnosis / time-series APIs (v0.1.5)
2834
+ # ------------------------------------------------------------------
2835
+
2836
+ def getStatisticsInfo(self, level: int = 3, windowMin: int = 60) -> str:
2837
+ """Retrieve the queue manager statistics as a JSON string.
2838
+
2839
+ The response contains four blocks: ``current`` (latest raw samples),
2840
+ ``window_agg`` (window aggregates), ``props`` (queue configs) and
2841
+ ``descriptors`` (per-minute trend slopes).
2842
+
2843
+ Requires engine v6.3.4 (rev 3231) or later.
2844
+
2845
+ Args:
2846
+ level: Detail level (1-3, normally 3).
2847
+ windowMin: Aggregation window in minutes (normally 60).
2848
+
2849
+ Returns:
2850
+ Statistics JSON string, or an empty string when statistics
2851
+ collection is disabled on the queue manager.
2852
+ """
2853
+ try:
2854
+ if 0 < self.revision < 3231:
2855
+ raise ILOperationException(
2856
+ "MIMQE_NOT_SUPPORTED (getStatisticsInfo requires engine rev 3231+, "
2857
+ f"current: {self.revision})"
2858
+ )
2859
+ res_msg = self.service.inquire(
2860
+ ILMsgUtil.create_request_msg_with_qmgr(
2861
+ self.qmgrName, ILC.MIMQ_GET_STATISTICS_INFO, None,
2862
+ str(level), str(windowMin)
2863
+ ),
2864
+ False,
2865
+ )
2866
+ return self._pickStatText(res_msg)
2867
+ except _PASSTHROUGH_EXCEPTIONS:
2868
+ raise
2869
+ except Exception as exc:
2870
+ raise ILException(exc) from exc
2871
+
2872
+ def getDiagnosisInfo(
2873
+ self,
2874
+ targetType: str,
2875
+ targetName: str = "",
2876
+ level: int = 3,
2877
+ windowMin: int = 60,
2878
+ format: str = "TEXT",
2879
+ ) -> str:
2880
+ """Retrieve an engine-side operational diagnosis.
2881
+
2882
+ The engine evaluates its statistics against built-in rules and returns
2883
+ either an 80-column ASCII report (``format="TEXT"``) or a structured
2884
+ JSON document (``format="JSON"``) with the schema
2885
+ ``{qmgr, target, window, verdict(NORMAL|WARNING|CRITICAL), score(0-100),
2886
+ counts, findings[], rankings[](MANAGER only), notFound}``.
2887
+
2888
+ Requires engine v6.3.4 (rev 3263) or later.
2889
+
2890
+ Args:
2891
+ targetType: One of ``"MANAGER"``, ``"QUEUE"``, ``"CHANNEL"``, ``"CLIENT"``.
2892
+ targetName: Target object name (empty for ``MANAGER``).
2893
+ level: Output detail (1=summary, 2=+scorecard/WARN, 3=+rankings).
2894
+ windowMin: Aggregation window in minutes.
2895
+ format: ``"TEXT"`` or ``"JSON"``.
2896
+
2897
+ Returns:
2898
+ Diagnosis string, or an empty string when statistics collection
2899
+ is disabled on the queue manager.
2900
+ """
2901
+ try:
2902
+ if 0 < self.revision < 3263:
2903
+ raise ILOperationException(
2904
+ "MIMQE_NOT_SUPPORTED (getDiagnosisInfo requires engine rev 3263+, "
2905
+ f"current: {self.revision})"
2906
+ )
2907
+ options = f"{level},{windowMin},{format if format else 'TEXT'}"
2908
+ res_msg = self.service.inquire(
2909
+ ILMsgUtil.create_request_msg_with_qmgr(
2910
+ self.qmgrName, ILC.MIMQ_GET_DIAGNOSIS_INFO, None,
2911
+ targetType, targetName or "", options
2912
+ ),
2913
+ False,
2914
+ )
2915
+ return self._pickStatText(res_msg)
2916
+ except _PASSTHROUGH_EXCEPTIONS:
2917
+ raise
2918
+ except Exception as exc:
2919
+ raise ILException(exc) from exc
2920
+
2921
+ def getStatSeries(
2922
+ self,
2923
+ domain: str,
2924
+ objectName: str = "",
2925
+ metrics: str = "",
2926
+ resolution: str = "",
2927
+ last: int = 0,
2928
+ maxPoints: int = 0,
2929
+ ) -> str:
2930
+ """Retrieve a statistics time-series as a JSON string.
2931
+
2932
+ Combines domain x object x metrics x resolution to provide pinpoint
2933
+ trends (queue depth, in/out bytes, cpu-mem-disk, channel throughput,
2934
+ error frequency, ...). Response schema:
2935
+ ``{qmgr, domain, name, resolution, metrics, range, periodMs,
2936
+ pointCount, downsampled, points:[{ts, <metric>...}]}``.
2937
+ When more than ``maxPoints`` points match, the series is stride
2938
+ downsampled (``downsampled=true``).
2939
+
2940
+ Requires engine v6.3.4 (rev 3263) or later.
2941
+
2942
+ Args:
2943
+ domain: ``"queue"`` | ``"channel"`` | ``"client"`` | ``"resource"`` | ``"error"``.
2944
+ objectName: Object name (empty = queue-manager-wide totals;
2945
+ always empty for ``resource``).
2946
+ metrics: Comma-separated metrics (empty = per-domain defaults,
2947
+ e.g. ``"depth,putMsgCount"``, ``"cpu.total"``, rollup
2948
+ selector ``"depth.max"``).
2949
+ resolution: ``"minute"`` (default) | ``"hour"`` | ``"day"`` | ``"month"``.
2950
+ last: Last N periods (0 = per-resolution default: 60m/24h/30d/12mo).
2951
+ maxPoints: Point cap (0 = default 500, max 2000).
2952
+
2953
+ Returns:
2954
+ Time-series JSON string, or an empty string when statistics
2955
+ collection is disabled on the queue manager.
2956
+ """
2957
+ try:
2958
+ if 0 < self.revision < 3263:
2959
+ raise ILOperationException(
2960
+ "MIMQE_NOT_SUPPORTED (getStatSeries requires engine rev 3263+, "
2961
+ f"current: {self.revision})"
2962
+ )
2963
+ options = ""
2964
+ if metrics:
2965
+ options += f"metrics={metrics};"
2966
+ if resolution:
2967
+ options += f"res={resolution};"
2968
+ if last > 0:
2969
+ options += f"last={last};"
2970
+ if maxPoints > 0:
2971
+ options += f"maxPoints={maxPoints};"
2972
+ res_msg = self.service.inquire(
2973
+ ILMsgUtil.create_request_msg_with_qmgr(
2974
+ self.qmgrName, ILC.MIMQ_GET_STAT_SERIES, None,
2975
+ domain, objectName or "", options
2976
+ ),
2977
+ False,
2978
+ )
2979
+ return self._pickStatText(res_msg)
2980
+ except _PASSTHROUGH_EXCEPTIONS:
2981
+ raise
2982
+ except Exception as exc:
2983
+ raise ILException(exc) from exc
2984
+
2985
+ def _pickStatText(self, res_msg: ILMsg) -> str:
2986
+ # Shared response handling for statistics/diagnosis/series calls.
2987
+ # A REPORT with MIMQ_STATISTICS_NOT_ENABLED means statistics are off
2988
+ # -> return an empty string instead of raising (same contract as the
2989
+ # C++ ILAdminAPI and the Java client).
2990
+ if res_msg.getType() == ILC.MIMQ_REPORT_MESSAGE:
2991
+ report_msg = res_msg.getReportMsg()
2992
+ if report_msg.getCode() == ILRC.MIMQ_STATISTICS_NOT_ENABLED:
2993
+ return ""
2994
+ raise ILOperationException(report_msg.getArg2())
2995
+ return res_msg.getDataMsg().getData().decode("utf-8")
2996
+
2997
+
2832
2998
  class ILLogBrowser:
2833
2999
  """Iterator-style browser for reading server, error, or session log entries.
2834
3000
 
@@ -295,10 +295,15 @@ class ILC:
295
295
  MIMQ_GET_QUEUE_ACCESS_INFO = 3201
296
296
  MIMQ_SET_ACCEPT_POOL_SIZE = 3202
297
297
  MIMQ_SET_EVENT_POOL_SIZE = 3203
298
- MIMQ_ENABLE_LISTENER_STATUS_LOGGING = 3204
299
- MIMQ_DISABLE_LISTENER_STATUS_LOGGING = 3205
298
+ # v6.3.0 기능 변경 - 3204/3205 코드는 엔진에서 로드 모니터링/통계 조회로 재정의됨
299
+ # (구 MIMQ_ENABLE/DISABLE_LISTENER_STATUS_LOGGING 상수를 실제 의미로 개명)
300
+ MIMQ_GET_LOAD_MONITORING_INFO = 3204
301
+ MIMQ_GET_STATISTICS_INFO = 3205
300
302
  MIMQ_ENABLE_SESSION_TRACE = 3206
301
303
  MIMQ_DISABLE_SESSION_TRACE = 3207
304
+ # v6.3.4 통계 운영진단/시계열 조회 (엔진 rev 3263 이상)
305
+ MIMQ_GET_DIAGNOSIS_INFO = 3208
306
+ MIMQ_GET_STAT_SERIES = 3209
302
307
  MIMQ_SET_SERVER_PROPERTY = 3300
303
308
  MIMQ_SET_MANAGER_PROPERTY = 3301
304
309
  MIMQ_SET_KEY_PASSWORD = 3302
@@ -765,5 +770,7 @@ class ILRC:
765
770
  MIMQE_NIO_ERROR = 4003
766
771
  MIMQE_NOT_SUPPORTED = 4004
767
772
  MIMQE_BIO_ERROR = 4005
773
+ # v6.3.4 - 통계 비활성 응답 (에러 아님 - 통계/진단/시계열 조회 시 빈 결과로 처리)
774
+ MIMQ_STATISTICS_NOT_ENABLED = 4155
768
775
  MIMQE_NO_MSG_AVAILABLE = 5001
769
776
  MIMQE_WAIT_TIMEOUT = 5002
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jetstream-api
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Python client API for iLink M.O.M. (Message Oriented Middleware)
5
5
  Author: snowjeans
6
6
  License: Boost Software License - Version 1.0 - August 17th, 2003
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jetstream-api"
7
- version = "0.1.4"
7
+ version = "0.1.5"
8
8
  description = "Python client API for iLink M.O.M. (Message Oriented Middleware)"
9
9
  authors = [{name = "snowjeans"}]
10
10
  readme = "README.md"
File without changes
File without changes
File without changes