jetstream-api 0.1.4__tar.gz → 0.1.6__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.6
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.6"
4
4
 
5
5
  # --- Admin / Service ---
6
6
  from .admin import ILAdminService, ILAdminQmgr, ILLogBrowser, ILQueueBrowser
@@ -664,7 +664,9 @@ class ILAdminService:
664
664
  try:
665
665
  self.getQmgrProperty(qmgrName)
666
666
  return True
667
- except ILException as exc:
667
+ except (ILException, ILOperationException) as exc:
668
+ # v0.1.6: 하위 게터가 ILOperationException 을 _PASSTHROUGH 로 원형 전파하므로
669
+ # ILException 만 잡으면 미존재가 예외로 새어나갔다 (Java 는 전부 ILException 재래핑)
668
670
  if exc.get_reason_code() == ILRC.MIMQE_OBJECT_NOT_FOUND:
669
671
  return False
670
672
  raise
@@ -1777,7 +1779,9 @@ class ILAdminQmgr:
1777
1779
  try:
1778
1780
  self.getQueueProperty(queueName)
1779
1781
  return True
1780
- except ILException as exc:
1782
+ except (ILException, ILOperationException) as exc:
1783
+ # v0.1.6: 하위 게터가 ILOperationException 을 _PASSTHROUGH 로 원형 전파하므로
1784
+ # ILException 만 잡으면 미존재가 예외로 새어나갔다 (Java 는 전부 ILException 재래핑)
1781
1785
  if exc.get_reason_code() == ILRC.MIMQE_OBJECT_NOT_FOUND:
1782
1786
  return False
1783
1787
  raise
@@ -2367,7 +2371,9 @@ class ILAdminQmgr:
2367
2371
  try:
2368
2372
  self.getChannelProperty(channelName)
2369
2373
  return True
2370
- except ILException as exc:
2374
+ except (ILException, ILOperationException) as exc:
2375
+ # v0.1.6: 하위 게터가 ILOperationException 을 _PASSTHROUGH 로 원형 전파하므로
2376
+ # ILException 만 잡으면 미존재가 예외로 새어나갔다 (Java 는 전부 ILException 재래핑)
2371
2377
  if exc.get_reason_code() == ILRC.MIMQE_OBJECT_NOT_FOUND:
2372
2378
  return False
2373
2379
  raise
@@ -2829,6 +2835,172 @@ class ILAdminQmgr:
2829
2835
  raise ILException(exc) from exc
2830
2836
 
2831
2837
 
2838
+ # ------------------------------------------------------------------
2839
+ # v6.3.4 statistics / diagnosis / time-series APIs (v0.1.5)
2840
+ # ------------------------------------------------------------------
2841
+
2842
+ def getStatisticsInfo(self, level: int = 3, windowMin: int = 60) -> str:
2843
+ """Retrieve the queue manager statistics as a JSON string.
2844
+
2845
+ The response contains four blocks: ``current`` (latest raw samples),
2846
+ ``window_agg`` (window aggregates), ``props`` (queue configs) and
2847
+ ``descriptors`` (per-minute trend slopes).
2848
+
2849
+ Requires engine v6.3.4 (rev 3231) or later.
2850
+
2851
+ Args:
2852
+ level: Detail level (1-3, normally 3).
2853
+ windowMin: Aggregation window in minutes (normally 60).
2854
+
2855
+ Returns:
2856
+ Statistics JSON string, or an empty string when statistics
2857
+ collection is disabled on the queue manager.
2858
+ """
2859
+ try:
2860
+ if 0 < self.revision < 3231:
2861
+ raise ILOperationException(
2862
+ "MIMQE_NOT_SUPPORTED (getStatisticsInfo requires engine rev 3231+, "
2863
+ f"current: {self.revision})"
2864
+ )
2865
+ res_msg = self.service.inquire(
2866
+ ILMsgUtil.create_request_msg_with_qmgr(
2867
+ self.qmgrName, ILC.MIMQ_GET_STATISTICS_INFO, None,
2868
+ str(level), str(windowMin)
2869
+ ),
2870
+ False,
2871
+ )
2872
+ return self._pickStatText(res_msg)
2873
+ except _PASSTHROUGH_EXCEPTIONS:
2874
+ raise
2875
+ except Exception as exc:
2876
+ raise ILException(exc) from exc
2877
+
2878
+ def getDiagnosisInfo(
2879
+ self,
2880
+ targetType: str,
2881
+ targetName: str = "",
2882
+ level: int = 3,
2883
+ windowMin: int = 60,
2884
+ format: str = "TEXT",
2885
+ ) -> str:
2886
+ """Retrieve an engine-side operational diagnosis.
2887
+
2888
+ The engine evaluates its statistics against built-in rules and returns
2889
+ either an 80-column ASCII report (``format="TEXT"``) or a structured
2890
+ JSON document (``format="JSON"``) with the schema
2891
+ ``{qmgr, target, window, verdict(NORMAL|WARNING|CRITICAL), score(0-100),
2892
+ counts, findings[], rankings[](MANAGER only), notFound}``.
2893
+
2894
+ Requires engine v6.3.4 (rev 3263) or later.
2895
+
2896
+ Args:
2897
+ targetType: One of ``"MANAGER"``, ``"QUEUE"``, ``"CHANNEL"``, ``"CLIENT"``.
2898
+ targetName: Target object name (empty for ``MANAGER``).
2899
+ level: Output detail (1=summary, 2=+scorecard/WARN, 3=+rankings).
2900
+ windowMin: Aggregation window in minutes.
2901
+ format: ``"TEXT"`` or ``"JSON"``.
2902
+
2903
+ Returns:
2904
+ Diagnosis string, or an empty string when statistics collection
2905
+ is disabled on the queue manager.
2906
+ """
2907
+ try:
2908
+ if 0 < self.revision < 3263:
2909
+ raise ILOperationException(
2910
+ "MIMQE_NOT_SUPPORTED (getDiagnosisInfo requires engine rev 3263+, "
2911
+ f"current: {self.revision})"
2912
+ )
2913
+ options = f"{level},{windowMin},{format if format else 'TEXT'}"
2914
+ res_msg = self.service.inquire(
2915
+ ILMsgUtil.create_request_msg_with_qmgr(
2916
+ self.qmgrName, ILC.MIMQ_GET_DIAGNOSIS_INFO, None,
2917
+ targetType, targetName or "", options
2918
+ ),
2919
+ False,
2920
+ )
2921
+ return self._pickStatText(res_msg)
2922
+ except _PASSTHROUGH_EXCEPTIONS:
2923
+ raise
2924
+ except Exception as exc:
2925
+ raise ILException(exc) from exc
2926
+
2927
+ def getStatSeries(
2928
+ self,
2929
+ domain: str,
2930
+ objectName: str = "",
2931
+ metrics: str = "",
2932
+ resolution: str = "",
2933
+ last: int = 0,
2934
+ maxPoints: int = 0,
2935
+ ) -> str:
2936
+ """Retrieve a statistics time-series as a JSON string.
2937
+
2938
+ Combines domain x object x metrics x resolution to provide pinpoint
2939
+ trends (queue depth, in/out bytes, cpu-mem-disk, channel throughput,
2940
+ error frequency, ...). Response schema:
2941
+ ``{qmgr, domain, name, resolution, metrics, range, periodMs,
2942
+ pointCount, downsampled, points:[{ts, <metric>...}]}``.
2943
+ When more than ``maxPoints`` points match, the series is stride
2944
+ downsampled (``downsampled=true``).
2945
+
2946
+ Requires engine v6.3.4 (rev 3263) or later.
2947
+
2948
+ Args:
2949
+ domain: ``"queue"`` | ``"channel"`` | ``"client"`` | ``"resource"`` | ``"error"``.
2950
+ objectName: Object name (empty = queue-manager-wide totals;
2951
+ always empty for ``resource``).
2952
+ metrics: Comma-separated metrics (empty = per-domain defaults,
2953
+ e.g. ``"depth,putMsgCount"``, ``"cpu.total"``, rollup
2954
+ selector ``"depth.max"``).
2955
+ resolution: ``"minute"`` (default) | ``"hour"`` | ``"day"`` | ``"month"``.
2956
+ last: Last N periods (0 = per-resolution default: 60m/24h/30d/12mo).
2957
+ maxPoints: Point cap (0 = default 500, max 2000).
2958
+
2959
+ Returns:
2960
+ Time-series JSON string, or an empty string when statistics
2961
+ collection is disabled on the queue manager.
2962
+ """
2963
+ try:
2964
+ if 0 < self.revision < 3263:
2965
+ raise ILOperationException(
2966
+ "MIMQE_NOT_SUPPORTED (getStatSeries requires engine rev 3263+, "
2967
+ f"current: {self.revision})"
2968
+ )
2969
+ options = ""
2970
+ if metrics:
2971
+ options += f"metrics={metrics};"
2972
+ if resolution:
2973
+ options += f"res={resolution};"
2974
+ if last > 0:
2975
+ options += f"last={last};"
2976
+ if maxPoints > 0:
2977
+ options += f"maxPoints={maxPoints};"
2978
+ res_msg = self.service.inquire(
2979
+ ILMsgUtil.create_request_msg_with_qmgr(
2980
+ self.qmgrName, ILC.MIMQ_GET_STAT_SERIES, None,
2981
+ domain, objectName or "", options
2982
+ ),
2983
+ False,
2984
+ )
2985
+ return self._pickStatText(res_msg)
2986
+ except _PASSTHROUGH_EXCEPTIONS:
2987
+ raise
2988
+ except Exception as exc:
2989
+ raise ILException(exc) from exc
2990
+
2991
+ def _pickStatText(self, res_msg: ILMsg) -> str:
2992
+ # Shared response handling for statistics/diagnosis/series calls.
2993
+ # A REPORT with MIMQ_STATISTICS_NOT_ENABLED means statistics are off
2994
+ # -> return an empty string instead of raising (same contract as the
2995
+ # C++ ILAdminAPI and the Java client).
2996
+ if res_msg.getType() == ILC.MIMQ_REPORT_MESSAGE:
2997
+ report_msg = res_msg.getReportMsg()
2998
+ if report_msg.getCode() == ILRC.MIMQ_STATISTICS_NOT_ENABLED:
2999
+ return ""
3000
+ raise ILOperationException(report_msg.getArg2())
3001
+ return res_msg.getDataMsg().getData().decode("utf-8")
3002
+
3003
+
2832
3004
  class ILLogBrowser:
2833
3005
  """Iterator-style browser for reading server, error, or session log entries.
2834
3006
 
@@ -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.6
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.6"
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