jetstream-api 0.1.3__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.3
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
@@ -42,6 +42,15 @@ Description-Content-Type: text/markdown
42
42
  License-File: LICENSE.txt
43
43
  Dynamic: license-file
44
44
 
45
- # jetstream-client
45
+ # jetstream-api
46
46
 
47
- ILink 클라이언트 API입니다.
47
+ Python으로 작성된 ILink 클라이언트 API입니다.
48
+
49
+ ## 시스템 요구 사항
50
+ 시스템에 python 13 이상, pip가 설치되어 있어야 합니다.
51
+
52
+ ## 설치 방법
53
+ pip install jetstream-api
54
+
55
+ ## 개발자 가이드 문서
56
+ 추후 업데이트 예정..
@@ -0,0 +1,12 @@
1
+ # jetstream-api
2
+
3
+ Python으로 작성된 ILink 클라이언트 API입니다.
4
+
5
+ ## 시스템 요구 사항
6
+ 시스템에 python 13 이상, pip가 설치되어 있어야 합니다.
7
+
8
+ ## 설치 방법
9
+ pip install jetstream-api
10
+
11
+ ## 개발자 가이드 문서
12
+ 추후 업데이트 예정..
@@ -1,90 +1,90 @@
1
- """iLink - Python client API for iLink M.O.M. (Message Oriented Middleware)."""
2
-
3
- __version__ = "0.1.3"
4
-
5
- # --- Admin / Service ---
6
- from .admin import ILAdminService, ILAdminQmgr, ILLogBrowser, ILQueueBrowser
7
-
8
- # --- Queue Manager & Queue ---
9
- from .qmgr import ILQmgr, ILQueue
10
-
11
- # --- Message ---
12
- from .msg import ILMsg, ILMsgUtil
13
-
14
- # --- Constants & Enums ---
15
- from .common import ILC, ILCC, ILRC, MatchOption
16
-
17
- # --- Properties ---
18
- from .properties import (
19
- DestItem,
20
- PartitionItem,
21
- ILQueueProperty,
22
- ILChannelProperty,
23
- ILChannelType,
24
- ILChannelStatus,
25
- ILChannelDirection,
26
- ILChannelSecurity,
27
- ILChannelBalanceMode,
28
- ILQmgrProperty,
29
- ILSessionProperty,
30
- ILServiceProperty,
31
- ILSpokeProperty,
32
- ILAccessRuleProperty,
33
- ILSecureFileProperty,
34
- ILQueueRealTimeInfo,
35
- ILQueueFlow,
36
- )
37
-
38
- # --- Exceptions ---
39
- from .exception import (
40
- ILException,
41
- ILNoMsgException,
42
- ILTimeoutException,
43
- ILOperationException,
44
- ILSessionException,
45
- ILMsgTypeException,
46
- )
47
-
48
- __all__ = [
49
- # Admin
50
- "ILAdminService",
51
- "ILAdminQmgr",
52
- "ILLogBrowser",
53
- "ILQueueBrowser",
54
- # QMgr / Queue
55
- "ILQmgr",
56
- "ILQueue",
57
- # Message
58
- "ILMsg",
59
- "ILMsgUtil",
60
- # Constants
61
- "ILC",
62
- "ILCC",
63
- "ILRC",
64
- "MatchOption",
65
- # Properties
66
- "DestItem",
67
- "PartitionItem",
68
- "ILQueueProperty",
69
- "ILChannelProperty",
70
- "ILChannelType",
71
- "ILChannelStatus",
72
- "ILChannelDirection",
73
- "ILChannelSecurity",
74
- "ILChannelBalanceMode",
75
- "ILQmgrProperty",
76
- "ILSessionProperty",
77
- "ILServiceProperty",
78
- "ILSpokeProperty",
79
- "ILAccessRuleProperty",
80
- "ILSecureFileProperty",
81
- "ILQueueRealTimeInfo",
82
- "ILQueueFlow",
83
- # Exceptions
84
- "ILException",
85
- "ILNoMsgException",
86
- "ILTimeoutException",
87
- "ILOperationException",
88
- "ILSessionException",
89
- "ILMsgTypeException",
90
- ]
1
+ """iLink - Python client API for iLink M.O.M. (Message Oriented Middleware)."""
2
+
3
+ __version__ = "0.1.5"
4
+
5
+ # --- Admin / Service ---
6
+ from .admin import ILAdminService, ILAdminQmgr, ILLogBrowser, ILQueueBrowser
7
+
8
+ # --- Queue Manager & Queue ---
9
+ from .qmgr import ILQmgr, ILQueue
10
+
11
+ # --- Message ---
12
+ from .msg import ILMsg, ILMsgUtil
13
+
14
+ # --- Constants & Enums ---
15
+ from .common import ILC, ILCC, ILRC, MatchOption
16
+
17
+ # --- Properties ---
18
+ from .properties import (
19
+ DestItem,
20
+ PartitionItem,
21
+ ILQueueProperty,
22
+ ILChannelProperty,
23
+ ILChannelType,
24
+ ILChannelStatus,
25
+ ILChannelDirection,
26
+ ILChannelSecurity,
27
+ ILChannelBalanceMode,
28
+ ILQmgrProperty,
29
+ ILSessionProperty,
30
+ ILServiceProperty,
31
+ ILSpokeProperty,
32
+ ILAccessRuleProperty,
33
+ ILSecureFileProperty,
34
+ ILQueueRealTimeInfo,
35
+ ILQueueFlow,
36
+ )
37
+
38
+ # --- Exceptions ---
39
+ from .exception import (
40
+ ILException,
41
+ ILNoMsgException,
42
+ ILTimeoutException,
43
+ ILOperationException,
44
+ ILSessionException,
45
+ ILMsgTypeException,
46
+ )
47
+
48
+ __all__ = [
49
+ # Admin
50
+ "ILAdminService",
51
+ "ILAdminQmgr",
52
+ "ILLogBrowser",
53
+ "ILQueueBrowser",
54
+ # QMgr / Queue
55
+ "ILQmgr",
56
+ "ILQueue",
57
+ # Message
58
+ "ILMsg",
59
+ "ILMsgUtil",
60
+ # Constants
61
+ "ILC",
62
+ "ILCC",
63
+ "ILRC",
64
+ "MatchOption",
65
+ # Properties
66
+ "DestItem",
67
+ "PartitionItem",
68
+ "ILQueueProperty",
69
+ "ILChannelProperty",
70
+ "ILChannelType",
71
+ "ILChannelStatus",
72
+ "ILChannelDirection",
73
+ "ILChannelSecurity",
74
+ "ILChannelBalanceMode",
75
+ "ILQmgrProperty",
76
+ "ILSessionProperty",
77
+ "ILServiceProperty",
78
+ "ILSpokeProperty",
79
+ "ILAccessRuleProperty",
80
+ "ILSecureFileProperty",
81
+ "ILQueueRealTimeInfo",
82
+ "ILQueueFlow",
83
+ # Exceptions
84
+ "ILException",
85
+ "ILNoMsgException",
86
+ "ILTimeoutException",
87
+ "ILOperationException",
88
+ "ILSessionException",
89
+ "ILMsgTypeException",
90
+ ]
@@ -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