Находки в опенсорсе: Python
1.06K subscribers
5 photos
349 links
Легкие задачки в опенсорсе из мира Python

Чат: @opensource_findings_chat
Download Telegram
🚀 New issue to ag2ai/faststream by @hmvp
📝 Bug: topic patterns are not correctly documented (#2804)


Describe the bug
When using a pattern for a kafka topic the generated asyncapi spec (and docs) does not include that handler

How to reproduce
With something along the lines of:

broker = KafkaBroker(...)

router = KafkaRouter()

@router.subscriber(pattern="some.wildcard.topic.*")
def handle_event(event: Event): ...

broker.include_router(router)

app = AsgiFastStream(
broker,
asyncapi_path="/docs",
)

Expected behavior
The subscriber is included in the asyncapi spec and docs. As far as I can see the asyncapi spec actually allows for this even when using Path variables.

Observed behavior
The asyncapi docs don't contain that subscriber.

Screenshots

Environment
Running FastStream 0.6.7 with CPython 3.14.0 on Linux

Additional context


#bug #good_first_issue #faststream #ag2ai
sent via relator
🚀 New issue to ag2ai/faststream by @dumpler
📝 Bug: Logger not properly passed to Confluent Kafka Producer and AdminClient (#2691)


Describe the bug

There are two related issues with logger configuration in the Confluent Kafka components:

1.

 Late Logger Setup in AsyncConfluentProducer

 In faststream/confluent/helpers/client.py at line 46, the Producer object is created before the _setup() method is called for loger_state. This results in the Producer receiving a NoSetLoggerObject instead of the intended logger passed during initialization.

2.

 Missing Logger in AdminClient
 The AdminClient in AdminService does not accept a logger parameter, even though it should. Currently, only the configuration is passed, leaving the AdminClient without proper logging.

How to reproduce
Include source code:

import logging

import uvicorn
from fastapi import FastAPI
from faststream.confluent.fastapi import KafkaRouter

logger = logging.getLogger("faststream")

router = KafkaRouter(
bootstrap_servers="kafka:9092",
enable_idempotence=True,
allow_auto_create_topics=False,
schema_url="/asyncapi",
include_in_schema=True,
logger=logger,
)

app = FastAPI()
app.include_router(router)

uvicorn.run(app, host="0.0.0.0", port=8000)

Expected behavior

1. The Producer in AsyncConfluentProducer should use the logger passed to KafkaRouter.
2. The AdminClient should inherit the same logger as other components.

Observed behavior

1. The Producer uses NoSetLoggerObject instead of the provided logger.
2. The AdminClient lacks logger configuration, leading to potential silent failures or inadequate logging.

Environment
Running FastStream 0.6.3 with CPython 3.13.1 on Linux


#bug #good_first_issue #faststream #ag2ai
sent via relator