sentry-arroyo 2.27.0__tar.gz → 2.28.1__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 (92) hide show
  1. {sentry_arroyo-2.27.0/sentry_arroyo.egg-info → sentry_arroyo-2.28.1}/PKG-INFO +1 -1
  2. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/processor.py +2 -3
  3. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/produce.py +14 -1
  4. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/metricDefs.json +1 -1
  5. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/metric_defs.py +2 -0
  6. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/metrics.py +1 -48
  7. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1/sentry_arroyo.egg-info}/PKG-INFO +1 -1
  8. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/setup.py +1 -1
  9. sentry_arroyo-2.28.1/tests/utils/test_metrics.py +33 -0
  10. sentry_arroyo-2.27.0/tests/utils/test_metrics.py +0 -84
  11. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/LICENSE +0 -0
  12. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/MANIFEST.in +0 -0
  13. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/README.md +0 -0
  14. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/__init__.py +0 -0
  15. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/__init__.py +0 -0
  16. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/abstract.py +0 -0
  17. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/kafka/__init__.py +0 -0
  18. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/kafka/commit.py +0 -0
  19. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/kafka/configuration.py +0 -0
  20. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/kafka/consumer.py +0 -0
  21. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/local/__init__.py +0 -0
  22. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/local/backend.py +0 -0
  23. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/local/storages/__init__.py +0 -0
  24. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/local/storages/abstract.py +0 -0
  25. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/backends/local/storages/memory.py +0 -0
  26. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/commit.py +0 -0
  27. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/dlq.py +0 -0
  28. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/errors.py +0 -0
  29. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/__init__.py +0 -0
  30. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/__init__.py +0 -0
  31. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/abstract.py +0 -0
  32. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/batching.py +0 -0
  33. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/buffer.py +0 -0
  34. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/commit.py +0 -0
  35. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/filter.py +0 -0
  36. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/guard.py +0 -0
  37. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/healthcheck.py +0 -0
  38. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/noop.py +0 -0
  39. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/reduce.py +0 -0
  40. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/run_task.py +0 -0
  41. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/run_task_in_threads.py +0 -0
  42. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/run_task_with_multiprocessing.py +0 -0
  43. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/processing/strategies/unfold.py +0 -0
  44. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/py.typed +0 -0
  45. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/types.py +0 -0
  46. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/__init__.py +0 -0
  47. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/clock.py +0 -0
  48. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/codecs.py +0 -0
  49. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/concurrent.py +0 -0
  50. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/logging.py +0 -0
  51. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/profiler.py +0 -0
  52. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/arroyo/utils/retries.py +0 -0
  53. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/examples/transform_and_produce/__init__.py +0 -0
  54. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/examples/transform_and_produce/batched.py +0 -0
  55. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/examples/transform_and_produce/script.py +0 -0
  56. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/examples/transform_and_produce/simple.py +0 -0
  57. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/requirements.txt +0 -0
  58. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/sentry_arroyo.egg-info/SOURCES.txt +0 -0
  59. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/sentry_arroyo.egg-info/dependency_links.txt +0 -0
  60. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/sentry_arroyo.egg-info/not-zip-safe +0 -0
  61. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/sentry_arroyo.egg-info/requires.txt +0 -0
  62. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/sentry_arroyo.egg-info/top_level.txt +0 -0
  63. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/setup.cfg +0 -0
  64. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/backends/__init__.py +0 -0
  65. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/backends/mixins.py +0 -0
  66. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/backends/test_commit.py +0 -0
  67. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/backends/test_kafka.py +0 -0
  68. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/backends/test_kafka_producer.py +0 -0
  69. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/backends/test_local.py +0 -0
  70. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/__init__.py +0 -0
  71. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/__init__.py +0 -0
  72. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_all.py +0 -0
  73. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_batching.py +0 -0
  74. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_buffer.py +0 -0
  75. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_commit.py +0 -0
  76. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_filter.py +0 -0
  77. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_guard.py +0 -0
  78. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_noop.py +0 -0
  79. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_produce.py +0 -0
  80. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_reduce.py +0 -0
  81. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_run_task.py +0 -0
  82. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_run_task_in_threads.py +0 -0
  83. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_run_task_with_multiprocessing.py +0 -0
  84. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/strategies/test_unfold.py +0 -0
  85. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/processing/test_processor.py +0 -0
  86. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/test_commit.py +0 -0
  87. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/test_dlq.py +0 -0
  88. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/test_kip848_e2e.py +0 -0
  89. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/test_types.py +0 -0
  90. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/utils/__init__.py +0 -0
  91. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/utils/test_concurrent.py +0 -0
  92. {sentry_arroyo-2.27.0 → sentry_arroyo-2.28.1}/tests/utils/test_retries.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sentry-arroyo
3
- Version: 2.27.0
3
+ Version: 2.28.1
4
4
  Summary: Arroyo is a Python library for working with streaming data.
5
5
  Home-page: https://github.com/getsentry/arroyo
6
6
  Author: Sentry
@@ -29,7 +29,7 @@ from arroyo.processing.strategies.abstract import (
29
29
  )
30
30
  from arroyo.types import BrokerValue, Message, Partition, Topic, TStrategyPayload
31
31
  from arroyo.utils.logging import handle_internal_error
32
- from arroyo.utils.metrics import get_consumer_metrics
32
+ from arroyo.utils.metrics import get_metrics
33
33
 
34
34
  logger = logging.getLogger(__name__)
35
35
 
@@ -90,7 +90,7 @@ ConsumerCounter = Literal[
90
90
 
91
91
  class MetricsBuffer:
92
92
  def __init__(self) -> None:
93
- self.metrics = get_consumer_metrics()
93
+ self.metrics = get_metrics()
94
94
  self.__timers: MutableMapping[ConsumerTiming, float] = defaultdict(float)
95
95
  self.__counters: MutableMapping[ConsumerCounter, int] = defaultdict(int)
96
96
  self.__reset()
@@ -195,7 +195,6 @@ class StreamProcessor(Generic[TStrategyPayload]):
195
195
  def on_partitions_assigned(partitions: Mapping[Partition, int]) -> None:
196
196
  logger.info("New partitions assigned: %r", partitions)
197
197
  logger.info("Member id: %r", self.__consumer.member_id)
198
- self.__metrics_buffer.metrics.consumer_member_id = self.__consumer.member_id
199
198
 
200
199
  self.__metrics_buffer.metrics.increment(
201
200
  "arroyo.consumer.partitions_assigned.count", len(partitions)
@@ -13,6 +13,7 @@ from arroyo.types import (
13
13
  TStrategyPayload,
14
14
  Value,
15
15
  )
16
+ from arroyo.utils.metrics import get_metrics
16
17
 
17
18
  logger = logging.getLogger(__name__)
18
19
 
@@ -43,6 +44,7 @@ class Produce(ProcessingStrategy[Union[FilteredPayload, TStrategyPayload]]):
43
44
  next_step: ProcessingStrategy[Union[FilteredPayload, TStrategyPayload]],
44
45
  max_buffer_size: int = 10000,
45
46
  ):
47
+ self.__metrics = get_metrics()
46
48
  self.__producer = producer
47
49
  self.__topic = topic
48
50
  self.__next_step = next_step
@@ -71,9 +73,20 @@ class Produce(ProcessingStrategy[Union[FilteredPayload, TStrategyPayload]]):
71
73
  if not future.done():
72
74
  break
73
75
 
76
+ try:
77
+ result = future.result()
78
+ self.__metrics.increment(
79
+ "arroyo.producer.produce_status", tags={"status": "success"}
80
+ )
81
+ except Exception as e:
82
+ self.__metrics.increment(
83
+ "arroyo.producer.produce_status", tags={"status": "error"}
84
+ )
85
+ raise e
86
+
74
87
  message = Message(
75
88
  Value(
76
- future.result().payload,
89
+ result.payload,
77
90
  original_message.committable,
78
91
  original_message.timestamp,
79
92
  )
@@ -1 +1 @@
1
- {"arroyo.strategies.run_task_with_multiprocessing.batch.size.msg": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.size.msg", "type": "Time", "description": "Number of messages in a multiprocessing batch"}, "arroyo.strategies.run_task_with_multiprocessing.batch.size.bytes": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.size.bytes", "type": "Time", "description": "Number of bytes in a multiprocessing batch"}, "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.msg": {"name": "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.msg", "type": "Time", "description": "Number of messages in a multiprocessing batch after the message transformation"}, "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.bytes": {"name": "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.bytes", "type": "Time", "description": "Number of bytes in a multiprocessing batch after the message transformation"}, "arroyo.consumer.run.count": {"name": "arroyo.consumer.run.count", "type": "Counter", "description": "Number of times the consumer is spinning"}, "arroyo.consumer.invalid_message.count": {"name": "arroyo.consumer.invalid_message.count", "type": "Counter", "description": "Number of times the consumer encountered an invalid message."}, "arroyo.strategies.reduce.batch_time": {"name": "arroyo.strategies.reduce.batch_time", "type": "Time", "description": "How long it took the Reduce step to fill up a batch"}, "arroyo.strategies.run_task_with_multiprocessing.batch.backpressure": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.backpressure", "type": "Counter", "description": "Incremented when a strategy after multiprocessing applies\nbackpressure to multiprocessing. May be a reason why CPU cannot be\nsaturated."}, "arroyo.strategies.run_task_with_multiprocessing.batch.input.overflow": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.input.overflow", "type": "Counter", "description": "Incremented when multiprocessing cannot fill the input batch\nbecause not enough memory was allocated. This results in batches smaller\nthan configured. Increase `input_block_size` to fix."}, "arroyo.strategies.run_task_with_multiprocessing.batch.output.overflow": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.output.overflow", "type": "Counter", "description": "Incremented when multiprocessing cannot pull results in batches\nequal to the input batch size, because not enough memory was allocated.\nThis can be devastating for throughput. Increase `output_block_size` to\nfix."}, "arroyo.strategies.run_task_with_multiprocessing.batch.input.resize": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.input.resize", "type": "Counter", "description": "Arroyo has decided to re-allocate a block in order to combat input\nbuffer overflow. This behavior can be disabled by explicitly setting\n`input_block_size` to a not-None value in `RunTaskWithMultiprocessing`."}, "arroyo.strategies.run_task_with_multiprocessing.batch.output.resize": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.output.resize", "type": "Counter", "description": "Arroyo has decided to re-allocate a block in order to combat output\nbuffer overflow. This behavior can be disabled by explicitly setting\n`output_block_size` to a not-None value in `RunTaskWithMultiprocessing`."}, "arroyo.strategies.run_task_with_multiprocessing.batches_in_progress": {"name": "arroyo.strategies.run_task_with_multiprocessing.batches_in_progress", "type": "Gauge", "description": "How many batches are being processed in parallel by multiprocessing."}, "arroyo.strategies.run_task_with_multiprocessing.processes": {"name": "arroyo.strategies.run_task_with_multiprocessing.processes", "type": "Counter", "description": "A subprocess by multiprocessing unexpectedly died.\n\"sigchld.detected\",\nGauge: Shows how many processes the multiprocessing strategy is\nconfigured with."}, "arroyo.strategies.run_task_with_multiprocessing.pool.create": {"name": "arroyo.strategies.run_task_with_multiprocessing.pool.create", "type": "Counter", "description": "Incremented when the multiprocessing pool is created (or re-created)."}, "arroyo.consumer.poll.time": {"name": "arroyo.consumer.poll.time", "type": "Time", "description": "(unitless) spent polling librdkafka for new messages."}, "arroyo.consumer.processing.time": {"name": "arroyo.consumer.processing.time", "type": "Time", "description": "(unitless) spent in strategies (blocking in strategy.submit or\nstrategy.poll)"}, "arroyo.consumer.backpressure.time": {"name": "arroyo.consumer.backpressure.time", "type": "Time", "description": "(unitless) spent pausing the consumer due to backpressure (MessageRejected)"}, "arroyo.consumer.dlq.time": {"name": "arroyo.consumer.dlq.time", "type": "Time", "description": "(unitless) spent in handling `InvalidMessage` exceptions and sending\nmessages to the the DLQ."}, "arroyo.consumer.join.time": {"name": "arroyo.consumer.join.time", "type": "Time", "description": "(unitless) spent in waiting for the strategy to exit, such as during\nshutdown or rebalancing."}, "arroyo.consumer.callback.time": {"name": "arroyo.consumer.callback.time", "type": "Time", "description": "(unitless) spent in librdkafka callbacks. This metric's timings\noverlap other timings, and might spike at the same time."}, "arroyo.consumer.shutdown.time": {"name": "arroyo.consumer.shutdown.time", "type": "Time", "description": "(unitless) spent in shutting down the consumer. This metric's\ntimings overlap other timings, and might spike at the same time."}, "arroyo.consumer.run.callback": {"name": "arroyo.consumer.run.callback", "type": "Time", "description": "A regular duration metric where each datapoint is measuring the time it\ntook to execute a single callback. This metric is distinct from the\narroyo.consumer.*.time metrics as it does not attempt to accumulate time\nspent per second in an attempt to keep monitoring overhead low.\nThe metric is tagged by the name of the internal callback function being\nexecuted, as 'callback_name'. Possible values are on_partitions_assigned\nand on_partitions_revoked."}, "arroyo.consumer.run.close_strategy": {"name": "arroyo.consumer.run.close_strategy", "type": "Time", "description": "Duration metric measuring the time it took to flush in-flight messages\nand shut down the strategies."}, "arroyo.consumer.run.create_strategy": {"name": "arroyo.consumer.run.create_strategy", "type": "Time", "description": "Duration metric measuring the time it took to create the processing strategy."}, "arroyo.consumer.partitions_revoked.count": {"name": "arroyo.consumer.partitions_revoked.count", "type": "Counter", "description": "How many partitions have been revoked just now."}, "arroyo.consumer.partitions_assigned.count": {"name": "arroyo.consumer.partitions_assigned.count", "type": "Counter", "description": "How many partitions have been assigned just now."}, "arroyo.consumer.latency": {"name": "arroyo.consumer.latency", "type": "Time", "description": "Consumer latency in seconds. Recorded by the commit offsets strategy."}, "arroyo.consumer.pause": {"name": "arroyo.consumer.pause", "type": "Counter", "description": "Metric for when the underlying rdkafka consumer is being paused.\nThis flushes internal prefetch buffers."}, "arroyo.consumer.resume": {"name": "arroyo.consumer.resume", "type": "Counter", "description": "Metric for when the underlying rdkafka consumer is being resumed.\nThis might cause increased network usage as messages are being re-fetched."}, "arroyo.consumer.librdkafka.total_queue_size": {"name": "arroyo.consumer.librdkafka.total_queue_size", "type": "Gauge", "description": "Queue size of background queue that librdkafka uses to prefetch messages."}, "arroyo.processing.strategies.healthcheck.touch": {"name": "arroyo.processing.strategies.healthcheck.touch", "type": "Counter", "description": "Counter metric to measure how often the healthcheck file has been touched."}, "arroyo.strategies.filter.dropped_messages": {"name": "arroyo.strategies.filter.dropped_messages", "type": "Counter", "description": "Number of messages dropped in the FilterStep strategy"}, "arroyo.consumer.dlq.dropped_messages": {"name": "arroyo.consumer.dlq.dropped_messages", "type": "Counter", "description": "how many messages are dropped due to errors producing to the dlq"}, "arroyo.consumer.dlq_buffer.len": {"name": "arroyo.consumer.dlq_buffer.len", "type": "Gauge", "description": "Current length of the DLQ buffer deque"}, "arroyo.consumer.dlq_buffer.exceeded": {"name": "arroyo.consumer.dlq_buffer.exceeded", "type": "Counter", "description": "Number of times the DLQ buffer size has been exceeded, causing messages to be dropped"}, "arroyo.consumer.dlq_buffer.assigned_partitions": {"name": "arroyo.consumer.dlq_buffer.assigned_partitions", "type": "Gauge", "description": "Number of partitions being tracked in the DLQ buffer"}, "arroyo.producer.librdkafka.p99_int_latency": {"name": "arroyo.producer.librdkafka.p99_int_latency", "type": "Time", "description": "Internal producer queue latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.p99_outbuf_latency": {"name": "arroyo.producer.librdkafka.p99_outbuf_latency", "type": "Time", "description": "Output buffer latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.p99_rtt": {"name": "arroyo.producer.librdkafka.p99_rtt", "type": "Time", "description": "Round-trip time to brokers from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.avg_int_latency": {"name": "arroyo.producer.librdkafka.avg_int_latency", "type": "Time", "description": "Average internal producer queue latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.avg_outbuf_latency": {"name": "arroyo.producer.librdkafka.avg_outbuf_latency", "type": "Time", "description": "Average output buffer latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.avg_rtt": {"name": "arroyo.producer.librdkafka.avg_rtt", "type": "Time", "description": "Average round-trip time to brokers from librdkafka statistics.\nTagged by broker_id."}}
1
+ {"arroyo.strategies.run_task_with_multiprocessing.batch.size.msg": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.size.msg", "type": "Time", "description": "Number of messages in a multiprocessing batch"}, "arroyo.strategies.run_task_with_multiprocessing.batch.size.bytes": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.size.bytes", "type": "Time", "description": "Number of bytes in a multiprocessing batch"}, "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.msg": {"name": "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.msg", "type": "Time", "description": "Number of messages in a multiprocessing batch after the message transformation"}, "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.bytes": {"name": "arroyo.strategies.run_task_with_multiprocessing.output_batch.size.bytes", "type": "Time", "description": "Number of bytes in a multiprocessing batch after the message transformation"}, "arroyo.consumer.run.count": {"name": "arroyo.consumer.run.count", "type": "Counter", "description": "Number of times the consumer is spinning"}, "arroyo.consumer.invalid_message.count": {"name": "arroyo.consumer.invalid_message.count", "type": "Counter", "description": "Number of times the consumer encountered an invalid message."}, "arroyo.strategies.reduce.batch_time": {"name": "arroyo.strategies.reduce.batch_time", "type": "Time", "description": "How long it took the Reduce step to fill up a batch"}, "arroyo.strategies.run_task_with_multiprocessing.batch.backpressure": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.backpressure", "type": "Counter", "description": "Incremented when a strategy after multiprocessing applies\nbackpressure to multiprocessing. May be a reason why CPU cannot be\nsaturated."}, "arroyo.strategies.run_task_with_multiprocessing.batch.input.overflow": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.input.overflow", "type": "Counter", "description": "Incremented when multiprocessing cannot fill the input batch\nbecause not enough memory was allocated. This results in batches smaller\nthan configured. Increase `input_block_size` to fix."}, "arroyo.strategies.run_task_with_multiprocessing.batch.output.overflow": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.output.overflow", "type": "Counter", "description": "Incremented when multiprocessing cannot pull results in batches\nequal to the input batch size, because not enough memory was allocated.\nThis can be devastating for throughput. Increase `output_block_size` to\nfix."}, "arroyo.strategies.run_task_with_multiprocessing.batch.input.resize": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.input.resize", "type": "Counter", "description": "Arroyo has decided to re-allocate a block in order to combat input\nbuffer overflow. This behavior can be disabled by explicitly setting\n`input_block_size` to a not-None value in `RunTaskWithMultiprocessing`."}, "arroyo.strategies.run_task_with_multiprocessing.batch.output.resize": {"name": "arroyo.strategies.run_task_with_multiprocessing.batch.output.resize", "type": "Counter", "description": "Arroyo has decided to re-allocate a block in order to combat output\nbuffer overflow. This behavior can be disabled by explicitly setting\n`output_block_size` to a not-None value in `RunTaskWithMultiprocessing`."}, "arroyo.strategies.run_task_with_multiprocessing.batches_in_progress": {"name": "arroyo.strategies.run_task_with_multiprocessing.batches_in_progress", "type": "Gauge", "description": "How many batches are being processed in parallel by multiprocessing."}, "arroyo.strategies.run_task_with_multiprocessing.processes": {"name": "arroyo.strategies.run_task_with_multiprocessing.processes", "type": "Counter", "description": "A subprocess by multiprocessing unexpectedly died.\n\"sigchld.detected\",\nGauge: Shows how many processes the multiprocessing strategy is\nconfigured with."}, "arroyo.strategies.run_task_with_multiprocessing.pool.create": {"name": "arroyo.strategies.run_task_with_multiprocessing.pool.create", "type": "Counter", "description": "Incremented when the multiprocessing pool is created (or re-created)."}, "arroyo.consumer.poll.time": {"name": "arroyo.consumer.poll.time", "type": "Time", "description": "(unitless) spent polling librdkafka for new messages."}, "arroyo.consumer.processing.time": {"name": "arroyo.consumer.processing.time", "type": "Time", "description": "(unitless) spent in strategies (blocking in strategy.submit or\nstrategy.poll)"}, "arroyo.consumer.backpressure.time": {"name": "arroyo.consumer.backpressure.time", "type": "Time", "description": "(unitless) spent pausing the consumer due to backpressure (MessageRejected)"}, "arroyo.consumer.dlq.time": {"name": "arroyo.consumer.dlq.time", "type": "Time", "description": "(unitless) spent in handling `InvalidMessage` exceptions and sending\nmessages to the the DLQ."}, "arroyo.consumer.join.time": {"name": "arroyo.consumer.join.time", "type": "Time", "description": "(unitless) spent in waiting for the strategy to exit, such as during\nshutdown or rebalancing."}, "arroyo.consumer.callback.time": {"name": "arroyo.consumer.callback.time", "type": "Time", "description": "(unitless) spent in librdkafka callbacks. This metric's timings\noverlap other timings, and might spike at the same time."}, "arroyo.consumer.shutdown.time": {"name": "arroyo.consumer.shutdown.time", "type": "Time", "description": "(unitless) spent in shutting down the consumer. This metric's\ntimings overlap other timings, and might spike at the same time."}, "arroyo.consumer.run.callback": {"name": "arroyo.consumer.run.callback", "type": "Time", "description": "A regular duration metric where each datapoint is measuring the time it\ntook to execute a single callback. This metric is distinct from the\narroyo.consumer.*.time metrics as it does not attempt to accumulate time\nspent per second in an attempt to keep monitoring overhead low.\nThe metric is tagged by the name of the internal callback function being\nexecuted, as 'callback_name'. Possible values are on_partitions_assigned\nand on_partitions_revoked."}, "arroyo.consumer.run.close_strategy": {"name": "arroyo.consumer.run.close_strategy", "type": "Time", "description": "Duration metric measuring the time it took to flush in-flight messages\nand shut down the strategies."}, "arroyo.consumer.run.create_strategy": {"name": "arroyo.consumer.run.create_strategy", "type": "Time", "description": "Duration metric measuring the time it took to create the processing strategy."}, "arroyo.consumer.partitions_revoked.count": {"name": "arroyo.consumer.partitions_revoked.count", "type": "Counter", "description": "How many partitions have been revoked just now."}, "arroyo.consumer.partitions_assigned.count": {"name": "arroyo.consumer.partitions_assigned.count", "type": "Counter", "description": "How many partitions have been assigned just now."}, "arroyo.consumer.latency": {"name": "arroyo.consumer.latency", "type": "Time", "description": "Consumer latency in seconds. Recorded by the commit offsets strategy."}, "arroyo.consumer.pause": {"name": "arroyo.consumer.pause", "type": "Counter", "description": "Metric for when the underlying rdkafka consumer is being paused.\nThis flushes internal prefetch buffers."}, "arroyo.consumer.resume": {"name": "arroyo.consumer.resume", "type": "Counter", "description": "Metric for when the underlying rdkafka consumer is being resumed.\nThis might cause increased network usage as messages are being re-fetched."}, "arroyo.consumer.librdkafka.total_queue_size": {"name": "arroyo.consumer.librdkafka.total_queue_size", "type": "Gauge", "description": "Queue size of background queue that librdkafka uses to prefetch messages."}, "arroyo.processing.strategies.healthcheck.touch": {"name": "arroyo.processing.strategies.healthcheck.touch", "type": "Counter", "description": "Counter metric to measure how often the healthcheck file has been touched."}, "arroyo.strategies.filter.dropped_messages": {"name": "arroyo.strategies.filter.dropped_messages", "type": "Counter", "description": "Number of messages dropped in the FilterStep strategy"}, "arroyo.consumer.dlq.dropped_messages": {"name": "arroyo.consumer.dlq.dropped_messages", "type": "Counter", "description": "how many messages are dropped due to errors producing to the dlq"}, "arroyo.consumer.dlq_buffer.len": {"name": "arroyo.consumer.dlq_buffer.len", "type": "Gauge", "description": "Current length of the DLQ buffer deque"}, "arroyo.consumer.dlq_buffer.exceeded": {"name": "arroyo.consumer.dlq_buffer.exceeded", "type": "Counter", "description": "Number of times the DLQ buffer size has been exceeded, causing messages to be dropped"}, "arroyo.consumer.dlq_buffer.assigned_partitions": {"name": "arroyo.consumer.dlq_buffer.assigned_partitions", "type": "Gauge", "description": "Number of partitions being tracked in the DLQ buffer"}, "arroyo.producer.librdkafka.p99_int_latency": {"name": "arroyo.producer.librdkafka.p99_int_latency", "type": "Time", "description": "Internal producer queue latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.p99_outbuf_latency": {"name": "arroyo.producer.librdkafka.p99_outbuf_latency", "type": "Time", "description": "Output buffer latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.p99_rtt": {"name": "arroyo.producer.librdkafka.p99_rtt", "type": "Time", "description": "Round-trip time to brokers from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.avg_int_latency": {"name": "arroyo.producer.librdkafka.avg_int_latency", "type": "Time", "description": "Average internal producer queue latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.avg_outbuf_latency": {"name": "arroyo.producer.librdkafka.avg_outbuf_latency", "type": "Time", "description": "Average output buffer latency from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.librdkafka.avg_rtt": {"name": "arroyo.producer.librdkafka.avg_rtt", "type": "Time", "description": "Average round-trip time to brokers from librdkafka statistics.\nTagged by broker_id."}, "arroyo.producer.produce_status": {"name": "arroyo.producer.produce_status", "type": "Counter", "description": "Number of times the produce strategy failed to produce a message"}}
@@ -124,4 +124,6 @@ MetricName = Literal[
124
124
  # Time: Average round-trip time to brokers from librdkafka statistics.
125
125
  # Tagged by broker_id.
126
126
  "arroyo.producer.librdkafka.avg_rtt",
127
+ # Counter: Number of times the produce strategy failed to produce a message
128
+ "arroyo.producer.produce_status",
127
129
  ]
@@ -45,45 +45,6 @@ class Metrics(Protocol):
45
45
  raise NotImplementedError
46
46
 
47
47
 
48
- class ConsumerMetricsWrapper(Metrics):
49
- """
50
- A wrapper around a metrics backend that automatically adds consumer_member_id
51
- to all metrics calls.
52
-
53
- Right now we only use this to add tags to the metrics emitted by
54
- StreamProcessor, but ideally all metrics, even those emitted by strategies
55
- and application code, would get this tag. The metrics abstraction in arroyo
56
- is not sufficient for this. We'd have to add a "add_global_tags" method
57
- (similar to the concept of global tags in sentry) and users would have to
58
- implement it.
59
- """
60
-
61
- def __init__(self, metrics: Metrics) -> None:
62
- self.__metrics = metrics
63
- self.consumer_member_id = ""
64
-
65
- def _add_consumer_tag(self, tags: Optional[Tags]) -> Tags:
66
- return {**(tags or {}), "consumer_member_id": self.consumer_member_id}
67
-
68
- def increment(
69
- self,
70
- name: MetricName,
71
- value: Union[int, float] = 1,
72
- tags: Optional[Tags] = None,
73
- ) -> None:
74
- self.__metrics.increment(name, value, tags=self._add_consumer_tag(tags))
75
-
76
- def gauge(
77
- self, name: MetricName, value: Union[int, float], tags: Optional[Tags] = None
78
- ) -> None:
79
- self.__metrics.gauge(name, value, tags=self._add_consumer_tag(tags))
80
-
81
- def timing(
82
- self, name: MetricName, value: Union[int, float], tags: Optional[Tags] = None
83
- ) -> None:
84
- self.__metrics.timing(name, value, tags=self._add_consumer_tag(tags))
85
-
86
-
87
48
  class DummyMetricsBackend(Metrics):
88
49
  """
89
50
  Default metrics backend that does not record anything.
@@ -172,12 +133,4 @@ def get_metrics() -> Metrics:
172
133
  return _metrics_backend
173
134
 
174
135
 
175
- def get_consumer_metrics() -> ConsumerMetricsWrapper:
176
- """
177
- Get a metrics backend that automatically adds consumer_member_id to all metrics.
178
- """
179
- base_metrics = get_metrics()
180
- return ConsumerMetricsWrapper(base_metrics)
181
-
182
-
183
- __all__ = ["configure_metrics", "Metrics", "MetricName", "Tags", "get_consumer_metrics"]
136
+ __all__ = ["configure_metrics", "Metrics", "MetricName", "Tags"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sentry-arroyo
3
- Version: 2.27.0
3
+ Version: 2.28.1
4
4
  Summary: Arroyo is a Python library for working with streaming data.
5
5
  Home-page: https://github.com/getsentry/arroyo
6
6
  Author: Sentry
@@ -10,7 +10,7 @@ def get_requirements() -> Sequence[str]:
10
10
 
11
11
  setup(
12
12
  name="sentry-arroyo",
13
- version="2.27.0",
13
+ version="2.28.1",
14
14
  author="Sentry",
15
15
  author_email="oss@sentry.io",
16
16
  license="Apache-2.0",
@@ -0,0 +1,33 @@
1
+ import pytest
2
+
3
+ from arroyo.utils.metrics import Gauge, MetricName, configure_metrics, get_metrics
4
+ from tests.metrics import Gauge as GaugeCall
5
+ from tests.metrics import TestingMetricsBackend, _TestingMetricsBackend
6
+
7
+
8
+ def test_gauge_simple() -> None:
9
+ backend = TestingMetricsBackend
10
+
11
+ name: MetricName = "name" # type: ignore
12
+ tags = {"tag": "value"}
13
+ gauge = Gauge(backend, name, tags)
14
+
15
+ with gauge:
16
+ pass
17
+
18
+ assert backend.calls == [
19
+ GaugeCall(name, 0.0, tags),
20
+ GaugeCall(name, 1.0, tags),
21
+ GaugeCall(name, 0.0, tags),
22
+ ]
23
+
24
+
25
+ def test_configure_metrics() -> None:
26
+ assert get_metrics() == TestingMetricsBackend
27
+
28
+ with pytest.raises(AssertionError):
29
+ configure_metrics(_TestingMetricsBackend())
30
+
31
+ # Can be reset to something else with force
32
+ configure_metrics(_TestingMetricsBackend(), force=True)
33
+ assert get_metrics() != TestingMetricsBackend
@@ -1,84 +0,0 @@
1
- import pytest
2
-
3
- from arroyo.utils.metrics import (
4
- Gauge,
5
- MetricName,
6
- configure_metrics,
7
- get_consumer_metrics,
8
- get_metrics,
9
- )
10
- from tests.metrics import Gauge as GaugeCall
11
- from tests.metrics import (
12
- Increment,
13
- TestingMetricsBackend,
14
- Timing,
15
- _TestingMetricsBackend,
16
- )
17
-
18
-
19
- def test_gauge_simple() -> None:
20
- backend = TestingMetricsBackend
21
-
22
- name: MetricName = "name" # type: ignore
23
- tags = {"tag": "value"}
24
- gauge = Gauge(backend, name, tags)
25
-
26
- with gauge:
27
- pass
28
-
29
- assert backend.calls == [
30
- GaugeCall(name, 0.0, tags),
31
- GaugeCall(name, 1.0, tags),
32
- GaugeCall(name, 0.0, tags),
33
- ]
34
-
35
-
36
- def test_configure_metrics() -> None:
37
- assert get_metrics() == TestingMetricsBackend
38
-
39
- with pytest.raises(AssertionError):
40
- configure_metrics(_TestingMetricsBackend())
41
-
42
- # Can be reset to something else with force
43
- configure_metrics(_TestingMetricsBackend(), force=True)
44
- assert get_metrics() != TestingMetricsBackend
45
-
46
-
47
- def test_consumer_metrics_wrapper() -> None:
48
- """Test that ConsumerMetricsWrapper automatically adds consumer_member_id to all metrics."""
49
- # Reset to a fresh backend
50
- backend = _TestingMetricsBackend()
51
- configure_metrics(backend, force=True)
52
-
53
- consumer_member_id = "test-consumer-123"
54
- consumer_metrics = get_consumer_metrics()
55
- consumer_metrics.consumer_member_id = consumer_member_id
56
-
57
- # Test increment
58
- consumer_metrics.increment("arroyo.consumer.run.count", 5, tags={"extra": "tag"})
59
-
60
- # Test gauge
61
- consumer_metrics.gauge("arroyo.consumer.librdkafka.total_queue_size", 10.5)
62
-
63
- # Test timing
64
- consumer_metrics.timing("arroyo.consumer.poll.time", 100, tags={"another": "tag"})
65
-
66
- expected_calls = [
67
- Increment(
68
- "arroyo.consumer.run.count",
69
- 5,
70
- {"consumer_member_id": consumer_member_id, "extra": "tag"},
71
- ),
72
- GaugeCall(
73
- "arroyo.consumer.librdkafka.total_queue_size",
74
- 10.5,
75
- {"consumer_member_id": consumer_member_id},
76
- ),
77
- Timing(
78
- "arroyo.consumer.poll.time",
79
- 100,
80
- {"consumer_member_id": consumer_member_id, "another": "tag"},
81
- ),
82
- ]
83
-
84
- assert backend.calls == expected_calls
File without changes
File without changes
File without changes