| 136 | ) |
| 137 | |
| 138 | def assert_metrics( |
| 139 | self, |
| 140 | *, |
| 141 | registry: CollectorRegistry, |
| 142 | message: Any, |
| 143 | exception_class: type[Exception] | None, |
| 144 | custom_labels: dict[str, str], |
| 145 | ) -> None: |
| 146 | settings_provider = self.get_settings_provider() |
| 147 | consume_attrs = settings_provider.get_consume_attrs_from_message(message) |
| 148 | |
| 149 | received_messages_metric = get_received_messages_metric( |
| 150 | metrics_prefix="faststream", |
| 151 | app_name="faststream", |
| 152 | broker=settings_provider.messaging_system, |
| 153 | queue=consume_attrs["destination_name"], |
| 154 | messages_amount=consume_attrs["messages_count"], |
| 155 | custom_labels=custom_labels, |
| 156 | ) |
| 157 | |
| 158 | received_messages_size_bytes_metric = get_received_messages_size_bytes_metric( |
| 159 | metrics_prefix="faststream", |
| 160 | app_name="faststream", |
| 161 | broker=settings_provider.messaging_system, |
| 162 | queue=consume_attrs["destination_name"], |
| 163 | buckets=( |
| 164 | 2.0**4, |
| 165 | 2.0**6, |
| 166 | 2.0**8, |
| 167 | 2.0**10, |
| 168 | 2.0**12, |
| 169 | 2.0**14, |
| 170 | 2.0**16, |
| 171 | 2.0**18, |
| 172 | 2.0**20, |
| 173 | 2.0**22, |
| 174 | 2.0**24, |
| 175 | float("inf"), |
| 176 | ), |
| 177 | size=consume_attrs["message_size"], |
| 178 | messages_amount=1, |
| 179 | custom_labels=custom_labels, |
| 180 | ) |
| 181 | |
| 182 | received_messages_in_process_metric = get_received_messages_in_process_metric( |
| 183 | metrics_prefix="faststream", |
| 184 | app_name="faststream", |
| 185 | broker=settings_provider.messaging_system, |
| 186 | queue=consume_attrs["destination_name"], |
| 187 | messages_amount=0, |
| 188 | custom_labels=custom_labels, |
| 189 | ) |
| 190 | |
| 191 | received_processed_messages_duration_seconds_metric = ( |
| 192 | get_received_processed_messages_duration_seconds_metric( |
| 193 | metrics_prefix="faststream", |
| 194 | app_name="faststream", |
| 195 | broker=settings_provider.messaging_system, |