Exemplo n.º 1
0
 def _handle_event(
     self,
     monitor: PrometheusMonitor,
     topic_partition: TP,
     stream: StreamT,
     event: EventT,
     offset: int,
 ) -> None:
     monitor.track_tp_end_offset(topic_partition, offset + 5)
     monitor.on_message_in(topic_partition, offset, event.message)
     monitor.on_stream_event_in(topic_partition, offset, stream, event)
     monitor.on_tp_commit({topic_partition: offset})
Exemplo n.º 2
0
    def test_on_stream_event_in(
        self,
        monitor: PrometheusMonitor,
        metrics: FaustMetrics,
        stream: StreamT,
        event: EventT,
    ) -> None:
        monitor.on_stream_event_in(TP1, 401, stream, event)

        self.assert_has_sample_value(metrics.total_events,
                                     "total_events_total", {}, 1)
        self.assert_has_sample_value(metrics.total_active_events,
                                     "total_active_events", {}, 1)
        self.assert_has_sample_value(
            metrics.total_events_per_stream,
            "total_events_per_stream_total",
            {"stream": "stream.topic_foo.events"},
            1,
        )