aliyun-log-python-sdk 0.9.22__tar.gz → 0.9.24__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.
Files changed (130) hide show
  1. {aliyun_log_python_sdk-0.9.22/aliyun_log_python_sdk.egg-info → aliyun_log_python_sdk-0.9.24}/PKG-INFO +1 -1
  2. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/__init__.py +3 -0
  3. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/compress.py +22 -7
  4. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/config.py +7 -1
  5. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/consumer_client.py +47 -5
  6. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/worker.py +2 -1
  7. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logclient.py +121 -4
  8. aliyun_log_python_sdk-0.9.24/aliyun/log/metering_mode_response.py +88 -0
  9. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/version.py +1 -1
  10. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24/aliyun_log_python_sdk.egg-info}/PKG-INFO +1 -1
  11. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun_log_python_sdk.egg-info/SOURCES.txt +1 -0
  12. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/LICENSE +0 -0
  13. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/README.md +0 -0
  14. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/__init__.py +0 -0
  15. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/_proto_py2/__init__.py +0 -0
  16. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/_proto_py2/log_logs_pb2.py +0 -0
  17. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/_proto_py2/log_logs_raw_pb2.py +0 -0
  18. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/acl_config.py +0 -0
  19. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/acl_response.py +0 -0
  20. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/auth.py +0 -0
  21. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/common_response.py +0 -0
  22. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/__init__.py +0 -0
  23. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/checkpoint_tracker.py +0 -0
  24. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/exceptions.py +0 -0
  25. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/fetched_log_group.py +0 -0
  26. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/heart_beat.py +0 -0
  27. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/shard_worker.py +0 -0
  28. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer/tasks.py +0 -0
  29. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer_group_request.py +0 -0
  30. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/consumer_group_response.py +0 -0
  31. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/credentials.py +0 -0
  32. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/cursor_response.py +0 -0
  33. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/cursor_time_response.py +0 -0
  34. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/__init__.py +0 -0
  35. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
  36. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
  37. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/mapping_index_converter.py +0 -0
  38. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/migration_log.py +0 -0
  39. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/migration_manager.py +0 -0
  40. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/migration_response.py +0 -0
  41. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/migration_task.py +0 -0
  42. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/es_migration/util.py +0 -0
  43. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_config_response.py +0 -0
  44. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/__init__.py +0 -0
  45. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/config_parser.py +0 -0
  46. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/etl_util.py +0 -0
  47. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/exceptions.py +0 -0
  48. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/restrict_config_parser.py +0 -0
  49. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/runner.py +0 -0
  50. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/settings.py +0 -0
  51. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/__init__.py +0 -0
  52. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -0
  53. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
  54. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
  55. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
  56. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
  57. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
  58. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
  59. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
  60. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/__init__.py +0 -0
  61. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/condition_list.py +0 -0
  62. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/condition_transform.py +0 -0
  63. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/condition_util.py +0 -0
  64. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/transform_base.py +0 -0
  65. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/transform_list.py +0 -0
  66. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
  67. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/export_response.py +0 -0
  68. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/ext/__init__.py +0 -0
  69. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/ext/jupyter_magic.py +0 -0
  70. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/ext/syslogclient.py +0 -0
  71. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/external_store_config.py +0 -0
  72. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/external_store_config_response.py +0 -0
  73. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/getcontextlogsresponse.py +0 -0
  74. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/gethistogramsrequest.py +0 -0
  75. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/gethistogramsresponse.py +0 -0
  76. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/getlogsrequest.py +0 -0
  77. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/getlogsresponse.py +0 -0
  78. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/histogram.py +0 -0
  79. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/index_config.py +0 -0
  80. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/index_config_response.py +0 -0
  81. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/ingestion_response.py +0 -0
  82. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/job.py +0 -0
  83. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/listlogstoresrequest.py +0 -0
  84. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/listlogstoresresponse.py +0 -0
  85. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/listtopicsrequest.py +0 -0
  86. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/listtopicsresponse.py +0 -0
  87. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/log_logs_pb2.py +0 -0
  88. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/log_logs_raw_pb2.py +0 -0
  89. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logclient_core.py +0 -0
  90. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logclient_operator.py +0 -0
  91. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logexception.py +0 -0
  92. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logger_hanlder.py +0 -0
  93. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logitem.py +0 -0
  94. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logrequest.py +0 -0
  95. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logresponse.py +0 -0
  96. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logstore_config_response.py +0 -0
  97. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logtail_config_detail.py +0 -0
  98. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/logtail_config_response.py +0 -0
  99. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/machine_group_detail.py +0 -0
  100. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/machinegroup_response.py +0 -0
  101. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/odps_sink.py +0 -0
  102. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/oss_sink.py +0 -0
  103. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/pluralize.py +0 -0
  104. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/project_response.py +0 -0
  105. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/proto.py +0 -0
  106. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/pulllog_response.py +0 -0
  107. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/putlogsrequest.py +0 -0
  108. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/putlogsresponse.py +0 -0
  109. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/queriedlog.py +0 -0
  110. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/rebuild_index_response.py +0 -0
  111. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/resource_params.py +0 -0
  112. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/resource_response.py +0 -0
  113. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/scheduled_sql.py +0 -0
  114. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/scheduled_sql_response.py +0 -0
  115. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/shard_response.py +0 -0
  116. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/shipper_config.py +0 -0
  117. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/shipper_response.py +0 -0
  118. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/sink.py +0 -0
  119. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/sql_instance_response.py +0 -0
  120. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/substore_config_response.py +0 -0
  121. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/tag_response.py +0 -0
  122. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/topostore_params.py +0 -0
  123. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/topostore_response.py +0 -0
  124. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun/log/util.py +0 -0
  125. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
  126. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun_log_python_sdk.egg-info/requires.txt +0 -0
  127. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
  128. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/setup.cfg +0 -0
  129. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/setup.py +0 -0
  130. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.24}/tests/test_alert.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.22
3
+ Version: 0.9.24
4
4
  Summary: Aliyun log service Python client SDK
5
5
  Home-page: https://github.com/aliyun/aliyun-log-python-sdk
6
6
  Author: Aliyun
@@ -38,3 +38,6 @@ from .rebuild_index_response import *
38
38
 
39
39
  # logging handler
40
40
  from .logger_hanlder import SimpleLogHandler, QueuedLogHandler, LogFields, UwsgiQueuedLogHandler
41
+ from .metering_mode_response import GetLogStoreMeteringModeResponse, \
42
+ GetMetricStoreMeteringModeResponse, \
43
+ UpdateLogStoreMeteringModeResponse, UpdateMetricStoreMeteringModeResponse
@@ -20,10 +20,19 @@ def lz_compresss(data):
20
20
 
21
21
  def zstd_compress(data):
22
22
  if not zstd_available:
23
- raise LogException('UnsupportedompressType',
24
- 'Unsupported compress type zstd, zstd not installed')
23
+ raise LogException('UnsupportedCompressType',
24
+ 'Unsupported compress type zstd, library zstd not installed')
25
25
  return zstd.compress(data, 1)
26
26
 
27
+ def zstd_decompress(raw_size, data):
28
+ if not zstd_available:
29
+ raise LogException('UnsupportedCompressType',
30
+ 'Unsupported compress type zstd, library zstd not installed')
31
+ result = zstd.decompress(data)
32
+ if len(result) != raw_size:
33
+ raise LogException('DecompressError', 'uncompressed size ' + str(len(result)) + ' does not match x-log-bodyrawsize ' + str(raw_size))
34
+ return result
35
+
27
36
  class CompressType(Enum):
28
37
  UNCOMPRESSED = 1
29
38
  LZ4 = 2
@@ -62,8 +71,8 @@ class Compressor():
62
71
  if compress_type == CompressType.UNCOMPRESSED:
63
72
  return data
64
73
 
65
- raise LogException('UnknownCompressType',
66
- 'Unknown compress type: ' + compress_type)
74
+ raise LogException('UnsupportedCompressType',
75
+ 'Unsupported compress type: ' + compress_type)
67
76
 
68
77
  @staticmethod
69
78
  def decompress(data, raw_size, compress_type):
@@ -73,9 +82,12 @@ class Compressor():
73
82
 
74
83
  if compress_type == CompressType.UNCOMPRESSED:
75
84
  return data
85
+
86
+ if compress_type == CompressType.ZSTD:
87
+ return zstd_decompress(raw_size, data)
76
88
 
77
- raise LogException('UnknownCompressType',
78
- 'Unknown compress type: ' + compress_type)
89
+ raise LogException('UnsupportedCompressType',
90
+ 'Unsupported compress type: ' + compress_type)
79
91
 
80
92
  @staticmethod
81
93
  def decompress_response(header, response):
@@ -93,8 +105,11 @@ class Compressor():
93
105
  if compress_type_str == 'lz4':
94
106
  return Compressor.decompress(response, raw_size, CompressType.LZ4)
95
107
 
108
+ if compress_type_str == 'zstd':
109
+ return Compressor.decompress(response, raw_size, CompressType.ZSTD)
110
+
96
111
  if compress_type_str in ('gzip', 'deflate'):
97
112
  return zlib.decompress(response)
98
113
 
99
- raise LogException('UnknownCompressType', 'Unknown compress type: ' +
114
+ raise LogException('UnsupportedCompressType', 'Unsupported compress type: ' +
100
115
  compress_type_str, resp_header=header, resp_body=response)
@@ -25,7 +25,8 @@ class LogHubConfig(object):
25
25
  cursor_position=None, heartbeat_interval=None, data_fetch_interval=None, in_order=False,
26
26
  cursor_start_time=None, security_token=None, max_fetch_log_group_size=None, worker_pool_size=None, shared_executor=None,
27
27
  cursor_end_time=None, credentials_refresher=None,
28
- auth_version=AUTH_VERSION_1, region='', query=None):
28
+ auth_version=AUTH_VERSION_1, region='', query=None,
29
+ accept_compress_type=None):
29
30
  """
30
31
 
31
32
  :param endpoint:
@@ -48,6 +49,10 @@ class LogHubConfig(object):
48
49
  :param auth_version: only support AUTH_VERSION_1 and AUTH_VERSION_4
49
50
  :param region: region of project
50
51
  :param query: the SPL query, such as *| where a = 'xxx'
52
+ :type accept_compress_type: string
53
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
54
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
55
+
51
56
  """
52
57
  self.endpoint = endpoint
53
58
  self.accessKeyId = access_key_id
@@ -71,3 +76,4 @@ class LogHubConfig(object):
71
76
  self.auth_version = auth_version
72
77
  self.region = region
73
78
  self.query = query
79
+ self.accept_compress_type = accept_compress_type
@@ -22,18 +22,60 @@ class ConsumerClientLoggerAdapter(logging.LoggerAdapter):
22
22
  class ConsumerClient(object):
23
23
  def __init__(self, endpoint, access_key_id, access_key, project,
24
24
  logstore, consumer_group, consumer, security_token=None, credentials_refresher=None,
25
- auth_version=AUTH_VERSION_1, region=''):
25
+ auth_version=AUTH_VERSION_1, region='',
26
+ accept_compress_type=None):
27
+ '''
28
+ :type endpoint: string
29
+ :param endpoint: the endpoint of sls project
26
30
 
31
+ :type access_key_id: string
32
+ :param access_key_id: your access key id
33
+
34
+ :type access_key: string
35
+ :param access_key: your access key secret
36
+
37
+ :type project: string
38
+ :param project: sls project
39
+
40
+ :type logstore: string
41
+ :param logstore: sls logstore to consume
42
+
43
+ :type consumer_group: string
44
+ :param consumer_group: consumer group name, the consumer group will be created when needed
45
+
46
+ :type consumer: string
47
+ :param consumer: consumer id, the id must be unique in the same consumer group
48
+
49
+ :type security_token: string
50
+ :param security_token: security token
51
+
52
+ :type credentials_refresher: CredentialsProvider
53
+ :param credentials_refresher: provides temporarily accessKeyId & accessKey dynamically
54
+
55
+ :type auth_version: string
56
+ :param auth_version: the auth version for signature, eg. AUTH_VERSION_1, AUTH_VERSION_4
57
+
58
+ :type region: string
59
+ :param region: the region of your project, required when auth_version is AUTH_VERSION_4
60
+
61
+ :type accept_compress_type: string
62
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
63
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
64
+
65
+ '''
27
66
  from .. import LogClient
28
67
 
29
- self.mclient = LogClient(endpoint, access_key_id, access_key, security_token, auth_version=auth_version, region=region)
30
- self.mclient.set_user_agent('%s-consumergroup-%s-%s' % (USER_AGENT, consumer_group, consumer))
68
+ self.mclient = LogClient(endpoint, access_key_id, access_key,
69
+ security_token, auth_version=auth_version, region=region)
70
+ self.mclient.set_user_agent(
71
+ '%s-consumergroup-%s-%s' % (USER_AGENT, consumer_group, consumer))
31
72
  if credentials_refresher is not None:
32
73
  self.mclient.set_credentials_auto_refresher(credentials_refresher)
33
74
  self.mproject = project
34
75
  self.mlogstore = logstore
35
76
  self.mconsumer_group = consumer_group
36
77
  self.mconsumer = consumer
78
+ self.accept_compress_type = accept_compress_type
37
79
  self.logger = ConsumerClientLoggerAdapter(
38
80
  logging.getLogger(__name__), {"consumer_client": self})
39
81
 
@@ -72,8 +114,8 @@ class ConsumerClient(object):
72
114
  except LogException as _:
73
115
  return None, True
74
116
 
75
-
76
117
  # fallback, for backward compatibility
118
+
77
119
  def _ensure_consumer_group_created_legacy(self, timeout, in_order):
78
120
  try:
79
121
  self.mclient.create_consumer_group(self.mproject, self.mlogstore, self.mconsumer_group,
@@ -138,4 +180,4 @@ class ConsumerClient(object):
138
180
  return self.mclient.get_end_cursor(self.mproject, self.mlogstore, shard_id).get_cursor()
139
181
 
140
182
  def pull_logs(self, shard_id, cursor, end_cursor=None, count=1000, query=None):
141
- return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor,query=query)
183
+ return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor, query=query, accept_compress_type=self.accept_compress_type)
@@ -36,7 +36,8 @@ class ConsumerWorker(Thread):
36
36
  consumer_option.project, consumer_option.logstore, consumer_option.consumer_group_name,
37
37
  consumer_option.consumer_name, consumer_option.securityToken,
38
38
  credentials_refresher=consumer_option.credentials_refresher,
39
- auth_version=consumer_option.auth_version, region=consumer_option.region)
39
+ auth_version=consumer_option.auth_version, region=consumer_option.region,
40
+ accept_compress_type=consumer_option.accept_compress_type)
40
41
  self.shut_down_flag = False
41
42
  self.logger = ConsumerWorkerLoggerAdapter(
42
43
  logging.getLogger(__name__), {"consumer_worker": self})
@@ -63,6 +63,9 @@ from .export_response import *
63
63
  from .common_response import *
64
64
  from .auth import *
65
65
  from .compress import CompressType, Compressor
66
+ from .metering_mode_response import GetLogStoreMeteringModeResponse, \
67
+ GetMetricStoreMeteringModeResponse, UpdateLogStoreMeteringModeResponse, \
68
+ UpdateMetricStoreMeteringModeResponse
66
69
 
67
70
  logger = logging.getLogger(__name__)
68
71
 
@@ -1094,7 +1097,7 @@ class LogClient(object):
1094
1097
  """
1095
1098
  return self.get_cursor(project_name, logstore_name, shard_id, "end")
1096
1099
 
1097
- def pull_logs(self, project_name, logstore_name, shard_id, cursor, count=None, end_cursor=None, compress=None, query=None):
1100
+ def pull_logs(self, project_name, logstore_name, shard_id, cursor, count=None, end_cursor=None, compress=None, query=None, accept_compress_type=None):
1098
1101
  """ batch pull log data from log service
1099
1102
  Unsuccessful operation will cause an LogException.
1100
1103
 
@@ -1121,6 +1124,10 @@ class LogClient(object):
1121
1124
 
1122
1125
  :type query: string
1123
1126
  :param query: the SPL query, such as *| where a = 'xxx'
1127
+
1128
+ :type accept_compress_type: string
1129
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
1130
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
1124
1131
 
1125
1132
  :return: PullLogResponse
1126
1133
 
@@ -1131,7 +1138,10 @@ class LogClient(object):
1131
1138
 
1132
1139
  need_compress = compress is None or compress
1133
1140
  if need_compress:
1134
- headers['Accept-Encoding'] = str(CompressType.default_compress_type())
1141
+ if accept_compress_type is None or accept_compress_type == '':
1142
+ headers['Accept-Encoding'] = str(CompressType.default_compress_type())
1143
+ else:
1144
+ headers['Accept-Encoding'] = accept_compress_type
1135
1145
  else:
1136
1146
  headers['Accept-Encoding'] = ''
1137
1147
 
@@ -1158,7 +1168,7 @@ class LogClient(object):
1158
1168
  raw_data = Compressor.decompress_response(header, resp)
1159
1169
  return PullLogResponse(raw_data, header)
1160
1170
 
1161
- def pull_log(self, project_name, logstore_name, shard_id, from_time, to_time, batch_size=None, compress=None, query=None):
1171
+ def pull_log(self, project_name, logstore_name, shard_id, from_time, to_time, batch_size=None, compress=None, query=None, accept_compress_type=None):
1162
1172
  """ batch pull log data from log service using time-range
1163
1173
  Unsuccessful operation will cause an LogException. the time parameter means the time when server receives the logs
1164
1174
 
@@ -1185,6 +1195,10 @@ class LogClient(object):
1185
1195
 
1186
1196
  :type query: string
1187
1197
  :param query: the SPL query, such as *| where a = 'xxx'
1198
+
1199
+ :type accept_compress_type: string
1200
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
1201
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
1188
1202
 
1189
1203
  :return: PullLogResponse
1190
1204
 
@@ -1195,7 +1209,8 @@ class LogClient(object):
1195
1209
 
1196
1210
  while True:
1197
1211
  res = self.pull_logs(project_name, logstore_name, shard_id, begin_cursor,
1198
- count=batch_size, end_cursor=end_cursor, compress=compress, query=query)
1212
+ count=batch_size, end_cursor=end_cursor, compress=compress, query=query,
1213
+ accept_compress_type=accept_compress_type)
1199
1214
 
1200
1215
  yield res
1201
1216
  next_cursor = res.get_next_cursor()
@@ -1240,6 +1255,10 @@ class LogClient(object):
1240
1255
 
1241
1256
  :type query: string
1242
1257
  :param query: the SPL query, such as *| where a = 'xxx'
1258
+
1259
+ :type accept_compress_type: str
1260
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
1261
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
1243
1262
 
1244
1263
  :return: LogResponse {"total_count": 30, "files": {'file_path_1': 10, "file_path_2": 20} })
1245
1264
 
@@ -1569,6 +1588,104 @@ class LogClient(object):
1569
1588
  (resp, header) = self._send("GET", project_name, None, resource, params, headers)
1570
1589
  return ListLogStoreResponse(resp, header)
1571
1590
 
1591
+ def get_logstore_metering_mode(self, project_name, logstore_name):
1592
+ """ Get the metering mode of the logstore
1593
+ Unsuccessful operation will cause an LogException.
1594
+
1595
+ :type project_name: string
1596
+ :param project_name: the Project name
1597
+
1598
+ :type logstore_name: string
1599
+ :param logstore_name: the logstore name
1600
+
1601
+ :return: GetLogStoreMeteringModeResponse
1602
+
1603
+ :raise: LogException
1604
+ """
1605
+ params = {}
1606
+ resource = "/logstores/" + logstore_name + "/meteringmode"
1607
+ headers = {}
1608
+
1609
+ (resp, header) = self._send("GET", project_name, None, resource, params, headers)
1610
+ return GetLogStoreMeteringModeResponse(resp, header)
1611
+
1612
+ def update_logstore_metering_mode(self, project_name, logstore_name, metering_mode):
1613
+ """ Update the metering mode of the logstore
1614
+ Unsuccessful operation will cause an LogException.
1615
+
1616
+ :type project_name: string
1617
+ :param project_name: the Project name
1618
+
1619
+ :type logstore_name: string
1620
+ :param logstore_name: the logstore name
1621
+
1622
+ :type metering_mode: string
1623
+ :param metering_mode: the metering mode, ChargeByDataIngest or ChargeByFunction
1624
+
1625
+ :return: UpdateLogStoreMeteringModeResponse
1626
+
1627
+ :raise: LogException
1628
+ """
1629
+ params = {}
1630
+ resource = "/logstores/" + logstore_name + "/meteringmode"
1631
+ headers = {"x-log-bodyrawsize": '0', "Content-Type": "application/json"}
1632
+ body = {
1633
+ "meteringMode": metering_mode
1634
+ }
1635
+ body_str = six.b(json.dumps(body))
1636
+
1637
+ (resp, header) = self._send("PUT", project_name, body_str, resource, params, headers)
1638
+ return UpdateLogStoreMeteringModeResponse(header, resp)
1639
+
1640
+ def get_metric_store_metering_mode(self, project_name, metric_store_name):
1641
+ """ Get the metering mode of the metric store
1642
+ Unsuccessful operation will cause an LogException.
1643
+
1644
+ :type project_name: string
1645
+ :param project_name: the Project name
1646
+
1647
+ :type metric_store_name: string
1648
+ :param metric_store_name: the metric store name
1649
+
1650
+ :return: GetMetricStoreMeteringModeResponse
1651
+
1652
+ :raise: LogException
1653
+ """
1654
+ params = {}
1655
+ resource = "/metricstores/" + metric_store_name + "/meteringmode"
1656
+ headers = {}
1657
+
1658
+ (resp, header) = self._send("GET", project_name, None, resource, params, headers)
1659
+ return GetMetricStoreMeteringModeResponse(resp, header)
1660
+
1661
+ def update_metric_store_metering_mode(self, project_name, metric_store_name, metering_mode):
1662
+ """ Update the metering mode of the metric store
1663
+ Unsuccessful operation will cause an LogException.
1664
+
1665
+ :type project_name: string
1666
+ :param project_name: the Project name
1667
+
1668
+ :type metric_store_name: string
1669
+ :param metric_store_name: the metric store name
1670
+
1671
+ :type metering_mode: string
1672
+ :param metering_mode: the metering mode, ChargeByDataIngest or ChargeByFunction
1673
+
1674
+ :return: UpdateMetricStoreMeteringModeResponse
1675
+
1676
+ :raise: LogException
1677
+ """
1678
+ params = {}
1679
+ resource = "/metricstores/" + metric_store_name + "/meteringmode"
1680
+ headers = {"x-log-bodyrawsize": '0', "Content-Type": "application/json"}
1681
+ body = {
1682
+ "meteringMode": metering_mode
1683
+ }
1684
+ body_str = six.b(json.dumps(body))
1685
+
1686
+ (resp, header) = self._send("PUT", project_name, body_str, resource, params, headers)
1687
+ return UpdateMetricStoreMeteringModeResponse(header, resp)
1688
+
1572
1689
  def create_external_store(self, project_name, config):
1573
1690
  """ create log store
1574
1691
  Unsuccessful operation will cause an LogException.
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env python
2
+ # encoding: utf-8
3
+
4
+ # Copyright (C) Alibaba Cloud Computing
5
+ # All rights reserved.
6
+
7
+ from .util import Util
8
+ from .logresponse import LogResponse
9
+
10
+
11
+ class GetLogStoreMeteringModeResponse(LogResponse):
12
+ """ The response of the get_logstore_metering_mode API from log.
13
+
14
+ :type header: dict
15
+ :param header: GetLogStoreMeteringModeResponse HTTP response header
16
+
17
+ :type resp: dict
18
+ :param resp: the HTTP response body
19
+ """
20
+
21
+ def __init__(self, resp, header):
22
+ LogResponse.__init__(self, header, resp)
23
+ self.metering_mode = Util.convert_unicode_to_str(resp["meteringMode"])
24
+
25
+ def get_metering_mode(self):
26
+ """
27
+
28
+ :return: string, the metering mode of the logstore
29
+ """
30
+ return self.metering_mode
31
+
32
+ def log_print(self):
33
+ print('GetLogStoreMeteringModeResponse')
34
+ print('headers:', self.get_all_headers())
35
+ print('meteringMode:', self.metering_mode)
36
+
37
+ class GetMetricStoreMeteringModeResponse(LogResponse):
38
+ """ The response of the get_metric_store_metering_mode API from log.
39
+
40
+ :type header: dict
41
+ :param header: GetMetricStoreMeteringModeResponse HTTP response header
42
+
43
+ :type resp: dict
44
+ :param resp: the HTTP response body
45
+ """
46
+
47
+ def __init__(self, resp, header):
48
+ LogResponse.__init__(self, header, resp)
49
+ self.metering_mode = Util.convert_unicode_to_str(resp["meteringMode"])
50
+
51
+ def get_metering_mode(self):
52
+ """
53
+ :return: string, the metering mode of the metric store
54
+ """
55
+ return self.metering_mode
56
+
57
+ def log_print(self):
58
+ print('GetMetricStoreMeteringModeResponse')
59
+ print('headers:', self.get_all_headers())
60
+ print('meteringMode:', self.metering_mode)
61
+
62
+ class UpdateLogStoreMeteringModeResponse(LogResponse):
63
+ """ The response of the update_logstore_metering_mode API from log.
64
+
65
+ :type header: dict
66
+ :param header: UpdateLogStoreMeteringModeResponse HTTP response header
67
+ """
68
+
69
+ def __init__(self, header, resp=''):
70
+ LogResponse.__init__(self, header, resp)
71
+
72
+ def log_print(self):
73
+ print('UpdateLogStoreMeteringModeResponse:')
74
+ print('headers:', self.get_all_headers())
75
+
76
+ class UpdateMetricStoreMeteringModeResponse(LogResponse):
77
+ """ The response of the update_metric_store_metering_mode API from log.
78
+
79
+ :type header: dict
80
+ :param header: UpdateMetricStoreMeteringModeResponse HTTP response header
81
+ """
82
+
83
+ def __init__(self, header, resp=''):
84
+ LogResponse.__init__(self, header, resp)
85
+
86
+ def log_print(self):
87
+ print('UpdateMetricStoreMeteringModeResponse:')
88
+ print('headers:', self.get_all_headers())
@@ -1,4 +1,4 @@
1
- __version__ = '0.9.22'
1
+ __version__ = '0.9.24'
2
2
 
3
3
  import sys
4
4
  OS_VERSION = str(sys.platform)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.22
3
+ Version: 0.9.24
4
4
  Summary: Aliyun log service Python client SDK
5
5
  Home-page: https://github.com/aliyun/aliyun-log-python-sdk
6
6
  Author: Aliyun
@@ -46,6 +46,7 @@ aliyun/log/logtail_config_detail.py
46
46
  aliyun/log/logtail_config_response.py
47
47
  aliyun/log/machine_group_detail.py
48
48
  aliyun/log/machinegroup_response.py
49
+ aliyun/log/metering_mode_response.py
49
50
  aliyun/log/odps_sink.py
50
51
  aliyun/log/oss_sink.py
51
52
  aliyun/log/pluralize.py