sentry-arroyo 2.26.0__tar.gz → 2.28.0__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.26.0/sentry_arroyo.egg-info → sentry_arroyo-2.28.0}/PKG-INFO +1 -1
  2. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/processor.py +2 -3
  3. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/metrics.py +1 -48
  4. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0/sentry_arroyo.egg-info}/PKG-INFO +1 -1
  5. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/setup.py +1 -1
  6. sentry_arroyo-2.28.0/tests/utils/test_metrics.py +33 -0
  7. sentry_arroyo-2.26.0/tests/utils/test_metrics.py +0 -84
  8. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/LICENSE +0 -0
  9. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/MANIFEST.in +0 -0
  10. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/README.md +0 -0
  11. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/__init__.py +0 -0
  12. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/__init__.py +0 -0
  13. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/abstract.py +0 -0
  14. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/kafka/__init__.py +0 -0
  15. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/kafka/commit.py +0 -0
  16. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/kafka/configuration.py +0 -0
  17. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/kafka/consumer.py +0 -0
  18. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/local/__init__.py +0 -0
  19. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/local/backend.py +0 -0
  20. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/local/storages/__init__.py +0 -0
  21. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/local/storages/abstract.py +0 -0
  22. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/backends/local/storages/memory.py +0 -0
  23. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/commit.py +0 -0
  24. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/dlq.py +0 -0
  25. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/errors.py +0 -0
  26. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/__init__.py +0 -0
  27. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/__init__.py +0 -0
  28. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/abstract.py +0 -0
  29. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/batching.py +0 -0
  30. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/buffer.py +0 -0
  31. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/commit.py +0 -0
  32. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/filter.py +0 -0
  33. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/guard.py +0 -0
  34. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/healthcheck.py +0 -0
  35. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/noop.py +0 -0
  36. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/produce.py +0 -0
  37. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/reduce.py +0 -0
  38. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/run_task.py +0 -0
  39. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/run_task_in_threads.py +0 -0
  40. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/run_task_with_multiprocessing.py +0 -0
  41. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/processing/strategies/unfold.py +0 -0
  42. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/py.typed +0 -0
  43. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/types.py +0 -0
  44. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/__init__.py +0 -0
  45. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/clock.py +0 -0
  46. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/codecs.py +0 -0
  47. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/concurrent.py +0 -0
  48. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/logging.py +0 -0
  49. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/metricDefs.json +0 -0
  50. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/metric_defs.py +0 -0
  51. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/profiler.py +0 -0
  52. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/arroyo/utils/retries.py +0 -0
  53. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/examples/transform_and_produce/__init__.py +0 -0
  54. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/examples/transform_and_produce/batched.py +0 -0
  55. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/examples/transform_and_produce/script.py +0 -0
  56. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/examples/transform_and_produce/simple.py +0 -0
  57. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/requirements.txt +0 -0
  58. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/sentry_arroyo.egg-info/SOURCES.txt +0 -0
  59. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/sentry_arroyo.egg-info/dependency_links.txt +0 -0
  60. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/sentry_arroyo.egg-info/not-zip-safe +0 -0
  61. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/sentry_arroyo.egg-info/requires.txt +0 -0
  62. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/sentry_arroyo.egg-info/top_level.txt +0 -0
  63. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/setup.cfg +0 -0
  64. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/backends/__init__.py +0 -0
  65. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/backends/mixins.py +0 -0
  66. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/backends/test_commit.py +0 -0
  67. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/backends/test_kafka.py +0 -0
  68. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/backends/test_kafka_producer.py +0 -0
  69. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/backends/test_local.py +0 -0
  70. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/__init__.py +0 -0
  71. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/__init__.py +0 -0
  72. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_all.py +0 -0
  73. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_batching.py +0 -0
  74. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_buffer.py +0 -0
  75. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_commit.py +0 -0
  76. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_filter.py +0 -0
  77. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_guard.py +0 -0
  78. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_noop.py +0 -0
  79. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_produce.py +0 -0
  80. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_reduce.py +0 -0
  81. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_run_task.py +0 -0
  82. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_run_task_in_threads.py +0 -0
  83. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_run_task_with_multiprocessing.py +0 -0
  84. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/strategies/test_unfold.py +0 -0
  85. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/processing/test_processor.py +0 -0
  86. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/test_commit.py +0 -0
  87. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/test_dlq.py +0 -0
  88. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/test_kip848_e2e.py +0 -0
  89. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/test_types.py +0 -0
  90. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/utils/__init__.py +0 -0
  91. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/tests/utils/test_concurrent.py +0 -0
  92. {sentry_arroyo-2.26.0 → sentry_arroyo-2.28.0}/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.26.0
3
+ Version: 2.28.0
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)
@@ -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.26.0
3
+ Version: 2.28.0
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.26.0",
13
+ version="2.28.0",
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