Skip to content

telemetry_attributes_provider_factory

faststream.kafka.opentelemetry.provider.telemetry_attributes_provider_factory #

telemetry_attributes_provider_factory(msg)
Source code in faststream/kafka/opentelemetry/provider.py
def telemetry_attributes_provider_factory(
    msg: Union["ConsumerRecord", Sequence["ConsumerRecord"], None],
) -> Union[
    KafkaTelemetrySettingsProvider,
    BatchKafkaTelemetrySettingsProvider,
]:
    if isinstance(msg, Sequence):
        return BatchKafkaTelemetrySettingsProvider()
    else:
        return KafkaTelemetrySettingsProvider()