New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Apache Skywalking, flask uwsgi, no metrics send to server #6324
Comments
@MichaelProjects this seems to be duplicated with #5263 but also seems you had referred to it already. Can you move the grpc patch part to the top like this from gevent import monkey
monkey.patch_all()
import grpc.experimental.gevent as grpc_gevent # key point
grpc_gevent.init_gevent() # key point
config.flask_collect_http_params = True
config.logging_level = 'DEBUG'
config.disable_plugins = 'sw_tornado'
config.init(collector='X.X.X.X:11800', service='Contentservice')
agent.start() |
As this is exactly the same question with #5263 and the answer was provided, I'll close this for now, if @MichaelProjects you have any further question, feel free to continue this issue by adding comments here |
Thanks for your answer, I saw the issue and tried it out before, but it didn't work. I think uwsgi is blocking the request to the server. If I run it, it only prints heartbeats send and a hash value every 10 seconds or something between, and it doesn't show the value of the sended metric after an endpoint request. However, if it runs with python3 and run.py then it behaves the way it should. |
@MichaelProjects did you try the same code snippets posted 👆? I tried that it works, if you saw heartbeats logs, the agent is working normally, make sure to send traffics / requests to the service, and the metrics are not sent by agent, they are calculated in SkyWalking backend with the traces caused by traffics. |
Yes I did, now I saw that the server is reciving following requests: 2021-02-05 19:26:25,506 - org.apache.skywalking.oap.server.storage.plugin.elasticsearch7.client.ElasticSearch7Client -14095820 [pool-7-thread-1] INFO [] - Synchronous bulk took time: 7990 millis, size: 3 But the content isn't displayed in the web ui of skywalking, but if i ping it in the development server with python3, then it shows them in the ui. |
I also, found out if i stop my docker containers, then it displays the content in the skywalking ui. |
@MichaelProjects did you try uwsgi in a container and try Python3 on your development machine? If so, pay attention to the time zone on the SkyWalking web ui (bottom right), I believe the time zones in your machine and container are different. If you can reproduce using docker container, it would be more convenient to share your docker image registry / name (privately via email if not applicable on GitHub) to help reproduce. See my email in my GitHub profile. |
Please answer these questions before submitting your issue.
Because I like apache skywalking and it's really annoying
So the following issue is, if I run my flask app with a normal "python3 run.app" and call an endpoint, then it will send the needed metrics to the aop server(it runs in a docker container) but if i run my app with uwsgi, then it wont send the needed metrics to the server.
Flask==1.1.2
apache-skywalking[http]==0.5.0
Question
Bug
serverlog:
contentservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Contentservice], [dc037ddc672111eb94ef0242c0a8f002]
imageservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Imageservice], [dc0047ac672111eba89e0242c0a8f003]
userservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Userservice], [dbbe190e672111eb95d70242c0a8f007]
contentservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Contentservice], [dc037ddc672111eb94ef0242c0a8f002]
imageservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Imageservice], [dc0047ac672111eba89e0242c0a8f003]
contentservice | [pid: 16|app: 0|req: 19/25] 95.91.253.112 () {40 vars in 740 bytes} [Thu Feb 4 21:14:21 2021] GET /contentservice/getcontent => generated 1479 bytes in 60 msecs (HTTP/2.0 200) 2 headers in 73 bytes (1 switches on core 0)
nginx | 95.91.253.112 - - [04/Feb/2021:21:14:21 +0000] "GET /contentservice/getcontent HTTP/2.0" 200 1479 "-" "insomnia/2020.5.2" "-"
userservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Userservice], [dbbe190e672111eb95d70242c0a8f007]
contentservice | skywalking [HeartbeatThread] [DEBUG] service heart beats, [Contentservice], [dc037ddc672111eb94ef0242c0a8f002]
Programmcode:
from gevent import monkey
monkey.patch_all()
config.flask_collect_http_params = True
config.logging_level = 'DEBUG'
config.disable_plugins = 'sw_tornado'
config.init(collector='X.X.X.X:11800', service='Contentservice')
agent.start()
import grpc.experimental.gevent as grpc_gevent # key point
grpc_gevent.init_gevent() # key point
Which version of SkyWalking, OS, and JRE?
https://hub.docker.com/r/apache/skywalking-oap-server
ubuntu 20.04
Which company or project?
Private use
What happened?
If possible, provide a way to reproduce the error. e.g. demo application, component version.
Requirement or improvement
The text was updated successfully, but these errors were encountered: