skywalking
skywalking copied to clipboard
[Bug] SkyWalking agent failed to start if using kafka protocol with sasl_mechanism=PLAIN.
Search before asking
- [X] I had searched in the issues and found no similar issues.
Apache SkyWalking Component
Python Agent (apache/skywalking-python)
What happened
SkyWalking agent failed to start if using kafka protocol with sasl_mechanism=PLAIN.
What you expected to happen
SkyWalking agent starts successfully when using kafka protocol with sasl_mechanism=PLAIN.
How to reproduce
run a gunicorn app with a command like
SW_AGENT_PROTOCOL=kafka \
SW_KAFKA_BOOTSTRAP_SERVERS=localhost:9092 \
SW_KAFKA_REPORTER_CONFIG_security_protocol=SASL_PLAINTEXT \
SW_KAFKA_REPORTER_CONFIG_sasl_mechanism=PLAIN \
SW_KAFKA_REPORTER_CONFIG_sasl_plain_username=************ \
SW_KAFKA_REPORTER_CONFIG_sasl_plain_password=************ \
SW_AGENT_NAME=demo::gunicorn \
sw-python -d run -p gunicorn main:app
Anything else
The agent failed to start with AttributeError: 'SkyWalkingAgent' object has no attribute '_SkyWalkingAgent__log_queue'
Using kafka protocol with sasl_mechanism=PLAIN leads to "log.warning('%s: Sending username and password in the clear', self)". https://github.com/dpkp/kafka-python/blob/a6d0579d3cadd3826dd364b01bc12a2173139abc/kafka/conn.py#L624
the logging module was replaced by sw_logging, but __log_queue was not initialized yet
Are you willing to submit a pull request to fix on your own?
- [X] Yes I am willing to submit a pull request on my own!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Please send a pull request when you are ready.