Search code examples
pythonopenstackrpcrestful-architecturezipkin

zipkin tracing openstack and osprofiler example


everyone

I am trying to use Zipkin to trace services in OpenStack. I know it is a huge project for me. So I wonder if there is an open source library for Zipkin tracing OpenStack.

I think I searched it before and if my mind does not cheat me, there is one presentation (only slices) for this. However, I can not find it. Can someone help with it?

I know there is the library, osprofiler, for tracing OpenStack, while the example of API seems unclear to me. Could you please give me a more detailed or even a complete example, maybe like Zipkin https://github.com/openzipkin/pyramid_zipkin-example

I do not mean it is not helpful. It seems I still have to find the RESTful request point in OpenStack, for example creating an instance may trigger one service to request neutron for networking, and I may have to locate the front end code and add a tracing code. If using py_zipkin, I can add decorator @zipkin_span(some params) before it. The problem is it is tough for me to find the front end of these services like Nova, neutron, cinder and so on.

It seems osprofiler does the same thing. My understanding is highly likely wrong, and I appreciate who can help with it.

By the way, I do not intend to trace a big project like OpenStack. I intend to trace a RESTful-like or RPC system with Zipkin to collect the information to analyze. Unfortunately, I have found a middle-size open source project. So I choose OpenStack. If you could provide me something else, that will be very helpful. :)

Thank you very much.


Solution

  • The best way to trace OpenStack project is to use Osprofiler library. If you just want to understand the workflow or just know about the types of calls being made inside OpenStack then Osprofiler is the best and easiest way to get the trace. Now Osprofiler is an accepted OpenStack project and the official project to get traces for OpenStack.

    Instead of having to go through the whole code and adding instrumentation points near HTTP request or RPC calls, osprofiler is already integrated in all of the main projects of OpenStack (Nova, Neutron, Keystone, Glance etc..). You just have to enable osprofiler in the configuration files of each project in OpenStack to get a trace of that particular project.

    You can go through this link - https://docs.openstack.org/osprofiler/latest/

    Enabling of Osprofiler in the configuration files can be done by adding these lines at the end of the configuration file (nova.conf or neutron.conf) :

    [profiler]
    enabled = True
    trace_sqlalchemy = True
    hmac_keys = SECRET_KEY
    connection_string = messaging://
    

    The connection_string parameter indicates the collector (where the trace information is stored). By default it uses Ceilometer. You can actually redirect the trace information to other collectors like Elasticsearch by changing the connection_string parameter in the conf file to the elasticsearch server.

    This is by far the easiest way to get a trace in OpenStack with just minimal effort.